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/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index a837b63..dd8ac17 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -143,15 +143,34 @@
/// "__builtin_fabsf", return a Function* for "fabsf".
///
llvm::Function *getBuiltinLibFunction(unsigned BuiltinID);
+
+ /// GetStringForStringLiteral - Return the appropriate bytes for a
+ /// string literal, properly padded to match the literal type. If
+ /// only the address of a constant is needed consider using
+ /// GetAddrOfConstantStringLiteral.
+ std::string GetStringForStringLiteral(const StringLiteral *E);
+
llvm::Constant *GetAddrOfConstantCFString(const std::string& str);
- /// getStringForStringLiteral - Return the appropriate bytes for a
- /// string literal, properly padded to match the literal type.
- std::string getStringForStringLiteral(const StringLiteral *E);
+ /// GetAddrOfConstantStringFromLiteral - Return a pointer to a
+ /// constant array for the given string literal.
+ llvm::Constant *GetAddrOfConstantStringFromLiteral(const StringLiteral *S);
- /// GetAddrOfConstantString -- returns a pointer to the character
- /// array containing the literal. The result is pointer to array type.
+ /// GetAddrOfConstantString - Returns a pointer to a character array
+ /// containing the literal. This contents are exactly that of the
+ /// given string, i.e. it will not be null terminated automatically;
+ /// see GetAddrOfConstantCString. Note that whether the result is
+ /// actually a pointer to an LLVM constant depends on
+ /// Feature.WriteableStrings.
+ ///
+ /// The result has pointer to array type.
llvm::Constant *GetAddrOfConstantString(const std::string& str);
+
+ /// GetAddrOfConstantCString - Returns a pointer to a character
+ /// array containing the literal and a terminating '\-'
+ /// character. The result has pointer to array type.
+ llvm::Constant *GetAddrOfConstantCString(const std::string &str);
+
llvm::Function *getMemCpyFn();
llvm::Function *getMemMoveFn();
llvm::Function *getMemSetFn();