[cfe-commits] r68452 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CodeGenTypes.h

Anders Carlsson andersca at mac.com
Mon Apr 6 11:05:26 PDT 2009


Author: andersca
Date: Mon Apr  6 13:05:26 2009
New Revision: 68452

URL: http://llvm.org/viewvc/llvm-project?rev=68452&view=rev
Log:
Add a getFunctionInfo that takes a BlockPointerType.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CodeGenTypes.h

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=68452&r1=68451&r2=68452&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Mon Apr  6 13:05:26 2009
@@ -53,6 +53,19 @@
   return getFunctionInfo(FTP->getResultType(), ArgTys);
 }
 
+const 
+CGFunctionInfo &CodeGenTypes::getFunctionInfo(const BlockPointerType *BPT) {
+  llvm::SmallVector<QualType, 16> ArgTys;
+  const FunctionProtoType *FTP = 
+    BPT->getPointeeType()->getAsFunctionProtoType();
+  
+  // Add the block pointer.
+  ArgTys.push_back(Context.getPointerType(Context.VoidTy));
+  for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i)
+    ArgTys.push_back(FTP->getArgType(i));
+  return getFunctionInfo(FTP->getResultType(), ArgTys);
+}
+
 const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXMethodDecl *MD) {
   llvm::SmallVector<QualType, 16> ArgTys;
   // Add the 'this' pointer.

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.h?rev=68452&r1=68451&r2=68452&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.h Mon Apr  6 13:05:26 2009
@@ -172,11 +172,14 @@
 
   const CGFunctionInfo &getFunctionInfo(const FunctionNoProtoType *FTNP);
   const CGFunctionInfo &getFunctionInfo(const FunctionProtoType *FTP);
+  const CGFunctionInfo &getFunctionInfo(const BlockPointerType *BPT);
   const CGFunctionInfo &getFunctionInfo(const FunctionDecl *FD);
   const CGFunctionInfo &getFunctionInfo(const CXXMethodDecl *MD);
   const CGFunctionInfo &getFunctionInfo(const ObjCMethodDecl *MD);
+//private:
   const CGFunctionInfo &getFunctionInfo(QualType ResTy, 
                                         const CallArgList &Args);
+public:
   const CGFunctionInfo &getFunctionInfo(QualType ResTy, 
                                         const FunctionArgList &Args);
   





More information about the cfe-commits mailing list