From: Ben Langmuir Date: Mon, 14 Apr 2014 22:12:44 +0000 (+0000) Subject: Add module name and module map file to -module-file-info X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=274e4bd00ae4a1ae2f8206a4d3f9802d414e9bf0;p=clang Add module name and module map file to -module-file-info git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206217 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 1f27e384ae..ffd7275255 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -109,6 +109,9 @@ public: return FullVersion != getClangFullRepositoryVersion(); } + virtual void ReadModuleName(StringRef ModuleName) {} + virtual void ReadModuleMapFile(StringRef ModuleMapPath) {} + /// \brief Receives the language options. /// /// \returns true to indicate the options are invalid or false otherwise. @@ -203,6 +206,8 @@ public: : First(First), Second(Second) { } bool ReadFullVersionInformation(StringRef FullVersion) override; + void ReadModuleName(StringRef ModuleName) override; + void ReadModuleMapFile(StringRef ModuleMapPath) override; bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain) override; bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain) override; diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp index bbd2dff46c..1092c56ed5 100644 --- a/lib/Frontend/FrontendActions.cpp +++ b/lib/Frontend/FrontendActions.cpp @@ -416,6 +416,13 @@ namespace { return ASTReaderListener::ReadFullVersionInformation(FullVersion); } + void ReadModuleName(StringRef ModuleName) override { + Out.indent(2) << "Module name: " << ModuleName << "\n"; + } + void ReadModuleMapFile(StringRef ModuleMapPath) override { + Out.indent(2) << "Module map file: " << ModuleMapPath << "\n"; + } + bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain) override { Out.indent(2) << "Language options:\n"; diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index ea3b8b6cd1..78bf151c63 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -70,6 +70,14 @@ ChainedASTReaderListener::ReadFullVersionInformation(StringRef FullVersion) { return First->ReadFullVersionInformation(FullVersion) || Second->ReadFullVersionInformation(FullVersion); } +void ChainedASTReaderListener::ReadModuleName(StringRef ModuleName) { + First->ReadModuleName(ModuleName); + Second->ReadModuleName(ModuleName); +} +void ChainedASTReaderListener::ReadModuleMapFile(StringRef ModuleMapPath) { + First->ReadModuleMapFile(ModuleMapPath); + Second->ReadModuleMapFile(ModuleMapPath); +} bool ChainedASTReaderListener::ReadLanguageOptions(const LangOptions &LangOpts, bool Complain) { return First->ReadLanguageOptions(LangOpts, Complain) || @@ -2313,6 +2321,8 @@ ASTReader::ReadControlBlock(ModuleFile &F, case MODULE_NAME: F.ModuleName = Blob; + if (Listener) + Listener->ReadModuleName(F.ModuleName); break; case MODULE_MAP_FILE: @@ -2347,6 +2357,9 @@ ASTReader::ReadControlBlock(ModuleFile &F, return OutOfDate; } } + + if (Listener) + Listener->ReadModuleMapFile(F.ModuleMapPath); break; case INPUT_FILE_OFFSETS: @@ -3952,6 +3965,12 @@ bool ASTReader::readASTFileControlBlock(StringRef Filename, break; } + case MODULE_NAME: + Listener.ReadModuleName(Blob); + break; + case MODULE_MAP_FILE: + Listener.ReadModuleMapFile(Blob); + break; case LANGUAGE_OPTIONS: if (ParseLanguageOptions(Record, false, Listener)) return true; diff --git a/test/Modules/module_file_info.m b/test/Modules/module_file_info.m index f9a35babd0..9f1ff2221b 100644 --- a/test/Modules/module_file_info.m +++ b/test/Modules/module_file_info.m @@ -7,6 +7,9 @@ // CHECK: Generated by this Clang: +// CHECK: Module name: DependsOnModule +// CHECK: Module map file: {{.*}}DependsOnModule.framework{{[/\\]}}module.map + // CHECK: Language options: // CHECK: C99: Yes // CHECK: Objective-C 1: Yes