diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-10-14 11:11:09 -0400 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-10-19 19:10:21 -0400 |
commit | b3eff6b7bb31e7ef059a3d238de138849839fbbd (patch) | |
tree | 272f6e35d4c60e81b3cab9258f24cc4d9e1a53d9 /clang/lib/Frontend/FrontendAction.cpp | |
parent | 57211fd239a3a3efe89f0b7091f86a167f8301ff (diff) | |
download | llvm-b3eff6b7bb31e7ef059a3d238de138849839fbbd.zip llvm-b3eff6b7bb31e7ef059a3d238de138849839fbbd.tar.gz llvm-b3eff6b7bb31e7ef059a3d238de138849839fbbd.tar.bz2 |
Lexer: Update the Lexer to use MemoryBufferRef, NFC
Update `Lexer` / `Lexer::Lexer` to use `MemoryBufferRef` instead of
`MemoryBuffer*`. Callers that were acquiring a `MemoryBuffer*` via
`SourceManager::getBuffer` were updated, such that if they checked
`Invalid` they use `getBufferOrNone` and otherwise `getBufferOrFake`.
Differential Revision: https://reviews.llvm.org/D89398
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 9a806d7..384c504 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -233,13 +233,12 @@ static SourceLocation ReadOriginalFileName(CompilerInstance &CI, auto &SourceMgr = CI.getSourceManager(); auto MainFileID = SourceMgr.getMainFileID(); - bool Invalid = false; - const auto *MainFileBuf = SourceMgr.getBuffer(MainFileID, &Invalid); - if (Invalid) + auto MainFileBuf = SourceMgr.getBufferOrNone(MainFileID); + if (!MainFileBuf) return SourceLocation(); std::unique_ptr<Lexer> RawLexer( - new Lexer(MainFileID, MainFileBuf, SourceMgr, CI.getLangOpts())); + new Lexer(MainFileID, *MainFileBuf, SourceMgr, CI.getLangOpts())); // If the first line has the syntax of // |