X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FMC%2FMCSymbol.cpp;h=125380a9d14066aea4508f4a35d8f37b9366512e;hb=c51f300513a39ccc3719c795141d376b346cf61e;hp=a5097bc90f62b1194e47a34d38b91f20a25eea85;hpb=5c8a22f11bd4784cd6b9c375289dadcdc521d49e;p=oota-llvm.git diff --git a/lib/MC/MCSymbol.cpp b/lib/MC/MCSymbol.cpp index a5097bc90f6..125380a9d14 100644 --- a/lib/MC/MCSymbol.cpp +++ b/lib/MC/MCSymbol.cpp @@ -28,8 +28,9 @@ void *MCSymbol::operator new(size_t s, const StringMapEntry *Name, // For safety, ensure that the alignment of a pointer is enough for an // MCSymbol. This also ensures we don't need padding between the name and // symbol. - assert(alignOf() <= alignOf() && - "Bad alignment of MCSymbol"); + static_assert((unsigned)AlignOf::Alignment <= + AlignOf::Alignment, + "Bad alignment of MCSymbol"); void *Storage = Ctx.allocate(Size, alignOf()); NameEntryStorageTy *Start = static_cast(Storage); NameEntryStorageTy *End = Start + (Name ? 1 : 0); @@ -39,8 +40,12 @@ void *MCSymbol::operator new(size_t s, const StringMapEntry *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; - SectionOrFragment = nullptr; + SymbolContents = SymContentsVariable; + setUndefined(); } void MCSymbol::print(raw_ostream &OS, const MCAsmInfo *MAI) const {