mirror of
https://github.com/intel/llvm.git
synced 2026-02-03 02:26:27 +08:00
[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 llvm-svn: 181489
This commit is contained in:
@@ -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<DiagnosticIDs> DiagIDs(new DiagnosticIDs);
|
||||
Diags = IntrusiveRefCntPtr<DiagnosticsEngine>(
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user