diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/libs/llvm12/lib/IR/Mangler.cpp | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/IR/Mangler.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/IR/Mangler.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/contrib/libs/llvm12/lib/IR/Mangler.cpp b/contrib/libs/llvm12/lib/IR/Mangler.cpp index f067d517b8..674ba3cdaa 100644 --- a/contrib/libs/llvm12/lib/IR/Mangler.cpp +++ b/contrib/libs/llvm12/lib/IR/Mangler.cpp @@ -12,7 +12,7 @@ #include "llvm/IR/Mangler.h" #include "llvm/ADT/SmallString.h" -#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Triple.h" #include "llvm/ADT/Twine.h" #include "llvm/IR/DataLayout.h" @@ -101,7 +101,7 @@ static void addByteCountSuffix(raw_ostream &OS, const Function *F, for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end(); AI != AE; ++AI) { // 'Dereference' type in case of byval or inalloca parameter attribute. - uint64_t AllocSize = AI->hasPassPointeeByValueCopyAttr() ? + uint64_t AllocSize = AI->hasPassPointeeByValueCopyAttr() ? AI->getPassPointeeByValueCopySize(DL) : DL.getTypeAllocSize(AI->getType()); @@ -185,25 +185,25 @@ void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName, getNameWithPrefix(OS, GV, CannotUsePrivateLabel); } -// Check if the name needs quotes to be safe for the linker to interpret. -static bool canBeUnquotedInDirective(char C) { - return isAlnum(C) || C == '_' || C == '$' || C == '.' || C == '@'; -} - -static bool canBeUnquotedInDirective(StringRef Name) { - if (Name.empty()) - return false; - - // If any of the characters in the string is an unacceptable character, force - // quotes. - for (char C : Name) { - if (!canBeUnquotedInDirective(C)) - return false; - } - - return true; -} - +// Check if the name needs quotes to be safe for the linker to interpret. +static bool canBeUnquotedInDirective(char C) { + return isAlnum(C) || C == '_' || C == '$' || C == '.' || C == '@'; +} + +static bool canBeUnquotedInDirective(StringRef Name) { + if (Name.empty()) + return false; + + // If any of the characters in the string is an unacceptable character, force + // quotes. + for (char C : Name) { + if (!canBeUnquotedInDirective(C)) + return false; + } + + return true; +} + void llvm::emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV, const Triple &TT, Mangler &Mangler) { if (!GV->hasDLLExportStorageClass() || GV->isDeclaration()) @@ -214,9 +214,9 @@ void llvm::emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV, else OS << " -export:"; - bool NeedQuotes = GV->hasName() && !canBeUnquotedInDirective(GV->getName()); - if (NeedQuotes) - OS << "\""; + bool NeedQuotes = GV->hasName() && !canBeUnquotedInDirective(GV->getName()); + if (NeedQuotes) + OS << "\""; if (TT.isWindowsGNUEnvironment() || TT.isWindowsCygwinEnvironment()) { std::string Flag; raw_string_ostream FlagOS(Flag); @@ -229,8 +229,8 @@ void llvm::emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV, } else { Mangler.getNameWithPrefix(OS, GV, false); } - if (NeedQuotes) - OS << "\""; + if (NeedQuotes) + OS << "\""; if (!GV->getValueType()->isFunctionTy()) { if (TT.isWindowsMSVCEnvironment()) @@ -246,11 +246,11 @@ void llvm::emitLinkerFlagsForUsedCOFF(raw_ostream &OS, const GlobalValue *GV, return; OS << " /INCLUDE:"; - bool NeedQuotes = GV->hasName() && !canBeUnquotedInDirective(GV->getName()); - if (NeedQuotes) - OS << "\""; + bool NeedQuotes = GV->hasName() && !canBeUnquotedInDirective(GV->getName()); + if (NeedQuotes) + OS << "\""; M.getNameWithPrefix(OS, GV, false); - if (NeedQuotes) - OS << "\""; + if (NeedQuotes) + OS << "\""; } |