forked from OSchip/llvm-project
[pr20127] Check for leading \1 in the Twine version of getNameWithPrefix.
No functionality change, but will simplify an upcoming patch that uses the Twine version. llvm-svn: 214515
This commit is contained in:
parent
ce5dd1acc2
commit
5d457dede9
|
@ -27,6 +27,13 @@ static void getNameWithPrefixx(raw_ostream &OS, const Twine &GVName,
|
||||||
StringRef Name = GVName.toStringRef(TmpData);
|
StringRef Name = GVName.toStringRef(TmpData);
|
||||||
assert(!Name.empty() && "getNameWithPrefix requires non-empty name");
|
assert(!Name.empty() && "getNameWithPrefix requires non-empty name");
|
||||||
|
|
||||||
|
// No need to do anything special if the global has the special "do not
|
||||||
|
// mangle" flag in the name.
|
||||||
|
if (Name[0] == '\1') {
|
||||||
|
OS << Name.substr(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (PrefixTy == Mangler::Private)
|
if (PrefixTy == Mangler::Private)
|
||||||
OS << DL.getPrivateGlobalPrefix();
|
OS << DL.getPrivateGlobalPrefix();
|
||||||
else if (PrefixTy == Mangler::LinkerPrivate)
|
else if (PrefixTy == Mangler::LinkerPrivate)
|
||||||
|
@ -100,17 +107,10 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
||||||
|
|
||||||
StringRef Name = GV->getName();
|
StringRef Name = GV->getName();
|
||||||
|
|
||||||
// No need to do anything special if the global has the special "do not
|
|
||||||
// mangle" flag in the name.
|
|
||||||
if (Name[0] == '\1') {
|
|
||||||
OS << Name.substr(1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UseAt = false;
|
bool UseAt = false;
|
||||||
const Function *MSFunc = nullptr;
|
const Function *MSFunc = nullptr;
|
||||||
CallingConv::ID CC;
|
CallingConv::ID CC;
|
||||||
if (DL->hasMicrosoftFastStdCallMangling()) {
|
if (Name[0] != '\1' && DL->hasMicrosoftFastStdCallMangling()) {
|
||||||
if ((MSFunc = dyn_cast<Function>(GV))) {
|
if ((MSFunc = dyn_cast<Function>(GV))) {
|
||||||
CC = MSFunc->getCallingConv();
|
CC = MSFunc->getCallingConv();
|
||||||
// fastcall functions need to start with @ instead of _.
|
// fastcall functions need to start with @ instead of _.
|
||||||
|
|
Loading…
Reference in New Issue