[cfe-commits] r132361 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenObjC/debug-info-pubtypes.m
Devang Patel
dpatel at apple.com
Tue May 31 14:18:50 PDT 2011
Author: dpatel
Date: Tue May 31 16:18:50 2011
New Revision: 132361
URL: http://llvm.org/viewvc/llvm-project?rev=132361&view=rev
Log:
List objective-c ineterfaces as public types in dwarf debug info output.
Added:
cfe/trunk/test/CodeGenObjC/debug-info-pubtypes.m
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=132361&r1=132360&r2=132361&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue May 31 16:18:50 2011
@@ -1627,7 +1627,29 @@
llvm::DIFile F) {
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));
+
+ // "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));
+ llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(Elts);
+ return DBuilder.createSubroutineType(F, EltTypeArray);
+ }
return getOrCreateType(FnType, F);
}
Added: cfe/trunk/test/CodeGenObjC/debug-info-pubtypes.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-pubtypes.m?rev=132361&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-pubtypes.m (added)
+++ cfe/trunk/test/CodeGenObjC/debug-info-pubtypes.m Tue May 31 16:18:50 2011
@@ -0,0 +1,18 @@
+// RUN: %clang -cc1 -triple x86_64-apple-darwin10 -g -S %s -o %t
+// RUN: FileCheck %s < %t
+
+//CHECK: .long Lset6
+//CHECK-NEXT: .long 256
+//CHECK-NEXT: .asciz "H"
+//CHECK-NEXT: .long 0
+//CHECK-NEXT: Lpubtypes_end1:
+
+ at interface H
+-(void) foo;
+ at end
+
+ at implementation H
+-(void) foo {
+}
+ at end
+
More information about the cfe-commits
mailing list