summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-12-15 20:23:49 +0000
committerChris Lattner <sabre@nondot.org>2004-12-15 20:23:49 +0000
commite340065558d042356fc0da45f11a895492653fcc (patch)
tree2de0a2135266ae4062af1f7253fa0b7d9b7018ea
parentaefd5fa18a3e0340b818ae83605cbf1d0af025ce (diff)
downloadbcm5719-llvm-e340065558d042356fc0da45f11a895492653fcc.tar.gz
bcm5719-llvm-e340065558d042356fc0da45f11a895492653fcc.zip
Add a verifier assertion
llvm-svn: 18965
-rw-r--r--llvm/lib/VMCore/Verifier.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index 4653ef89551..0998720a4a7 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/lib/VMCore/Verifier.cpp
@@ -128,7 +128,7 @@ namespace { // Anonymous namespace for class
}
for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
- visitGlobalValue(*I);
+ visitGlobalVariable(*I);
// If the module is broken, abort at this time.
abortIfBroken();
@@ -171,6 +171,7 @@ namespace { // Anonymous namespace for class
// Verification methods...
void verifySymbolTable(SymbolTable &ST);
void visitGlobalValue(GlobalValue &GV);
+ void visitGlobalVariable(GlobalVariable &GV);
void visitFunction(Function &F);
void visitBasicBlock(BasicBlock &BB);
void visitPHINode(PHINode &PN);
@@ -262,6 +263,16 @@ void Verifier::visitGlobalValue(GlobalValue &GV) {
}
}
+void Verifier::visitGlobalVariable(GlobalVariable &GV) {
+ if (GV.hasInitializer())
+ Assert1(GV.getInitializer()->getType() == GV.getType()->getElementType(),
+ "Global variable initializer type does not match global "
+ "variable type!", &GV);
+
+ visitGlobalValue(GV);
+}
+
+
// verifySymbolTable - Verify that a function or module symbol table is ok
//
void Verifier::verifySymbolTable(SymbolTable &ST) {
OpenPOWER on IntegriCloud