aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-10-14 17:54:44 -0400
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-10-20 19:28:17 -0400
commit1d78e2101ab75f01615a45467c44da7181cccedb (patch)
treef3e759ce8ce2e8ff771c052316c3ef28d0dc7238 /clang/lib/Basic/SourceManager.cpp
parent7175cffb2133048018df74c1b49d1d4962ea18f2 (diff)
downloadllvm-1d78e2101ab75f01615a45467c44da7181cccedb.zip
llvm-1d78e2101ab75f01615a45467c44da7181cccedb.tar.gz
llvm-1d78e2101ab75f01615a45467c44da7181cccedb.tar.bz2
clang/Basic: ContentCache::InvalidFlag => ContentCache::IsBufferInvalid, NFC
Move a flag out of the `MemoryBuffer*` to unblock changing it to a `unique_ptr`. There are plenty of bits available in the bitfield below. Differential Revision: https://reviews.llvm.org/D89431
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 27d2f39..c831d26 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -123,7 +123,7 @@ ContentCache::getBufferOrNone(DiagnosticsEngine &Diag, FileManager &FM,
SourceLocation Loc) const {
// Lazily create the Buffer for ContentCaches that wrap files. If we already
// computed it, just return what we have.
- if (isBufferInvalid())
+ if (IsBufferInvalid)
return None;
if (auto *B = Buffer.getPointer())
return B->getMemBufferRef();
@@ -144,7 +144,7 @@ ContentCache::getBufferOrNone(DiagnosticsEngine &Diag, FileManager &FM,
Diag.Report(Loc, diag::err_file_too_large)
<< ContentsEntry->getName();
- Buffer.setInt(Buffer.getInt() | InvalidFlag);
+ IsBufferInvalid = true;
return None;
}
@@ -164,7 +164,7 @@ ContentCache::getBufferOrNone(DiagnosticsEngine &Diag, FileManager &FM,
Diag.Report(Loc, diag::err_cannot_open_file)
<< ContentsEntry->getName() << BufferOrError.getError().message();
- Buffer.setInt(Buffer.getInt() | InvalidFlag);
+ IsBufferInvalid = true;
return None;
}
@@ -180,7 +180,7 @@ ContentCache::getBufferOrNone(DiagnosticsEngine &Diag, FileManager &FM,
Diag.Report(Loc, diag::err_file_modified)
<< ContentsEntry->getName();
- Buffer.setInt(Buffer.getInt() | InvalidFlag);
+ IsBufferInvalid = true;
return None;
}
@@ -193,7 +193,7 @@ ContentCache::getBufferOrNone(DiagnosticsEngine &Diag, FileManager &FM,
if (InvalidBOM) {
Diag.Report(Loc, diag::err_unsupported_bom)
<< InvalidBOM << ContentsEntry->getName();
- Buffer.setInt(Buffer.getInt() | InvalidFlag);
+ IsBufferInvalid = true;
return None;
}