From 08a408a4b3224627db07eb27e174085d8e1d2426 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 5 May 2010 17:41:00 +0000 Subject: [PATCH] MC: Rename MCSymbol::{g,s}etValue -> MCSymbol::{g,s}etVariableValue. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103095 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCSymbol.h | 11 +++++++---- lib/MC/MCAsmStreamer.cpp | 2 +- lib/MC/MCExpr.cpp | 2 +- lib/MC/MCMachOStreamer.cpp | 2 +- lib/MC/MCParser/AsmParser.cpp | 6 +++--- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h index fb96506e440..2b254b97efa 100644 --- a/include/llvm/MC/MCSymbol.h +++ b/include/llvm/MC/MCSymbol.h @@ -125,11 +125,14 @@ namespace llvm { return Value != 0; } - /// getValue() - Get the value for variable symbols, or null if the symbol - /// is not a variable. - const MCExpr *getValue() const { return Value; } + /// getValue() - Get the value for variable symbols. + const MCExpr *getVariableValue() const { + assert(isVariable() && "Invalid accessor!"); + return Value; + } - void setValue(const MCExpr *Value) { + void setVariableValue(const MCExpr *Value) { + assert(Value && "Invalid variable value!"); this->Value = Value; } diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index 2c7e1c4c90d..dc09f217caf 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -243,7 +243,7 @@ void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { // FIXME: Lift context changes into super class. // FIXME: Set associated section. - Symbol->setValue(Value); + Symbol->setVariableValue(Value); } void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol, diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp index bc670abc1bb..3d4bbbaaf51 100644 --- a/lib/MC/MCExpr.cpp +++ b/lib/MC/MCExpr.cpp @@ -249,7 +249,7 @@ bool MCExpr::EvaluateAsRelocatable(MCValue &Res, // Evaluate recursively if this is a variable. if (Sym.isVariable()) { - if (!Sym.getValue()->EvaluateAsRelocatable(Res, Layout)) + if (!Sym.getVariableValue()->EvaluateAsRelocatable(Res, Layout)) return false; // Absolutize symbol differences between defined symbols when we have a diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp index 120f837b26f..cfb39598f54 100644 --- a/lib/MC/MCMachOStreamer.cpp +++ b/lib/MC/MCMachOStreamer.cpp @@ -196,7 +196,7 @@ void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { // FIXME: Lift context changes into super class. // FIXME: Set associated section. - Symbol->setValue(AddValueSymbols(Value)); + Symbol->setVariableValue(AddValueSymbols(Value)); } void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol, diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index a63d2e43df1..7c553fe7389 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -199,11 +199,11 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) { // If this is an absolute variable reference, substitute it now to preserve // semantics in the face of reassignment. - if (Sym->getValue() && isa(Sym->getValue())) { + if (Sym->isVariable() && isa(Sym->getVariableValue())) { if (Variant) return Error(EndLoc, "unexpected modified on variable reference"); - Res = Sym->getValue(); + Res = Sym->getVariableValue(); return false; } @@ -790,7 +790,7 @@ bool AsmParser::ParseAssignment(const StringRef &Name) { return Error(EqualLoc, "redefinition of '" + Name + "'"); else if (!Sym->isVariable()) return Error(EqualLoc, "invalid assignment to '" + Name + "'"); - else if (!isa(Sym->getValue())) + else if (!isa(Sym->getVariableValue())) return Error(EqualLoc, "invalid reassignment of non-absolute variable '" + Name + "'"); } else