clang/Lex: Stop using SourceManager::getBuffer
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 14 Oct 2020 16:37:19 +0000 (12:37 -0400)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 20 Oct 2020 00:27:56 +0000 (20:27 -0400)
commitb03ae74319f19c3b86982638671d00205a91d263
treefa78fb63028c1a4ccb092da09cef909eb7a7b5ec
parenta668ad92d5e2161e07e1a435a19ea5072f52a989
clang/Lex: Stop using SourceManager::getBuffer

Update clang/lib/Lex to stop relying on a `MemoryBuffer*`, using the
`MemoryBufferRef` from `getBufferOrNone` since both locations had logic
for checking validity of the buffer. There's potentially a functionality
change, since the logic was wrong (it checked for `nullptr`, which was
never returned by the old API), but if that was reachable the new
behaviour should be better.

Differential Revision: https://reviews.llvm.org/D89402
clang/lib/Lex/ModuleMap.cpp
clang/lib/Lex/PPDirectives.cpp