forked from OSchip/llvm-project
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
This commit is contained in:
parent
a668ad92d5
commit
b03ae74319
|
@ -3004,7 +3004,7 @@ bool ModuleMap::parseModuleMapFile(const FileEntry *File, bool IsSystem,
|
|||
}
|
||||
|
||||
assert(Target && "Missing target information");
|
||||
const llvm::MemoryBuffer *Buffer = SourceMgr.getBuffer(ID);
|
||||
llvm::Optional<llvm::MemoryBufferRef> Buffer = SourceMgr.getBufferOrNone(ID);
|
||||
if (!Buffer)
|
||||
return ParsedModuleMap[File] = true;
|
||||
assert((!Offset || *Offset <= Buffer->getBufferSize()) &&
|
||||
|
|
|
@ -379,7 +379,8 @@ Optional<unsigned> Preprocessor::getSkippedRangeForExcludedConditionalBlock(
|
|||
|
||||
std::pair<FileID, unsigned> HashFileOffset =
|
||||
SourceMgr.getDecomposedLoc(HashLoc);
|
||||
const llvm::MemoryBuffer *Buf = SourceMgr.getBuffer(HashFileOffset.first);
|
||||
Optional<llvm::MemoryBufferRef> Buf =
|
||||
SourceMgr.getBufferOrNone(HashFileOffset.first);
|
||||
if (!Buf)
|
||||
return None;
|
||||
auto It =
|
||||
|
|
Loading…
Reference in New Issue