diff options
Diffstat (limited to 'llvm/lib/IR/Mangler.cpp')
-rw-r--r-- | llvm/lib/IR/Mangler.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp index 7adcc59f571..be3086cfcf0 100644 --- a/llvm/lib/IR/Mangler.cpp +++ b/llvm/lib/IR/Mangler.cpp @@ -44,6 +44,9 @@ static void getNameWithPrefixImpl(raw_ostream &OS, const Twine &GVName, return; } + if (DL.doNotMangleLeadingQuestionMark() && Name[0] == '?') + Prefix = '\0'; + if (PrefixTy == Private) OS << DL.getPrivateGlobalPrefix(); else if (PrefixTy == LinkerPrivate) @@ -135,8 +138,13 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, // Mangle functions with Microsoft calling conventions specially. Only do // this mangling for x86_64 vectorcall and 32-bit x86. const Function *MSFunc = dyn_cast<Function>(GV); - if (Name.startswith("\01")) - MSFunc = nullptr; // Don't mangle when \01 is present. + + // Don't add byte count suffixes when '\01' or '?' are in the first + // character. + if (Name.startswith("\01") || + (DL.doNotMangleLeadingQuestionMark() && Name.startswith("?"))) + MSFunc = nullptr; + CallingConv::ID CC = MSFunc ? MSFunc->getCallingConv() : (unsigned)CallingConv::C; if (!DL.hasMicrosoftFastStdCallMangling() && |