[PATCH] D82240: [MCParser] Support quoted section name for COFF

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 19 14:42:05 PDT 2020


MaskRay created this revision.
MaskRay added reviewers: hans, jhenderson, thakis, zequanwu.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
MaskRay edited the summary of this revision.

This features matches ELFAsmParser and makes it possible to use `.section ".llvm.call-graph-profile","n"`


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82240

Files:
  llvm/lib/MC/MCParser/COFFAsmParser.cpp
  llvm/test/MC/COFF/section.s


Index: llvm/test/MC/COFF/section.s
===================================================================
--- llvm/test/MC/COFF/section.s
+++ llvm/test/MC/COFF/section.s
@@ -190,5 +190,11 @@
 // CHECK-NEXT:     ]
 // CHECK:        }
 
+/// The section name can be quoted.
+.section ".llvm.call-graph-profile","n"
+// CHECK:        Section {
+// CHECK-NEXT:     Number:
+// CHECK-NEXT:     Name: .llvm.call-graph-profile
 
+// CHECK-NOT:    Section {
 // CHECK:      ]
Index: llvm/lib/MC/MCParser/COFFAsmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/COFFAsmParser.cpp
+++ llvm/lib/MC/MCParser/COFFAsmParser.cpp
@@ -321,7 +321,7 @@
 }
 
 bool COFFAsmParser::ParseSectionName(StringRef &SectionName) {
-  if (!getLexer().is(AsmToken::Identifier))
+  if (!getLexer().is(AsmToken::Identifier) && !getLexer().is(AsmToken::String))
     return true;
 
   SectionName = getTok().getIdentifier();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82240.272183.patch
Type: text/x-patch
Size: 943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200619/0379fc46/attachment.bin>


More information about the llvm-commits mailing list