forked from OSchip/llvm-project
If we already have a definition for a top-level module that we deserialized from a module file, don't bother parsing a new definition
llvm-svn: 147574
This commit is contained in:
parent
088f1bc295
commit
fcc54a3b91
|
@ -790,6 +790,19 @@ void ModuleMapParser::parseModuleDecl() {
|
|||
|
||||
// Determine whether this (sub)module has already been defined.
|
||||
if (Module *Existing = Map.lookupModuleQualified(ModuleName, ActiveModule)) {
|
||||
if (Existing->DefinitionLoc.isInvalid() && !ActiveModule) {
|
||||
// Skip the module definition.
|
||||
skipUntil(MMToken::RBrace);
|
||||
if (Tok.is(MMToken::RBrace))
|
||||
consumeToken();
|
||||
else {
|
||||
Diags.Report(Tok.getLocation(), diag::err_mmap_expected_rbrace);
|
||||
Diags.Report(LBraceLoc, diag::note_mmap_lbrace_match);
|
||||
HadError = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Diags.Report(ModuleNameLoc, diag::err_mmap_module_redefinition)
|
||||
<< ModuleName;
|
||||
Diags.Report(Existing->DefinitionLoc, diag::note_mmap_prev_definition);
|
||||
|
|
Loading…
Reference in New Issue