summaryrefslogtreecommitdiff
path: root/lib/VMCore/AsmWriter.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-02-01 04:51:17 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-02-01 04:51:17 +0000
commit91766fe066efe6e0969ba805a2e3726a70ed34a3 (patch)
tree4341aed84ba24607ccb4c8426dfd695b2e484abb /lib/VMCore/AsmWriter.cpp
parentde5e5ec3045a73a06b1054417f9ac6c02929e9ce (diff)
downloadllvm-91766fe066efe6e0969ba805a2e3726a70ed34a3.tar.gz
llvm-91766fe066efe6e0969ba805a2e3726a70ed34a3.tar.bz2
llvm-91766fe066efe6e0969ba805a2e3726a70ed34a3.tar.xz
Revert Chris' commits up to r149348 that started causing VMCoreTests unit test to fail.
These are: r149348 r149351 r149352 r149354 r149356 r149357 r149361 r149362 r149364 r149365 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
-rw-r--r--lib/VMCore/AsmWriter.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 1dd1254f65..eb0f66196d 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -827,21 +827,30 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
}
if (const ConstantArray *CA = dyn_cast<ConstantArray>(CV)) {
+ // As a special case, print the array as a string if it is an array of
+ // i8 with ConstantInt values.
+ //
Type *ETy = CA->getType()->getElementType();
- Out << '[';
- TypePrinter.print(ETy, Out);
- Out << ' ';
- WriteAsOperandInternal(Out, CA->getOperand(0),
- &TypePrinter, Machine,
- Context);
- for (unsigned i = 1, e = CA->getNumOperands(); i != e; ++i) {
- Out << ", ";
+ if (CA->isString()) {
+ Out << "c\"";
+ PrintEscapedString(CA->getAsString(), Out);
+ Out << '"';
+ } else { // Cannot output in string format...
+ Out << '[';
TypePrinter.print(ETy, Out);
Out << ' ';
- WriteAsOperandInternal(Out, CA->getOperand(i), &TypePrinter, Machine,
+ WriteAsOperandInternal(Out, CA->getOperand(0),
+ &TypePrinter, Machine,
Context);
+ for (unsigned i = 1, e = CA->getNumOperands(); i != e; ++i) {
+ Out << ", ";
+ TypePrinter.print(ETy, Out);
+ Out << ' ';
+ WriteAsOperandInternal(Out, CA->getOperand(i), &TypePrinter, Machine,
+ Context);
+ }
+ Out << ']';
}
- Out << ']';
return;
}