aboutsummaryrefslogtreecommitdiff
path: root/lib/MC
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
commit184640e96e391ecfc4621156907b29f132c14959 (patch)
treea1e54d4e4f529ad5292c2224e7285698e8b42c34 /lib/MC
parenta3bbf2411fa1e085fc371e2c9ef27970e2c89d3c (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCParser/ELFAsmParser.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/MC/MCParser/ELFAsmParser.cpp b/lib/MC/MCParser/ELFAsmParser.cpp
index 39ff906ea7..7b88ea2d1d 100644
--- a/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/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);