diff options
author | Anders Carlsson <andersca@mac.com> | 2009-04-14 16:58:56 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-04-14 16:58:56 +0000 |
commit | 5f4307b7ba164b03c853c8d3eb4674d33f8967a6 (patch) | |
tree | 78c5a7944c965c7889abbfdf0c31408a8dcbb6a0 /lib/CodeGen/CGCXX.cpp | |
parent | 0fab49f7daa53a53882f19c2879feb210608fe00 (diff) |
Support code generation of 'this' exprs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index b491854af9..4df760d593 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -113,3 +113,14 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) { 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"); +} |