aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCParser/ELFAsmParser.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-01-24 18:02:54 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-01-24 18:02:54 +0000
commit689939e648156deaf569d30d339e0fada15fedde (patch)
treedd1a42738d9ef52cbe8b6bb923a368f815a0d435 /llvm/lib/MC/MCParser/ELFAsmParser.cpp
parent3ac8cd614f5c5accb346d584e167c1ea99c069ae (diff)
downloadllvm-689939e648156deaf569d30d339e0fada15fedde.zip
llvm-689939e648156deaf569d30d339e0fada15fedde.tar.gz
llvm-689939e648156deaf569d30d339e0fada15fedde.tar.bz2
Handle strings in section names the same way as gas:
* If the name is a single string, we remove the quotes * If the name starts without a quote, we include any quotes in the name llvm-svn: 124127
Diffstat (limited to 'llvm/lib/MC/MCParser/ELFAsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/ELFAsmParser.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index 39ff906..7b88ea2 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -168,6 +168,12 @@ bool ELFAsmParser::ParseSectionName(StringRef &SectionName) {
SMLoc FirstLoc = getLexer().getLoc();
unsigned Size = 0;
+ if (getLexer().is(AsmToken::String)) {
+ SectionName = getTok().getIdentifier();
+ Lex();
+ return false;
+ }
+
for (;;) {
StringRef Tmp;
unsigned CurSize;
@@ -176,10 +182,15 @@ bool ELFAsmParser::ParseSectionName(StringRef &SectionName) {
if (getLexer().is(AsmToken::Minus)) {
CurSize = 1;
Lex(); // Consume the "-".
- } else if (!getParser().ParseIdentifier(Tmp))
- CurSize = Tmp.size();
- else
+ } else if (getLexer().is(AsmToken::String)) {
+ CurSize = getTok().getIdentifier().size() + 2;
+ Lex();
+ } else if (getLexer().is(AsmToken::Identifier)) {
+ CurSize = getTok().getIdentifier().size();
+ Lex();
+ } else {
break;
+ }
Size += CurSize;
SectionName = StringRef(FirstLoc.getPointer(), Size);