From d34cf143391c33d799ccd4735d3fe7630cdaa44b Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Wed, 16 Oct 2013 01:20:40 +0000 Subject: MC: Better handling of tricky symbol and section names Because of win32 mangling, we produce symbol and section names with funny characters in them, most notably @ characters. MC would choke on trying to parse its own assembly output. This patch addresses that by: - Making @ trigger quoting of symbol names - Also quote section names in the same way - Just parse section names like other identifiers (to allow for quotes) - Don't assume @ signifies a symbol variant if it is in a string. Differential Revision: http://llvm-reviews.chandlerc.com/D1945 llvm-svn: 192758 --- llvm/lib/MC/MCSymbol.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'llvm/lib/MC/MCSymbol.cpp') diff --git a/llvm/lib/MC/MCSymbol.cpp b/llvm/lib/MC/MCSymbol.cpp index b973c57..f386c3b 100644 --- a/llvm/lib/MC/MCSymbol.cpp +++ b/llvm/lib/MC/MCSymbol.cpp @@ -18,12 +18,10 @@ const MCSection *MCSymbol::AbsolutePseudoSection = reinterpret_cast(1); static bool isAcceptableChar(char C) { - if ((C < 'a' || C > 'z') && - (C < 'A' || C > 'Z') && - (C < '0' || C > '9') && - C != '_' && C != '$' && C != '.' && C != '@') - return false; - return true; + return (C >= 'a' && C <= 'z') || + (C >= 'A' && C <= 'Z') || + (C >= '0' && C <= '9') || + C == '_' || C == '$' || C == '.'; } /// NameNeedsQuoting - Return true if the identifier \p Str needs quotes to be -- cgit v1.1