diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCAsmStreamer.cpp | 4 | ||||
-rw-r--r-- | lib/MC/MCContext.cpp | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index 1956c2e77b..d268fb75e8 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -84,8 +84,8 @@ void MCAsmStreamer::SwitchSection(MCSection *Section) { void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) { // FIXME: We need to enforce that we aren't printing atoms which are more // complicated than the assembler understands. - assert(Symbol->getAtom()->getSection() == CurSection && - "The label for a symbol must match its section!"); + //assert(Symbol->getAtom()->getSection() == CurSection && + // "The label for a symbol must match its section!"); OS << Symbol->getName() << ":\n"; } diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index cad0d56990..f7793b918c 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -44,6 +44,20 @@ MCSymbol *MCContext::CreateSymbol(MCAtom *Atom, const char *Name) { return Entry = new (*this) MCSymbol(Atom, Name, false); } +/// GetOrCreateSymbol - Lookup the symbol inside with the specified +/// @param Name. If it exists, return it. If not, create a forward +/// reference and return it. +/// +/// @param Name - The symbol name, which must be unique across all symbols. +MCSymbol *MCContext::GetOrCreateSymbol(const char *Name) { + MCSymbol *&Entry = Symbols[Name]; + if (Entry) return Entry; + + // FIXME: is a null atom the right way to make a forward ref? + return Entry = new (*this) MCSymbol(0, Name, false); +} + + MCSymbol *MCContext::CreateTemporarySymbol(MCAtom *Atom, const char *Name) { // If unnamed, just create a symbol. if (Name[0] == '\0') |