Index: src/PNaClTranslator.cpp |
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp |
index d8d1860f1ef760bf1ac5bda1b21f5cb964562d9e..f9aa2aa3d667f197292498e8cee6c71c5ec8d913 100644 |
--- a/src/PNaClTranslator.cpp |
+++ b/src/PNaClTranslator.cpp |
@@ -2950,6 +2950,8 @@ private: |
// True if we have already installed names for unnamed global declarations, |
// and have generated global constant initializers. |
bool GlobalDeclarationNamesAndInitializersInstalled = false; |
+ // True if we have already processed the symbol table for the module. |
+ bool FoundValuesymtab = false; |
// Generates names for unnamed global addresses (i.e. functions and global |
// variables). Then lowers global variable declaration initializers to the |
@@ -2959,7 +2961,10 @@ private: |
if (!GlobalDeclarationNamesAndInitializersInstalled) { |
Context->installGlobalNames(); |
Context->createValueIDs(); |
- getTranslator().lowerGlobals(Context->getGlobalVariables()); |
+ std::unique_ptr<Ice::VariableDeclarationList> Globals = |
+ Context->getGlobalVariables(); |
+ if (Globals) |
+ getTranslator().lowerGlobals(std::move(Globals)); |
GlobalDeclarationNamesAndInitializersInstalled = true; |
} |
} |
@@ -3017,6 +3022,10 @@ bool ModuleParser::ParseBlock(unsigned BlockID) { |
return Parser.ParseThisBlock(); |
} |
case naclbitc::VALUE_SYMTAB_BLOCK_ID: { |
+ if (FoundValuesymtab) |
+ Fatal("Duplicate valuesymtab in module"); |
+ |
+ FoundValuesymtab = true; |
ModuleValuesymtabParser Parser(BlockID, this); |
return Parser.ParseThisBlock(); |
} |