aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2023-09-08 16:26:02 -0700
committerJan Svoboda <jan_svoboda@apple.com>2023-09-08 19:04:01 -0700
commit523c471250a49b5603bd907ff05535f18ef61c91 (patch)
tree91241ae9d1897992132227f5d66d0a6a8dcf0b09 /clang/lib/CodeGen/CodeGenModule.cpp
parenta3ba9d697b17ebb969b86b5c3b34b102fd22e583 (diff)
downloadllvm-523c471250a49b5603bd907ff05535f18ef61c91.zip
llvm-523c471250a49b5603bd907ff05535f18ef61c91.tar.gz
llvm-523c471250a49b5603bd907ff05535f18ef61c91.tar.bz2
Reapply "[clang] NFCI: Adopt `SourceManager::getFileEntryRefForID()`"
This reapplies ddbcc10b9e26b18f6a70e23d0611b9da75ffa52f, except for a tiny part that was reverted separately: 65331da0032ab4253a4bc0ddcb2da67664bd86a9. That will be reapplied later on, since it turned out to be more involved. This commit is enabled by 5523fefb01c282c4cbcaf6314a9aaf658c6c145f and f0f548a65a215c450d956dbcedb03656449705b9, specifically the part that makes 'clang-tidy/checkers/misc/header-include-cycle.cpp' separator agnostic.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index f5513217..8b0c934 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3215,7 +3215,7 @@ bool CodeGenModule::isInNoSanitizeList(SanitizerMask Kind, llvm::Function *Fn,
return true;
// NoSanitize by location. Check "mainfile" prefix.
auto &SM = Context.getSourceManager();
- const FileEntry &MainFile = *SM.getFileEntryForID(SM.getMainFileID());
+ FileEntryRef MainFile = *SM.getFileEntryRefForID(SM.getMainFileID());
if (NoSanitizeL.containsMainFile(Kind, MainFile.getName()))
return true;
@@ -3236,7 +3236,8 @@ bool CodeGenModule::isInNoSanitizeList(SanitizerMask Kind,
return true;
auto &SM = Context.getSourceManager();
if (NoSanitizeL.containsMainFile(
- Kind, SM.getFileEntryForID(SM.getMainFileID())->getName(), Category))
+ Kind, SM.getFileEntryRefForID(SM.getMainFileID())->getName(),
+ Category))
return true;
if (NoSanitizeL.containsLocation(Kind, Loc, Category))
return true;
@@ -3302,7 +3303,7 @@ CodeGenModule::isFunctionBlockedByProfileList(llvm::Function *Fn,
// If location is unknown, this may be a compiler-generated function. Assume
// it's located in the main file.
auto &SM = Context.getSourceManager();
- if (const auto *MainFile = SM.getFileEntryForID(SM.getMainFileID()))
+ if (auto MainFile = SM.getFileEntryRefForID(SM.getMainFileID()))
if (auto V = ProfileList.isFileExcluded(MainFile->getName(), Kind))
return *V;
return ProfileList.getDefault(Kind);