diff options
-rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 39 | ||||
-rw-r--r-- | clang/test/Modules/module_file_info.m | 10 |
2 files changed, 49 insertions, 0 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index 06db814f4b5..9344e673c7a 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -560,6 +560,45 @@ namespace { 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 }; } diff --git a/clang/test/Modules/module_file_info.m b/clang/test/Modules/module_file_info.m index f2967be6f8c..05d401b9450 100644 --- a/clang/test/Modules/module_file_info.m +++ b/clang/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 |