[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Dec 15 12:24:04 PST 2004
Changes in directory llvm/lib/VMCore:
Verifier.cpp updated: 1.123 -> 1.124
---
Log message:
Add a verifier assertion
---
Diffs of the changes: (+12 -1)
Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.123 llvm/lib/VMCore/Verifier.cpp:1.124
--- llvm/lib/VMCore/Verifier.cpp:1.123 Fri Dec 3 20:30:42 2004
+++ llvm/lib/VMCore/Verifier.cpp Wed Dec 15 14:23:49 2004
@@ -128,7 +128,7 @@
}
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 @@
// 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::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) {
More information about the llvm-commits
mailing list