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;
}
// FIXME: Lift context changes into super class.
// FIXME: Set associated section.
- Symbol->setValue(Value);
+ Symbol->setVariableValue(Value);
}
void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
// 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
// FIXME: Lift context changes into super class.
// FIXME: Set associated section.
- Symbol->setValue(AddValueSymbols(Value));
+ Symbol->setVariableValue(AddValueSymbols(Value));
}
void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
// If this is an absolute variable reference, substitute it now to preserve
// semantics in the face of reassignment.
- if (Sym->getValue() && isa<MCConstantExpr>(Sym->getValue())) {
+ if (Sym->isVariable() && isa<MCConstantExpr>(Sym->getVariableValue())) {
if (Variant)
return Error(EndLoc, "unexpected modified on variable reference");
- Res = Sym->getValue();
+ Res = Sym->getVariableValue();
return false;
}
return Error(EqualLoc, "redefinition of '" + Name + "'");
else if (!Sym->isVariable())
return Error(EqualLoc, "invalid assignment to '" + Name + "'");
- else if (!isa<MCConstantExpr>(Sym->getValue()))
+ else if (!isa<MCConstantExpr>(Sym->getVariableValue()))
return Error(EqualLoc, "invalid reassignment of non-absolute variable '" +
Name + "'");
} else