Author: vvassilev Date: Tue Jul 17 23:49:33 2018 New Revision: 337353 URL: http://llvm.org/viewvc/llvm-project?rev=337353&view=rev Log: [modules] Print input files when -module-file-info file switch is passed.
This patch improves traceability of duplicated header files which end up in multiple pcms. Differential Revision: https://reviews.llvm.org/D47118 Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp cfe/trunk/test/Modules/module_file_info.m Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=337353&r1=337352&r2=337353&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/FrontendActions.cpp (original) +++ cfe/trunk/lib/Frontend/FrontendActions.cpp Tue Jul 17 23:49:33 2018 @@ -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 }; } Modified: cfe/trunk/test/Modules/module_file_info.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/module_file_info.m?rev=337353&r1=337352&r2=337353&view=diff ============================================================================== --- cfe/trunk/test/Modules/module_file_info.m (original) +++ cfe/trunk/test/Modules/module_file_info.m Tue Jul 17 23:49:33 2018 @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits