summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commitebdf32f9076074fe373a4bf47c332b9bf08f6405 (patch)
tree2ef9bb60270377df8479a7f2809d3cc724368262 /llvm/lib
parent37eb6962c6ec436dd11975b6054431fba28c0d79 (diff)
downloadbcm5719-llvm-ebdf32f9076074fe373a4bf47c332b9bf08f6405.tar.gz
bcm5719-llvm-ebdf32f9076074fe373a4bf47c332b9bf08f6405.zip
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. llvm-svn: 139807
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 5ab7ca6e830..9113dd7c310 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/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))
OpenPOWER on IntegriCloud