summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCSymbol.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-04-02 07:02:51 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-04-02 07:02:51 +0000
commit949eb3f6a7deda71c7280ff6e689ddf79cf737ce (patch)
tree3765c8a377a7d292e7a9d7d6c826e5acc6c59216 /llvm/lib/MC/MCSymbol.cpp
parent0ee57cede02033cbc28a9b566e8c0ab2aa18dedf (diff)
downloadbcm5719-llvm-949eb3f6a7deda71c7280ff6e689ddf79cf737ce.tar.gz
bcm5719-llvm-949eb3f6a7deda71c7280ff6e689ddf79cf737ce.zip
Revert r233595, "MC: For variable symbols, maintain MCSymbol::Section as a cache."
llvm-svn: 233898
Diffstat (limited to 'llvm/lib/MC/MCSymbol.cpp')
-rw-r--r--llvm/lib/MC/MCSymbol.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCSymbol.cpp b/llvm/lib/MC/MCSymbol.cpp
index 6582574ae94..24165254e56 100644
--- a/llvm/lib/MC/MCSymbol.cpp
+++ b/llvm/lib/MC/MCSymbol.cpp
@@ -55,7 +55,13 @@ void MCSymbol::setVariableValue(const MCExpr *Value) {
assert(!IsUsed && "Cannot set a variable that has already been used.");
assert(Value && "Invalid variable value!");
this->Value = Value;
- this->Section = nullptr;
+
+ // Variables should always be marked as in the same "section" as the value.
+ const MCSection *Section = Value->FindAssociatedSection();
+ if (Section)
+ setSection(*Section);
+ else
+ setUndefined();
}
void MCSymbol::print(raw_ostream &OS) const {
OpenPOWER on IntegriCloud