[llvm-commits] [llvm] r139807 - /llvm/trunk/lib/MC/MCParser/AsmParser.cpp

Jim Grosbach grosbach at apple.com
Thu Sep 15 10:56:49 PDT 2011


Author: grosbach
Date: Thu Sep 15 12:56:49 2011
New Revision: 139807

URL: http://llvm.org/viewvc/llvm-project?rev=139807&view=rev
Log:
Assmebler symbol attribute directives don't work on temporary symbols.

Assembler private local symbols aren't legal targets of symbol attributes,
so issue a diagnostic for them.

Based on patch by Stepan Dyatkovskiy.

Modified:
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=139807&r1=139806&r2=139807&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Thu Sep 15 12:56:49 2011
@@ -1960,12 +1960,17 @@
   if (getLexer().isNot(AsmToken::EndOfStatement)) {
     for (;;) {
       StringRef Name;
+      SMLoc Loc = getTok().getLoc();
 
       if (ParseIdentifier(Name))
-        return TokError("expected identifier in directive");
+        return Error(Loc, "expected identifier in directive");
 
       MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
 
+      // Assembler local symbols don't make any sense here. Complain loudly.
+      if (Sym->isTemporary())
+        return Error(Loc, "non-local symbol required in directive");
+
       getStreamer().EmitSymbolAttribute(Sym, Attr);
 
       if (getLexer().is(AsmToken::EndOfStatement))





More information about the llvm-commits mailing list