From: Douglas Gregor Date: Thu, 5 Jan 2012 00:12:00 +0000 (+0000) Subject: If we already have a definition for a top-level module that we deserialized from... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c634f50c5cc892b899659c1743d696766c82afcd;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147574 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 42257f5624..6c13938c20 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -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);