aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-10-14 14:36:00 -0400
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-10-15 00:35:16 -0400
commit006519816689acef5fd971955e21b7ab17ae65d9 (patch)
tree0fe0d280bf3e3c4e8db4e58cbd728f4ded429eb4 /clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp
parentaf4fb416bd355960ce93f271a0591f24f58d25ec (diff)
downloadllvm-006519816689acef5fd971955e21b7ab17ae65d9.zip
llvm-006519816689acef5fd971955e21b7ab17ae65d9.tar.gz
llvm-006519816689acef5fd971955e21b7ab17ae65d9.tar.bz2
clang-{tools,unittests}: Stop using SourceManager::getBuffer, NFC
Update clang-tools-extra, clang/tools, clang/unittests to migrate from `SourceManager::getBuffer`, which returns an always dereferenceable `MemoryBuffer*`, to `getBufferOrNone` or `getBufferOrFake`, both of which return a `MemoryBufferRef`, depending on whether the call site was checking for validity of the buffer. No functionality change intended. Differential Revision: https://reviews.llvm.org/D89416
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp b/clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp
index 53cebc3..3e3f8db 100644
--- a/clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp
@@ -140,7 +140,8 @@ SourceLocation StaticAssertCheck::getLastParenLoc(const ASTContext *ASTCtx,
const LangOptions &Opts = ASTCtx->getLangOpts();
const SourceManager &SM = ASTCtx->getSourceManager();
- const llvm::MemoryBuffer *Buffer = SM.getBuffer(SM.getFileID(AssertLoc));
+ llvm::Optional<llvm::MemoryBufferRef> Buffer =
+ SM.getBufferOrNone(SM.getFileID(AssertLoc));
if (!Buffer)
return SourceLocation();