diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-08-13 23:20:05 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-08-13 23:20:05 +0000 |
commit | 6143293fa4366ee95d7e47e61bd030a34bf68b55 (patch) | |
tree | 9aa742ed437a22a37bd505e604a06d2b1768c667 /lib/CodeGen/CodeGenModule.h | |
parent | ae6814efb6c41bd0c0f6413d25097105284d5be7 (diff) |
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
Diffstat (limited to 'lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | lib/CodeGen/CodeGenModule.h | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index a837b6369c..dd8ac1739f 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -143,15 +143,34 @@ public: /// "__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(); |