clang/Frontend: Use MemoryBufferRef in FrontendInputFile (and remove SourceManager...
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 14 Oct 2020 21:17:34 +0000 (17:17 -0400)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 20 Oct 2020 17:35:46 +0000 (13:35 -0400)
commit51d1d585e5838ea0f02f1271f7543c4e43639969
tree3d3fb9ba09116272f10ea8832fbd4cbd3575f7fc
parent59286b36dfb5da3a73401f66d1fa8d65c7817f94
clang/Frontend: Use MemoryBufferRef in FrontendInputFile (and remove SourceManager::getBuffer)

In order to drop the final callers to `SourceManager::getBuffer`, change
`FrontendInputFile` to use `Optional<MemoryBufferRef>`. Also updated
the "unowned" version of `SourceManager::createFileID` to take a
`MemoryBufferRef` (it now calls `MemoryBuffer::getMemBuffer`, which
creates a `MemoryBuffer` that does not own the buffer data).

Differential Revision: https://reviews.llvm.org/D89427
clang/include/clang/Basic/SourceManager.h
clang/include/clang/Frontend/FrontendAction.h
clang/include/clang/Frontend/FrontendOptions.h
clang/lib/Basic/SourceManager.cpp
clang/lib/Format/MacroExpander.cpp
clang/lib/Frontend/ASTUnit.cpp
clang/lib/Frontend/CompilerInstance.cpp
clang/lib/Frontend/FrontendAction.cpp
clang/lib/Frontend/FrontendActions.cpp
clang/unittests/Format/TestLexer.h