MC: Make setVariableValue check the redefinition condition a bit more strongly.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 5 May 2010 19:00:56 +0000 (19:00 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 5 May 2010 19:00:56 +0000 (19:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103110 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCSymbol.h
lib/MC/MCSymbol.cpp

index 2b254b97efa1c49119c652a6232c06a74719b89f..2ee7dd44cff172ec049286cdcca3f2be4b3848df 100644 (file)
@@ -131,10 +131,7 @@ namespace llvm {
       return Value;
     }
 
-    void setVariableValue(const MCExpr *Value) {
-      assert(Value && "Invalid variable value!");
-      this->Value = Value;
-    }
+    void setVariableValue(const MCExpr *Value);
 
     /// @}
 
index 3fb12336c4fc8f967fc6ef423962d0238ca49882..82d72a3e95b3be2981d00da73cc5716155e0b86e 100644 (file)
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/MC/MCSymbol.h"
+#include "llvm/MC/MCExpr.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
@@ -38,6 +39,13 @@ static bool NameNeedsQuoting(StringRef Str) {
   return false;
 }
 
+void MCSymbol::setVariableValue(const MCExpr *Value) {
+  assert(Value && "Invalid variable value!");
+  assert((isUndefined() || (isAbsolute() && isa<MCConstantExpr>(Value))) &&
+         "Invalid redefinition!");
+  this->Value = Value;
+}
+
 void MCSymbol::print(raw_ostream &OS) const {
   // The name for this MCSymbol is required to be a valid target name.  However,
   // some targets support quoting names with funny characters.  If the name