[cfe-commits] r147574 - /cfe/trunk/lib/Lex/ModuleMap.cpp
Douglas Gregor
dgregor at apple.com
Wed Jan 4 16:12:00 PST 2012
Author: dgregor
Date: Wed Jan 4 18:12:00 2012
New Revision: 147574
URL: http://llvm.org/viewvc/llvm-project?rev=147574&view=rev
Log:
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
Modified:
cfe/trunk/lib/Lex/ModuleMap.cpp
Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=147574&r1=147573&r2=147574&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Wed Jan 4 18:12:00 2012
@@ -790,6 +790,19 @@
// 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);
More information about the cfe-commits
mailing list