From d3220dbeeadc4ac54ceecea8cf63f8d8be291d2a Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 8 May 2013 23:46:46 +0000 Subject: [modules] When building a module, make sure we don't serialize out HeaderFileInfo for headers not belonging to the module. After r180934 we may initiate module map parsing for modules not related to the module what we are building, make sure we ignore the header file info of headers from such modules. First part of rdar://13840148 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181489 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/ModuleMap.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/Lex/ModuleMap.cpp') diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 3e7a44c0e3..de234853fb 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -87,7 +87,7 @@ ModuleMap::ModuleMap(FileManager &FileMgr, DiagnosticConsumer &DC, const LangOptions &LangOpts, const TargetInfo *Target, HeaderSearch &HeaderInfo) : LangOpts(LangOpts), Target(Target), HeaderInfo(HeaderInfo), - BuiltinIncludeDir(0) + BuiltinIncludeDir(0), CompilingModule(0) { IntrusiveRefCntPtr DiagIDs(new DiagnosticIDs); Diags = IntrusiveRefCntPtr( @@ -388,8 +388,13 @@ ModuleMap::findOrCreateModule(StringRef Name, Module *Parent, bool IsFramework, // Create a new module with this name. Module *Result = new Module(Name, SourceLocation(), Parent, IsFramework, IsExplicit); - if (!Parent) + if (!Parent) { Modules[Name] = Result; + if (!LangOpts.CurrentModule.empty() && !CompilingModule && + Name == LangOpts.CurrentModule) { + CompilingModule = Result; + } + } return std::make_pair(Result, true); } @@ -605,7 +610,8 @@ void ModuleMap::addHeader(Module *Mod, const FileEntry *Header, Mod->ExcludedHeaders.push_back(Header); } else { Mod->Headers.push_back(Header); - HeaderInfo.MarkFileModuleHeader(Header); + bool isCompilingModuleHeader = Mod->getTopLevelModule() == CompilingModule; + HeaderInfo.MarkFileModuleHeader(Header, isCompilingModuleHeader); } Headers[Header] = KnownHeader(Mod, Excluded); } -- cgit v1.2.3