summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2023-09-06 10:35:54 -0700
committerJan Svoboda <jan@svoboda.ai>2023-09-06 10:49:48 -0700
commitddbcc10b9e26b18f6a70e23d0611b9da75ffa52f (patch)
treed7441ec31d0e7477dcb61534db69c066289db9ac /clang/lib/CodeGen/CodeGenModule.cpp
parent827171398116e1902acc57d5559636cec2e42858 (diff)
[clang] NFCI: Adopt `SourceManager::getFileEntryRefForID()`
This commit replaces some calls to the deprecated `FileEntry::getName()` with `FileEntryRef::getName()` by swapping current usages of `SourceManager::getFileEntryForID()` with `SourceManager::getFileEntryRefForID()`. This lowers the number of usages of the deprecated `FileEntry::getName()` from 95 to 50.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index f5513217bebf..95f185f5824d 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,7 @@ 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 +3302,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);