[cfe-commits] r59015 - /cfe/trunk/lib/Analysis/MemRegion.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Mon Nov 10 17:36:33 PST 2008
Author: zhongxingxu
Date: Mon Nov 10 19:36:32 2008
New Revision: 59015
URL: http://llvm.org/viewvc/llvm-project?rev=59015&view=rev
Log:
Fix StringLiteral print bug.
Modified:
cfe/trunk/lib/Analysis/MemRegion.cpp
Modified: cfe/trunk/lib/Analysis/MemRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/MemRegion.cpp?rev=59015&r1=59014&r2=59015&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/MemRegion.cpp (original)
+++ cfe/trunk/lib/Analysis/MemRegion.cpp Mon Nov 10 19:36:32 2008
@@ -152,7 +152,23 @@
}
void StringRegion::print(llvm::raw_ostream& os) const {
- os << "\"" << Str->getStrData() << "\"";
+ if (Str->isWide()) os << 'L';
+ os << '"';
+
+ // FIXME: this doesn't print wstrings right.
+ for (unsigned i = 0, e = Str->getByteLength(); i != e; ++i) {
+ switch (Str->getStrData()[i]) {
+ default: os << Str->getStrData()[i]; break;
+ // Handle some common ones 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;
+ }
+ }
+ os << '"';
}
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list