[cfe-commits] r145491 - /cfe/trunk/lib/Lex/ModuleMap.cpp
Douglas Gregor
dgregor at apple.com
Wed Nov 30 07:00:50 PST 2011
Author: dgregor
Date: Wed Nov 30 09:00:49 2011
New Revision: 145491
URL: http://llvm.org/viewvc/llvm-project?rev=145491&view=rev
Log:
Switch the module map printer over to
raw_ostream::write_escaped. Thanks, Benjamin!
Modified:
cfe/trunk/lib/Lex/ModuleMap.cpp
Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=145491&r1=145490&r2=145491&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Wed Nov 30 09:00:49 2011
@@ -72,31 +72,6 @@
OS << std::string(Spaces, ' ');
}
-static void printEscapedString(llvm::raw_ostream &OS, StringRef String) {
- for (StringRef::iterator I = String.begin(), E = String.end(); I != E; ++I) {
- unsigned char Char = *I;
-
- switch (Char) {
- default:
- if (isprint(Char))
- OS << (char)Char;
- else // Output anything hard as an octal escape.
- OS << '\\'
- << (char)('0'+ ((Char >> 6) & 7))
- << (char)('0'+ ((Char >> 3) & 7))
- << (char)('0'+ ((Char >> 0) & 7));
- break;
- // Handle some common non-printable cases to make dumps prettier.
- case '\\': OS << "\\\\"; break;
- case '"': OS << "\\\""; break;
- case '\n': OS << "\\n"; break;
- case '\t': OS << "\\t"; break;
- case '\a': OS << "\\a"; break;
- case '\b': OS << "\\b"; break;
- }
- }
-}
-
void ModuleMap::Module::print(llvm::raw_ostream &OS, unsigned Indent) const {
indent(OS, Indent);
if (IsFramework)
@@ -108,14 +83,14 @@
if (UmbrellaHeader) {
indent(OS, Indent + 2);
OS << "umbrella \"";
- printEscapedString(OS, UmbrellaHeader->getName());
+ OS.write_escaped(UmbrellaHeader->getName());
OS << "\"\n";
}
for (unsigned I = 0, N = Headers.size(); I != N; ++I) {
indent(OS, Indent + 2);
OS << "header \"";
- printEscapedString(OS, Headers[I]->getName());
+ OS.write_escaped(Headers[I]->getName());
OS << "\"\n";
}
More information about the cfe-commits
mailing list