aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCSymbol.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-06-09 22:21:37 +0000
committerPete Cooper <peter_cooper@apple.com>2015-06-09 22:21:37 +0000
commit6109b51ef1ef92ff9f11b07f954943c2262c7a11 (patch)
tree921b51cedd5b712586fd07bd87f8362fd3fcf068 /llvm/lib/MC/MCSymbol.cpp
parentd5289d9724ec8d1a0bd650feaa22276b7d74ec5b (diff)
downloadllvm-6109b51ef1ef92ff9f11b07f954943c2262c7a11.zip
llvm-6109b51ef1ef92ff9f11b07f954943c2262c7a11.tar.gz
llvm-6109b51ef1ef92ff9f11b07f954943c2262c7a11.tar.bz2
Move MCSymbol Value in to the union of Offset and CommonSize.
It wasn't possible to have a variable Symbol with offset or 'isCommon' so this just enables better packing of the MCSymbol class. Reviewed by Rafael Espindola. llvm-svn: 239440
Diffstat (limited to 'llvm/lib/MC/MCSymbol.cpp')
-rw-r--r--llvm/lib/MC/MCSymbol.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCSymbol.cpp b/llvm/lib/MC/MCSymbol.cpp
index 836d282..9ca85b0 100644
--- a/llvm/lib/MC/MCSymbol.cpp
+++ b/llvm/lib/MC/MCSymbol.cpp
@@ -40,7 +40,11 @@ void *MCSymbol::operator new(size_t s, const StringMapEntry<bool> *Name,
void MCSymbol::setVariableValue(const MCExpr *Value) {
assert(!IsUsed && "Cannot set a variable that has already been used.");
assert(Value && "Invalid variable value!");
+ assert((SymbolContents == SymContentsUnset ||
+ SymbolContents == SymContentsVariable) &&
+ "Cannot give common/offset symbol a variable value");
this->Value = Value;
+ SymbolContents = SymContentsVariable;
SectionOrFragment = nullptr;
}