]> granicus.if.org Git - clang/commitdiff
Add a getFunctionInfo that takes a BlockPointerType.
authorAnders Carlsson <andersca@mac.com>
Mon, 6 Apr 2009 18:05:26 +0000 (18:05 +0000)
committerAnders Carlsson <andersca@mac.com>
Mon, 6 Apr 2009 18:05:26 +0000 (18:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68452 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCall.cpp
lib/CodeGen/CodeGenTypes.h

index e3f824fc7428cddfb78d905b7011a32f3d1922e5..43db767158eccd803787850fc875f34176f968d7 100644 (file)
@@ -53,6 +53,19 @@ CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionProtoType *FTP) {
   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.
index 33417e5f01bce043002726186a31d58c87edee99..b09531f5ca3683644d0d826816fcfb8f5ec9de66 100644 (file)
@@ -172,11 +172,14 @@ public:
 
   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);