Support code generation of 'this' exprs

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69050 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index b491854..4df760d 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -113,3 +113,14 @@
   return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args), 
                   Callee, Args, MD);
 }
+
+
+llvm::Value *CodeGenFunction::LoadCXXThis() {
+  assert(isa<CXXMethodDecl>(CurFuncDecl) && 
+         "Must be in a C++ member function decl to load 'this'");
+  assert(cast<CXXMethodDecl>(CurFuncDecl)->isInstance() &&
+         "Must be in a C++ member function decl to load 'this'");
+  
+  // FIXME: What if we're inside a block?
+  return Builder.CreateLoad(LocalDeclMap[CXXThisDecl], "this");
+}