From 3eb67ca786ef75bad43d30349c7334b921ba0dbc Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 12 May 2009 20:27:19 +0000 Subject: [PATCH] static methods don't get this pointers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71586 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGCall.cpp | 8 ++++---- 1 file 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 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(FD)) { + if (const CXXMethodDecl *MD = dyn_cast(FD)) if (MD->isInstance()) return getFunctionInfo(MD); - } const FunctionType *FTy = FD->getType()->getAsFunctionType(); if (const FunctionProtoType *FTP = dyn_cast(FTy)) -- 2.40.0