[PATCH] D47118: [modules] Print input files when -module-file-info file switch is passed.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 23:54:50 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL337353: [modules] Print input files when -module-file-info file switch is passed. (authored by vvassilev, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D47118?vs=147709&id=156019#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47118

Files:
  cfe/trunk/lib/Frontend/FrontendActions.cpp
  cfe/trunk/test/Modules/module_file_info.m


Index: cfe/trunk/test/Modules/module_file_info.m
===================================================================
--- cfe/trunk/test/Modules/module_file_info.m
+++ cfe/trunk/test/Modules/module_file_info.m
@@ -43,6 +43,16 @@
 // CHECK:   Predefined macros:
 // CHECK:     -DBLARG
 // CHECK:     -DWIBBLE=WOBBLE
+// CHECK: Input file: {{.*}}DependsOnModulePrivate.h
+// CHECK-NEXT: Input file: {{.*}}Other.h
+// CHECK-NEXT: Input file: {{.*}}SubFramework.h
+// CHECK-NEXT: Input file: {{.*}}not_coroutines.h
+// CHECK-NEXT: Input file: {{.*}}not_cxx.h
+// CHECK-NEXT: Input file: {{.*}}other.h
+// CHECK-NEXT: Input file: {{.*}}module.map
+// CHECK-NEXT: Input file: {{.*}}DependsOnModule.h
+// CHECK-NEXT: Input file: {{.*}}module_private.map
+// CHECK-NEXT: Input file: {{.*}}module.map
 
 // CHECK: Diagnostic options:
 // CHECK:   IgnoreWarnings: Yes
Index: cfe/trunk/lib/Frontend/FrontendActions.cpp
===================================================================
--- cfe/trunk/lib/Frontend/FrontendActions.cpp
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp
@@ -560,6 +560,45 @@
 
       Out << "\n";
     }
+
+    /// Tells the \c ASTReaderListener that we want to receive the
+    /// input files of the AST file via \c visitInputFile.
+    bool needsInputFileVisitation() override { return true; }
+
+    /// Tells the \c ASTReaderListener that we want to receive the
+    /// input files of the AST file via \c visitInputFile.
+    bool needsSystemInputFileVisitation() override { return true; }
+
+    /// Indicates that the AST file contains particular input file.
+    ///
+    /// \returns true to continue receiving the next input file, false to stop.
+    bool visitInputFile(StringRef Filename, bool isSystem,
+                        bool isOverridden, bool isExplicitModule) override {
+
+      Out.indent(2) << "Input file: " << Filename;
+
+      if (isSystem || isOverridden || isExplicitModule) {
+        Out << " [";
+        if (isSystem) {
+          Out << "System";
+          if (isOverridden || isExplicitModule)
+            Out << ", ";
+        }
+        if (isOverridden) {
+          Out << "Overridden";
+          if (isExplicitModule)
+            Out << ", ";
+        }
+        if (isExplicitModule)
+          Out << "ExplicitModule";
+
+        Out << "]";
+      }
+
+      Out << "\n";
+
+      return true;
+    }
 #undef DUMP_BOOLEAN
   };
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47118.156019.patch
Type: text/x-patch
Size: 2397 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180718/79253cd1/attachment.bin>


More information about the llvm-commits mailing list