================
@@ -92,16 +92,10 @@ bool Preprocessor::EnterSourceFile(FileID FID, 
ConstSearchDirIterator CurDir,
   }
 
   Lexer *TheLexer = new Lexer(FID, *InputFile, *this, IsFirstIncludeOfFile);
-  if (getPreprocessorOpts().DependencyDirectivesForFile &&
-      FID != PredefinesFileID) {
-    if (OptionalFileEntryRef File = SourceMgr.getFileEntryRefForID(FID)) {
-      if (std::optional<ArrayRef<dependency_directives_scan::Directive>>
-              DepDirectives =
-                  getPreprocessorOpts().DependencyDirectivesForFile(*File)) {
-        TheLexer->DepDirectives = *DepDirectives;
-      }
-    }
-  }
+  if (GetDependencyDirectives && FID != PredefinesFileID)
+    if (OptionalFileEntryRef File = SourceMgr.getFileEntryRefForID(FID))
+      if (auto MaybeDepDirectives = GetDependencyDirectives(FileMgr, *File))
----------------
cyndyishida wrote:

Apologies if this is obvious, but what is the difference between the `FileMgr`  
in the `Preprocessor` compared to the `FileMgr` that's tied to the 
CompilerInstance object created in 
https://github.com/llvm/llvm-project/pull/136178/files#diff-9190b5361d3722e679a0ea59ff46cc21f6d10d6e61049d73b3bc2e1ea56eb8f6R1243
 ? 

IOW, why is the potential assignment of DepDirectivesGetter's attributes on 
each call to the function & not during assignment of the function object?

https://github.com/llvm/llvm-project/pull/136178
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to