Implement parsing and code generation of Objective-C string literals.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41238 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGExpr.cpp b/CodeGen/CGExpr.cpp
index ee7b47e..cbf92f9 100644
--- a/CodeGen/CGExpr.cpp
+++ b/CodeGen/CGExpr.cpp
@@ -566,6 +566,8 @@
     return EmitConditionalOperator(cast<ConditionalOperator>(E));
   case Expr::ChooseExprClass:
     return EmitChooseExpr(cast<ChooseExpr>(E));
+  case Expr::ObjCStringLiteralClass:
+    return EmitObjCStringLiteral(cast<ObjCStringLiteral>(E));
   }
 }
 
diff --git a/CodeGen/CGObjC.cpp b/CodeGen/CGObjC.cpp
new file mode 100644
index 0000000..e08fcca
--- /dev/null
+++ b/CodeGen/CGObjC.cpp
@@ -0,0 +1,28 @@
+//===---- CGBuiltin.cpp - Emit LLVM Code for builtins ---------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Anders Carlsson and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This contains code to emit Objective-C code as LLVM code.
+//
+//===----------------------------------------------------------------------===//
+
+#include "CodeGenFunction.h"
+#include "CodeGenModule.h"
+#include "clang/AST/Expr.h"
+#include "llvm/Constant.h"
+
+using namespace clang;
+using namespace CodeGen;
+
+RValue CodeGenFunction::EmitObjCStringLiteral(const ObjCStringLiteral* E)
+{
+  std::string S(E->getString()->getStrData(), E->getString()->getByteLength());
+  
+  return RValue::get(CGM.GetAddrOfConstantCFString(S));
+}
+
diff --git a/CodeGen/CodeGenFunction.h b/CodeGen/CodeGenFunction.h
index a0a3c61..95e3656 100644
--- a/CodeGen/CodeGenFunction.h
+++ b/CodeGen/CodeGenFunction.h
@@ -61,6 +61,7 @@
   class ConditionalOperator;
   class ChooseExpr;
   class PreDefinedExpr;
+  class ObjCStringLiteral;
   
   class BlockVarDecl;
   class EnumConstantDecl;
@@ -393,6 +394,8 @@
   RValue EmitConditionalOperator(const ConditionalOperator *E);
   RValue EmitChooseExpr(const ChooseExpr *E);
   
+  RValue EmitObjCStringLiteral(const ObjCStringLiteral* E);
+
   //===--------------------------------------------------------------------===//
   //                       Aggregate Expression Emission
   //===--------------------------------------------------------------------===//