[clang] 8b21e07 - [clang] NFC: Remove unused `DirectoryLookup`

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 18 07:02:26 PST 2022


Author: Jan Svoboda
Date: 2022-01-18T16:02:18+01:00
New Revision: 8b21e074dbdf79062505f28b700bd4502acf3096

URL: https://github.com/llvm/llvm-project/commit/8b21e074dbdf79062505f28b700bd4502acf3096
DIFF: https://github.com/llvm/llvm-project/commit/8b21e074dbdf79062505f28b700bd4502acf3096.diff

LOG: [clang] NFC: Remove unused `DirectoryLookup`

This patch removes bitrotten/dead uses of `DirectoryLookup` in `InclusionRewriter.cpp`.

Reviewed By: ahoppen

Differential Revision: https://reviews.llvm.org/D117309

Added: 
    

Modified: 
    clang/lib/Frontend/Rewrite/InclusionRewriter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
index 3f2a781274773..931f3a24c5888 100644
--- a/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
+++ b/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp
@@ -14,7 +14,6 @@
 #include "clang/Rewrite/Frontend/Rewriters.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Frontend/PreprocessorOutputOptions.h"
-#include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/Pragma.h"
 #include "clang/Lex/Preprocessor.h"
 #include "llvm/ADT/SmallString.h"
@@ -31,10 +30,8 @@ class InclusionRewriter : public PPCallbacks {
   struct IncludedFile {
     FileID Id;
     SrcMgr::CharacteristicKind FileType;
-    const DirectoryLookup *DirLookup;
-    IncludedFile(FileID Id, SrcMgr::CharacteristicKind FileType,
-                 const DirectoryLookup *DirLookup)
-        : Id(Id), FileType(FileType), DirLookup(DirLookup) {}
+    IncludedFile(FileID Id, SrcMgr::CharacteristicKind FileType)
+        : Id(Id), FileType(FileType) {}
   };
   Preprocessor &PP; ///< Used to find inclusion directives.
   SourceManager &SM; ///< Used to read and manage source files.
@@ -57,8 +54,7 @@ class InclusionRewriter : public PPCallbacks {
 public:
   InclusionRewriter(Preprocessor &PP, raw_ostream &OS, bool ShowLineMarkers,
                     bool UseLineDirectives);
-  void Process(FileID FileId, SrcMgr::CharacteristicKind FileType,
-               const DirectoryLookup *DirLookup);
+  void Process(FileID FileId, SrcMgr::CharacteristicKind FileType);
   void setPredefinesBuffer(const llvm::MemoryBufferRef &Buf) {
     PredefinesBuffer = Buf;
   }
@@ -162,8 +158,7 @@ void InclusionRewriter::FileChanged(SourceLocation Loc,
     return;
   FileID Id = FullSourceLoc(Loc, SM).getFileID();
   auto P = FileIncludes.insert(
-      std::make_pair(LastInclusionLocation,
-                     IncludedFile(Id, NewFileType, PP.GetCurDirLookup())));
+      std::make_pair(LastInclusionLocation, IncludedFile(Id, NewFileType)));
   (void)P;
   assert(P.second && "Unexpected revisitation of the same include directive");
   LastInclusionLocation = SourceLocation();
@@ -371,8 +366,7 @@ StringRef InclusionRewriter::NextIdentifierName(Lexer &RawLex,
 /// Use a raw lexer to analyze \p FileId, incrementally copying parts of it
 /// and including content of included files recursively.
 void InclusionRewriter::Process(FileID FileId,
-                                SrcMgr::CharacteristicKind FileType,
-                                const DirectoryLookup *DirLookup) {
+                                SrcMgr::CharacteristicKind FileType) {
   MemoryBufferRef FromFile;
   {
     auto B = SM.getBufferOrNone(FileId);
@@ -433,7 +427,7 @@ void InclusionRewriter::Process(FileID FileId,
                    << Mod->getFullModuleName(true) << "\n";
 
               // Include and recursively process the file.
-              Process(Inc->Id, Inc->FileType, Inc->DirLookup);
+              Process(Inc->Id, Inc->FileType);
 
               if (Mod)
                 OS << "#pragma clang module end /*"
@@ -559,7 +553,7 @@ void clang::RewriteIncludesInInput(Preprocessor &PP, raw_ostream *OS,
       Rewrite->handleModuleBegin(Tok);
   } while (Tok.isNot(tok::eof));
   Rewrite->setPredefinesBuffer(SM.getBufferOrFake(PP.getPredefinesFileID()));
-  Rewrite->Process(PP.getPredefinesFileID(), SrcMgr::C_User, nullptr);
-  Rewrite->Process(SM.getMainFileID(), SrcMgr::C_User, nullptr);
+  Rewrite->Process(PP.getPredefinesFileID(), SrcMgr::C_User);
+  Rewrite->Process(SM.getMainFileID(), SrcMgr::C_User);
   OS->flush();
 }


        


More information about the cfe-commits mailing list