From 21ef873660cee8c03e08dd1406faa2c70fc8b5f3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 23 Apr 2024 15:10:23 -0400 Subject: clang-tidy module: Update to build against LLVM/Clang 18 --- Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx | 17 +++++++++-------- 1 file 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> Macros; - llvm::StringMap Files; + llvm::StringMap Files; std::map> Ifndefs; std::map EndIfs; -- cgit v0.12