[llvm-commits] [llvm] r153137 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp lib/MC/MCSymbol.cpp test/MC/AsmParser/variables-invalid.s
Jim Grosbach
grosbach at apple.com
Tue Mar 20 14:33:22 PDT 2012
Author: grosbach
Date: Tue Mar 20 16:33:21 2012
New Revision: 153137
URL: http://llvm.org/viewvc/llvm-project?rev=153137&view=rev
Log:
Assembler should accept redefinitions of unused variable symbols.
rdar://11027851
Modified:
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
llvm/trunk/lib/MC/MCSymbol.cpp
llvm/trunk/test/MC/AsmParser/variables-invalid.s
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=153137&r1=153136&r2=153137&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Tue Mar 20 16:33:21 2012
@@ -1629,6 +1629,8 @@
return Error(EqualLoc, "Recursive use of '" + Name + "'");
else if (Sym->isUndefined() && !Sym->isUsed() && !Sym->isVariable())
; // Allow redefinitions of undefined symbols only used in directives.
+ else if (Sym->isVariable() && !Sym->isUsed() && allow_redef)
+ ; // Allow redefinitions of variables that haven't yet been used.
else if (!Sym->isUndefined() && (!Sym->isVariable() || !allow_redef))
return Error(EqualLoc, "redefinition of '" + Name + "'");
else if (!Sym->isVariable())
Modified: llvm/trunk/lib/MC/MCSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSymbol.cpp?rev=153137&r1=153136&r2=153137&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSymbol.cpp (original)
+++ llvm/trunk/lib/MC/MCSymbol.cpp Tue Mar 20 16:33:21 2012
@@ -54,8 +54,6 @@
void MCSymbol::setVariableValue(const MCExpr *Value) {
assert(!IsUsed && "Cannot set a variable that has already been used.");
assert(Value && "Invalid variable value!");
- assert((isUndefined() || (isAbsolute() && isa<MCConstantExpr>(Value))) &&
- "Invalid redefinition!");
this->Value = Value;
// Variables should always be marked as in the same "section" as the value.
Modified: llvm/trunk/test/MC/AsmParser/variables-invalid.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/variables-invalid.s?rev=153137&r1=153136&r2=153137&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/variables-invalid.s (original)
+++ llvm/trunk/test/MC/AsmParser/variables-invalid.s Tue Mar 20 16:33:21 2012
@@ -13,6 +13,7 @@
t2_s0 = 2
t3_s0 = t2_s0 + 1
+ .long t3_s0
// CHECK: invalid reassignment of non-absolute variable 't3_s0'
t3_s0 = 1
More information about the llvm-commits
mailing list