summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 091001e734e..19ac711f79b 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -492,19 +492,10 @@ LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) {
}
LValue CodeGenFunction::EmitStringLiteralLValue(const StringLiteral *E) {
- assert(!E->isWide() && "FIXME: Wide strings not supported yet!");
- // Get the string data
- const char *StrData = E->getStrData();
- unsigned Len = E->getByteLength();
- std::string StringLiteral(StrData, StrData+Len);
-
- // Resize the string to the right size
- const ConstantArrayType *CAT =
- getContext().getAsConstantArrayType(E->getType());
- uint64_t RealLen = CAT->getSize().getZExtValue();
- StringLiteral.resize(RealLen, '\0');
-
- return LValue::MakeAddr(CGM.GetAddrOfConstantString(StringLiteral),0);
+ llvm::Constant *C =
+ CGM.GetAddrOfConstantString(CGM.getStringForStringLiteral(E));
+
+ return LValue::MakeAddr(C,0);
}
LValue CodeGenFunction::EmitPredefinedLValue(const PredefinedExpr *E) {
OpenPOWER on IntegriCloud