From b03ae74319f19c3b86982638671d00205a91d263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Duncan=20P=2E=20N=2E=20Exon=C2=A0Smith?= Date: Wed, 14 Oct 2020 12:37:19 -0400 Subject: 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Lex/ModuleMap.cpp') diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 12da5a8..c47a3a0 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -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 Buffer = SourceMgr.getBufferOrNone(ID); if (!Buffer) return ParsedModuleMap[File] = true; assert((!Offset || *Offset <= Buffer->getBufferSize()) && -- cgit v1.1