Add GetAddrOfConstantCString method
- Returns addr of constant for argument + '\0'.
- I couldn't think of a better name.
- Move appropriate users of GetAddrOfConstantString to this.
Rename getStringForStringLiteral to GetStringForStringLiteral.
Add GetAddrOfConstantStringFromLiteral
- This combines GetAddrOfConstantString and
GetStringForStringLiteral. This method can be, but is not yet, more
efficient.
Change GetAddrOfConstantString to not add terminating '\0'
- <rdar://problem/6140956>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54768 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 6bfd5cb..e6bc501 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -488,10 +488,7 @@
}
LValue CodeGenFunction::EmitStringLiteralLValue(const StringLiteral *E) {
- llvm::Constant *C =
- CGM.GetAddrOfConstantString(CGM.getStringForStringLiteral(E));
-
- return LValue::MakeAddr(C,0);
+ return LValue::MakeAddr(CGM.GetAddrOfConstantStringFromLiteral(E), 0);
}
LValue CodeGenFunction::EmitPredefinedLValue(const PredefinedExpr *E) {