]> granicus.if.org Git - clang/commitdiff
MS ABI: Simplify MangleByte further
authorDavid Majnemer <david.majnemer@gmail.com>
Tue, 1 Apr 2014 00:05:57 +0000 (00:05 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Tue, 1 Apr 2014 00:05:57 +0000 (00:05 +0000)
It turns out that the ranges where the '?' <letter> manglings occur are
identical to the ranges of ASCII characters OR'd with 0x80.

Thanks to Richard Smith for the insight!

No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205270 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/MicrosoftMangle.cpp

index 4f6ee315a7c8631761169d1e34aac398383fd409..804b8a9408d8d044bdee7906b1a90a369a16cb0d 100644 (file)
@@ -2428,13 +2428,10 @@ void MicrosoftMangleContextImpl::mangleStringLiteral(const StringLiteral *SL,
     // - ?[A-Z]: The range from \xc1 to \xda.
     // - ?[0-9]: The set of [,/\:. \n\t'-].
     // - ?$XX: A fallback which maps nibbles.
-    if ((Byte >= 'a' && Byte <= 'z') || (Byte >= 'A' && Byte <= 'Z') ||
-        (Byte >= '0' && Byte <= '9') || Byte == '_' || Byte == '$') {
+    if (isIdentifierBody(Byte, /*AllowDollar=*/true)) {
       Mangler.getStream() << Byte;
-    } else if ((Byte >= '\xe1' && Byte <= '\xfa') ||
-               (Byte >= '\xc1' && Byte <= '\xda')) {
-      // The delta between '\xe1' and '\xc1' is the same as 'a' to 'A'.
-      Mangler.getStream() << '?' << static_cast<char>('A' + (Byte - '\xc1'));
+    } else if (isLetter(Byte & 0x7f)) {
+      Mangler.getStream() << '?' << static_cast<char>(Byte & 0x7f);
     } else {
       switch (Byte) {
         case ',':