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");
+}
return Visit(E->getSubExpr());
}
Value *VisitUnaryOffsetOf(const UnaryOperator *E);
+
+ // C++
Value *VisitCXXDefaultArgExpr(CXXDefaultArgExpr *DAE) {
return Visit(DAE->getExpr());
}
+ Value *VisitCXXThisExpr(CXXThisExpr *TE) {
+ return CGF.LoadCXXThis();
+ }
// Binary Operators.
Value *EmitMul(const BinOpInfo &Ops) {
// of a variable length array type.
llvm::Value *GetVLASize(const VariableArrayType *);
+ /// LoadCXXThis - Load the value of 'this'. This function is only valid while
+ /// generating code for an C++ member function.
+ llvm::Value *LoadCXXThis();
+
//===--------------------------------------------------------------------===//
// Declaration Emission
//===--------------------------------------------------------------------===//