summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commit78326d20c5fea2f45dca4dbc12ee822de74ca624 (patch)
tree9baa70f8a56c8529519ea6ea476c43f8ff5b0870 /llvm/lib
parente504b4395bc3b0d9dc77aa5986fa323bc3769adf (diff)
downloadbcm5719-llvm-78326d20c5fea2f45dca4dbc12ee822de74ca624.tar.gz
bcm5719-llvm-78326d20c5fea2f45dca4dbc12ee822de74ca624.zip
Add comment
llvm-svn: 712
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/AsmParser/llvmAsmParser.y6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y
index 6edd2797c2a..1ee6d50b567 100644
--- a/llvm/lib/AsmParser/llvmAsmParser.y
+++ b/llvm/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() ||
OpenPOWER on IntegriCloud