summaryrefslogtreecommitdiff
path: root/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2011-09-15 17:56:49 +0000
committerJim Grosbach <grosbach@apple.com>2011-09-15 17:56:49 +0000
commit10ec65004d8da411ab59a1fee85c0ff54539776a (patch)
tree97de8405768b9e2278d97d8561e1c94dae480efd /lib/MC/MCParser/AsmParser.cpp
parent79c40a011b15f59e5b128c870c04893c3f1eddf9 (diff)
downloadllvm-10ec65004d8da411ab59a1fee85c0ff54539776a.tar.gz
llvm-10ec65004d8da411ab59a1fee85c0ff54539776a.tar.bz2
llvm-10ec65004d8da411ab59a1fee85c0ff54539776a.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139807 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--lib/MC/MCParser/AsmParser.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 5ab7ca6e83..9113dd7c31 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/lib/MC/MCParser/AsmParser.cpp
@@ -1960,12 +1960,17 @@ bool AsmParser::ParseDirectiveSymbolAttribute(MCSymbolAttr Attr) {
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))