[clang] e787022 - [SourceManager] Skip module maps when searching files for macro arguments

Jan Korous via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 12:37:06 PDT 2020


Author: Jan Korous
Date: 2020-10-22T12:36:51-07:00
New Revision: e7870223d8b586cd89ffc7fddd63bc40447bd3fb

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

LOG: [SourceManager] Skip module maps when searching files for macro arguments

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

Added: 
    

Modified: 
    clang/lib/Basic/SourceManager.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 9592b92f59bc..3bffcb548ebb 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -1761,7 +1761,12 @@ void SourceManager::computeMacroArgsCache(MacroArgsMap &MacroArgsCache,
     if (Invalid)
       return;
     if (Entry.isFile()) {
-      SourceLocation IncludeLoc = Entry.getFile().getIncludeLoc();
+      auto File = Entry.getFile();
+      if (File.getFileCharacteristic() == C_User_ModuleMap ||
+          File.getFileCharacteristic() == C_System_ModuleMap)
+        continue;
+
+      SourceLocation IncludeLoc = File.getIncludeLoc();
       bool IncludedInFID =
           (IncludeLoc.isValid() && isInFileID(IncludeLoc, FID)) ||
           // Predefined header doesn't have a valid include location in main


        


More information about the cfe-commits mailing list