]> granicus.if.org Git - clang/commitdiff
If we already have a definition for a top-level module that we deserialized from...
authorDouglas Gregor <dgregor@apple.com>
Thu, 5 Jan 2012 00:12:00 +0000 (00:12 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 5 Jan 2012 00:12:00 +0000 (00:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147574 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/ModuleMap.cpp

index 42257f562439898c947cd03455fa55e4a2380a87..6c13938c2094920d0a570ce662baf1ea601f0767 100644 (file)
@@ -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);