summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-08-10 20:25:57 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-08-10 20:25:57 +0000
commit6dfdf8c97a79b14ecca3aba0bc1aff612cd62226 (patch)
tree77a7f034595384b4c5d93cb367c245fa669223f4 /clang/lib/CodeGen/CodeGenModule.h
parent4c3116437cc19d05b3031b8e99566ef47bf463e8 (diff)
downloadbcm5719-llvm-6dfdf8c97a79b14ecca3aba0bc1aff612cd62226.tar.gz
bcm5719-llvm-6dfdf8c97a79b14ecca3aba0bc1aff612cd62226.zip
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! llvm-svn: 54621
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index d90ebb4b361..8e7bb405a1b 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/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);
OpenPOWER on IntegriCloud