aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-03 19:35:57 +0000
committerChris Lattner <sabre@nondot.org>2001-10-03 19:35:57 +0000
commit43efcbf561cf6b7032dd343ac83e1ff3eafde011 (patch)
treebed7b8b7242eaf515b9c035c078a1c43c166490e
parent8921983734eeb69ffb936d08def7395ac982387b (diff)
Add comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@712 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AsmParser/llvmAsmParser.y6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 6edd2797c2..1ee6d50b56 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -456,6 +456,12 @@ static bool setValueName(Value *V, char *NameStr) {
// cerr << "Type: " << Ty->getDescription() << " != "
// << cast<const Type>(V)->getDescription() << "!\n";
} else if (GlobalVariable *EGV = dyn_cast<GlobalVariable>(Existing)) {
+ // We are allowed to redefine a global variable in two circumstances:
+ // 1. If at least one of the globals is uninitialized or
+ // 2. If both initializers have the same value.
+ //
+ // This can only be done if the const'ness of the vars is the same.
+ //
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
if (EGV->isConstant() == GV->isConstant() &&
(!EGV->hasInitializer() || !GV->hasInitializer() ||