diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2018-01-26 20:21:02 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2018-01-26 20:21:02 +0000 |
commit | d15b2898d3390137497b0813dc8ccbf80cd06055 (patch) | |
tree | e95f16dc94b2c4c377080c1be97d91984b6e3f5a /llvm/lib/Support | |
parent | a03d3198eeacba41ba6c443ea0fdbd30249ab176 (diff) | |
download | bcm5719-llvm-d15b2898d3390137497b0813dc8ccbf80cd06055.tar.gz bcm5719-llvm-d15b2898d3390137497b0813dc8ccbf80cd06055.zip |
[Support] Move PrintEscapedString into the library its declaration is in
llvm-svn: 323558
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/StringExtras.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Support/StringExtras.cpp b/llvm/lib/Support/StringExtras.cpp index 21157a14086..f4933150d28 100644 --- a/llvm/lib/Support/StringExtras.cpp +++ b/llvm/lib/Support/StringExtras.cpp @@ -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); |