From ea163e16a88402c26ba29bb7573fed549f31baac Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Tue, 1 Apr 2014 00:05:57 +0000 Subject: [PATCH] MS ABI: Simplify MangleByte further It turns out that the ranges where the '?' 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 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index 4f6ee315a7..804b8a9408 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -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('A' + (Byte - '\xc1')); + } else if (isLetter(Byte & 0x7f)) { + Mangler.getStream() << '?' << static_cast(Byte & 0x7f); } else { switch (Byte) { case ',': -- 2.40.0