diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-08-10 20:25:57 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-08-10 20:25:57 +0000 |
commit | 1e04976fc2611d8cc06986a81deed4c42183b870 (patch) | |
tree | 1c6d0b660c3141ec9bf4ba557f8080f8656e8537 /lib/CodeGen/CodeGenModule.h | |
parent | 7bfaaaecb3113f955db31e8d8a51acffd1bc0c27 (diff) |
Back out r54608 (inline string literals were getting an extra '\0')
temporarily, I assumed GetAddrForConstantString literal was being
used consistently but it doesn't look like it is.
Factored out a CodeGenModule::getStringForStringLiteral which handles
extracting a std::string for the bytes of a StringLiteral, padded to
match the type.
Update EmitLValue to use getStringForStringLiteral, this was
previously not padding strings correctly. Good thing we only emit
strings in 4 different places!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54621 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | lib/CodeGen/CodeGenModule.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index d90ebb4b36..8e7bb405a1 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -39,6 +39,7 @@ namespace clang { class Decl; class Expr; class Stmt; + class StringLiteral; class NamedDecl; class ValueDecl; class VarDecl; @@ -134,6 +135,10 @@ public: llvm::Function *getBuiltinLibFunction(unsigned BuiltinID); 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); + /// GetAddrOfConstantString -- returns a pointer to the character /// array containing the literal. The result is pointer to array type. llvm::Constant *GetAddrOfConstantString(const std::string& str); |