[cfe-commits] r132368 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Devang Patel
dpatel at apple.com
Tue May 31 15:21:11 PDT 2011
Author: dpatel
Date: Tue May 31 17:21:11 2011
New Revision: 132368
URL: http://llvm.org/viewvc/llvm-project?rev=132368&view=rev
Log:
Robustify objc method type description (subroutine type) by walking parameters directly.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=132368&r1=132367&r2=132368&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue May 31 17:21:11 2011
@@ -1628,25 +1628,20 @@
if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D))
return getOrCreateMethodType(Method, F);
else if (const ObjCMethodDecl *OMethod = dyn_cast<ObjCMethodDecl>(D)) {
-
- llvm::DIType MTy = getOrCreateType(FnType, F);
- llvm::DIArray Args = llvm::DICompositeType(MTy).getTypeArray();
- assert (Args.getNumElements() && "Invalid number of arguments!");
-
// Add "self" and "_cmd"
llvm::SmallVector<llvm::Value *, 16> Elts;
// First element is always return type. For 'void' functions it is NULL.
- Elts.push_back(Args.getElement(0));
-
+ Elts.push_back(getOrCreateType(OMethod->getResultType(), F));
// "self" pointer is always first argument.
Elts.push_back(getOrCreateType(OMethod->getSelfDecl()->getType(), F));
// "cmd" pointer is always second argument.
Elts.push_back(getOrCreateType(OMethod->getCmdDecl()->getType(), F));
-
- // Copy rest of the arguments.
- for (unsigned i = 1, e = Args.getNumElements(); i != e; ++i)
- Elts.push_back(Args.getElement(i));
+ // Get rest of the arguments.
+ for (ObjCMethodDecl::param_iterator PI = OMethod->param_begin(),
+ PE = OMethod->param_end(); PI != PE; ++PI)
+ Elts.push_back(getOrCreateType((*PI)->getType(), F));
+
llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(Elts);
return DBuilder.createSubroutineType(F, EltTypeArray);
}
More information about the cfe-commits
mailing list