[Support] Move PrintEscapedString into the library its declaration is in

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323558 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2018-01-26 20:21:02 +00:00
parent 99509aa735
commit e4a395e88a
2 changed files with 10 additions and 10 deletions

View File

@ -383,16 +383,6 @@ static void PrintCallingConv(unsigned cc, raw_ostream &Out) {
}
}
void llvm::PrintEscapedString(StringRef Name, raw_ostream &Out) {
for (unsigned i = 0, e = Name.size(); i != e; ++i) {
unsigned char C = Name[i];
if (isprint(C) && C != '\\' && C != '"')
Out << C;
else
Out << '\\' << hexdigit(C >> 4) << hexdigit(C & 0x0F);
}
}
enum PrefixType {
GlobalPrefix,
ComdatPrefix,

View File

@ -58,6 +58,16 @@ void llvm::SplitString(StringRef Source,
}
}
void llvm::PrintEscapedString(StringRef Name, raw_ostream &Out) {
for (unsigned i = 0, e = Name.size(); i != e; ++i) {
unsigned char C = Name[i];
if (isprint(C) && C != '\\' && C != '"')
Out << C;
else
Out << '\\' << hexdigit(C >> 4) << hexdigit(C & 0x0F);
}
}
void llvm::printLowerCase(StringRef String, raw_ostream &Out) {
for (const char C : String)
Out << toLower(C);