aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/StringExtras.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/StringExtras.cpp')
-rw-r--r--llvm/lib/Support/StringExtras.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Support/StringExtras.cpp b/llvm/lib/Support/StringExtras.cpp
index 21157a1..f493315 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);