[clang] e7fe3c6 - Basic: Simplify SourceManager::getBuffer overload, NFC
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 13 14:55:00 PDT 2020
Author: Duncan P. N. Exon Smith
Date: 2020-10-13T17:52:59-04:00
New Revision: e7fe3c6dfede8d5781bd000741c3dea7088307a4
URL: https://github.com/llvm/llvm-project/commit/e7fe3c6dfede8d5781bd000741c3dea7088307a4
DIFF: https://github.com/llvm/llvm-project/commit/e7fe3c6dfede8d5781bd000741c3dea7088307a4.diff
LOG: Basic: Simplify SourceManager::getBuffer overload, NFC
Avoid duplicating code unnecessarily. No functionality change.
Added:
Modified:
clang/include/clang/Basic/SourceManager.h
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h
index 5c666c1760b4..1e6a800f1d55 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -979,17 +979,7 @@ class SourceManager : public RefCountedBase<SourceManager> {
const llvm::MemoryBuffer *getBuffer(FileID FID,
bool *Invalid = nullptr) const {
- bool MyInvalid = false;
- const SrcMgr::SLocEntry &Entry = getSLocEntry(FID, &MyInvalid);
- if (MyInvalid || !Entry.isFile()) {
- if (Invalid)
- *Invalid = true;
-
- return getFakeBufferForRecovery();
- }
-
- return Entry.getFile().getContentCache()->getBuffer(
- Diag, getFileManager(), SourceLocation(), Invalid);
+ return getBuffer(FID, SourceLocation(), Invalid);
}
/// Returns the FileEntry record for the provided FileID.
More information about the cfe-commits
mailing list