diff options
author | Chris Lattner <sabre@nondot.org> | 2009-05-12 20:27:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-05-12 20:27:19 +0000 |
commit | 3eb67ca786ef75bad43d30349c7334b921ba0dbc (patch) | |
tree | e1b3105c07a45c641820939147220a4e16de00ae /lib/CodeGen | |
parent | 005eedce54da6580de37bb115bf581008637e4b1 (diff) |
static methods don't get this pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71586 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 1df9b0be63..072cc58e08 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -55,8 +55,9 @@ CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionProtoType *FTP) { const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXMethodDecl *MD) { llvm::SmallVector<QualType, 16> ArgTys; - // Add the 'this' pointer. - ArgTys.push_back(MD->getThisType(Context)); + // Add the 'this' pointer unless this is a static method. + if (MD->isInstance()) + ArgTys.push_back(MD->getThisType(Context)); const FunctionProtoType *FTP = MD->getType()->getAsFunctionProtoType(); for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i) @@ -65,10 +66,9 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXMethodDecl *MD) { } const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionDecl *FD) { - if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) { + if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) if (MD->isInstance()) return getFunctionInfo(MD); - } const FunctionType *FTy = FD->getType()->getAsFunctionType(); if (const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FTy)) |