summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-04-23 19:10:23 (GMT)
committerBrad King <brad.king@kitware.com>2024-04-24 20:43:00 (GMT)
commit21ef873660cee8c03e08dd1406faa2c70fc8b5f3 (patch)
tree3af35a7ea96a2e457c99bb495dca446ae9ea0a68
parent7339fbf0392f57202a6f9480b5629ccb3fb91d35 (diff)
downloadCMake-21ef873660cee8c03e08dd1406faa2c70fc8b5f3.zip
CMake-21ef873660cee8c03e08dd1406faa2c70fc8b5f3.tar.gz
CMake-21ef873660cee8c03e08dd1406faa2c70fc8b5f3.tar.bz2
clang-tidy module: Update to build against LLVM/Clang 18
-rw-r--r--Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx b/Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx
index 37ecd70..9ec8e5f 100644
--- a/Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx
+++ b/Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx
@@ -55,10 +55,10 @@ public:
, FID(FID)
{
SourceManager& SM = this->PP->getSourceManager();
- const FileEntry* Entry = SM.getFileEntryForID(FID);
+ OptionalFileEntryRef Entry = SM.getFileEntryRefForID(FID);
assert(Entry && "Invalid FileID given");
- Lexer MyLexer(FID, SM.getMemoryBufferForFileOrFake(Entry), SM,
+ Lexer MyLexer(FID, SM.getMemoryBufferForFileOrFake(*Entry), SM,
this->PP->getLangOpts());
Token Tok;
@@ -157,9 +157,10 @@ public:
// guards.
SourceManager& SM = this->PP->getSourceManager();
if (Reason == EnterFile && FileType == SrcMgr::C_User) {
- if (const FileEntry* FE = SM.getFileEntryForID(SM.getFileID(Loc))) {
+ if (OptionalFileEntryRef FE =
+ SM.getFileEntryRefForID(SM.getFileID(Loc))) {
std::string FileName = cleanPath(FE->getName());
- this->Files[FileName] = FE;
+ this->Files.try_emplace(FileName, *FE);
}
}
}
@@ -205,9 +206,9 @@ public:
continue;
}
- const FileEntry* FE =
- SM.getFileEntryForID(SM.getFileID(MI->getDefinitionLoc()));
- std::string FileName = cleanPath(FE->getName());
+ FileEntryRef FE =
+ *SM.getFileEntryRefForID(SM.getFileID(MI->getDefinitionLoc()));
+ std::string FileName = cleanPath(FE.getName());
this->Files.erase(FileName);
// Look up Locations for this guard.
@@ -290,7 +291,7 @@ private:
}
std::vector<std::pair<Token, const MacroInfo*>> Macros;
- llvm::StringMap<const FileEntry*> Files;
+ llvm::StringMap<FileEntryRef> Files;
std::map<const IdentifierInfo*, std::pair<SourceLocation, SourceLocation>>
Ifndefs;
std::map<SourceLocation, SourceLocation> EndIfs;