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
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index d90ebb4..8e7bb40 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -39,6 +39,7 @@
   class Decl;
   class Expr;
   class Stmt;
+  class StringLiteral;
   class NamedDecl;
   class ValueDecl;
   class VarDecl;
@@ -134,6 +135,10 @@
   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);