diff options
author | Devang Patel <dpatel@apple.com> | 2011-05-31 22:21:11 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2011-05-31 22:21:11 +0000 |
commit | d127bcbaab6411a6d1a79c1e01abd0320f366cc5 (patch) | |
tree | f1e852fb1110e0255027818bd7424ddf900b3107 /lib | |
parent | c478f21820a187458c60c7d023a32c81eba24e42 (diff) |
Robustify objc method type description (subroutine type) by walking parameters directly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132368 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 5ebf133303..cc0dbd6bb5 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1628,25 +1628,20 @@ llvm::DIType CGDebugInfo::getOrCreateFunctionType(const Decl * D, QualType FnTyp 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); } |