diff options
author | Nico Weber <nicolasweber@gmx.de> | 2012-11-09 00:05:56 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2012-11-09 00:05:56 +0000 |
commit | 5ed8a8a06af21d443e3c10b0956f79ee069341c3 (patch) | |
tree | 80282852de865c92081205dc214a53c0a56d7c54 /clang/lib/AST/MicrosoftMangle.cpp | |
parent | 44de0c3ac943be49e660494e3b740a657b4b55ff (diff) | |
download | bcm5719-llvm-5ed8a8a06af21d443e3c10b0956f79ee069341c3.tar.gz bcm5719-llvm-5ed8a8a06af21d443e3c10b0956f79ee069341c3.zip |
[ms] Implement int64_t version of mangleNumber() in terms of the APSInt version.
No intended functionality change.
llvm-svn: 167602
Diffstat (limited to 'clang/lib/AST/MicrosoftMangle.cpp')
-rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index b7bfc70123e..08dbfafe64c 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -307,39 +307,23 @@ void MicrosoftCXXNameMangler::mangleName(const NamedDecl *ND) { } void MicrosoftCXXNameMangler::mangleNumber(int64_t Number) { - // <number> ::= [?] <decimal digit> # 1 <= Number <= 10 - // ::= [?] <hex digit>+ @ # 0 or > 9; A = 0, B = 1, etc... - // ::= [?] @ # 0 (alternate mangling, not emitted by VC) - if (Number < 0) { - Out << '?'; - Number = -Number; - } - // There's a special shorter mangling for 0, but Microsoft - // chose not to use it. Instead, 0 gets mangled as "A@". Oh well... - if (Number >= 1 && Number <= 10) - Out << Number-1; - else { - // We have to build up the encoding in reverse order, so it will come - // out right when we write it out. - char Encoding[16]; - char *EndPtr = Encoding+sizeof(Encoding); - char *CurPtr = EndPtr; - do { - *--CurPtr = 'A' + (Number % 16); - Number /= 16; - } while (Number); - Out.write(CurPtr, EndPtr-CurPtr); - Out << '@'; - } + llvm::APSInt APSNumber(/*BitWidth=*/64, /*isUnsigned=*/false); + APSNumber = Number; + mangleNumber(APSNumber); } void MicrosoftCXXNameMangler::mangleNumber(const llvm::APSInt &Value) { + // <number> ::= [?] <decimal digit> # 1 <= Number <= 10 + // ::= [?] <hex digit>+ @ # 0 or > 9; A = 0, B = 1, etc... + // ::= [?] @ # 0 (alternate mangling, not emitted by VC) if (Value.isSigned() && Value.isNegative()) { Out << '?'; mangleNumber(llvm::APSInt(Value.abs())); return; } llvm::APSInt Temp(Value); + // There's a special shorter mangling for 0, but Microsoft + // chose not to use it. Instead, 0 gets mangled as "A@". Oh well... if (Value.uge(1) && Value.ule(10)) { --Temp; Temp.print(Out, false); |