[cfe-commits] r153640 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenObjC/debug-info-property3.m
Eric Christopher
echristo at apple.com
Thu Mar 29 01:43:37 PDT 2012
Author: echristo
Date: Thu Mar 29 03:43:37 2012
New Revision: 153640
URL: http://llvm.org/viewvc/llvm-project?rev=153640&view=rev
Log:
Add support for objc property decls according to the page at:
http://llvm.org/docs/SourceLevelDebugging.html#objcproperty
including type and DECL. Expand the getter and setter names
into the fully qualified names.
rdar://11144023
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenObjC/debug-info-property3.m
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=153640&r1=153639&r2=153640&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Mar 29 03:43:37 2012
@@ -165,15 +165,6 @@
return StringRef(StrPtr, OS.tell());
}
-/// getSelectorName - Return selector name. This is used for debugging
-/// info.
-StringRef CGDebugInfo::getSelectorName(Selector S) {
- const std::string &SName = S.getAsString();
- char *StrPtr = DebugInfoNames.Allocate<char>(SName.size());
- memcpy(StrPtr, SName.data(), SName.size());
- return StringRef(StrPtr, SName.size());
-}
-
/// getClassName - Get class name including template argument list.
StringRef
CGDebugInfo::getClassName(const RecordDecl *RD) {
@@ -1324,11 +1315,18 @@
for (ObjCContainerDecl::prop_iterator I = ID->prop_begin(),
E = ID->prop_end(); I != E; ++I) {
const ObjCPropertyDecl *PD = *I;
+ SourceLocation Loc = PD->getLocation();
+ llvm::DIFile PUnit = getOrCreateFile(Loc);
+ unsigned PLine = getLineNumber(Loc);
+ ObjCMethodDecl *GDecl = PD->getGetterMethodDecl();
+ ObjCMethodDecl *SDecl = PD->getSetterMethodDecl();
llvm::MDNode *PropertyNode =
DBuilder.createObjCProperty(PD->getName(),
- getSelectorName(PD->getGetterName()),
- getSelectorName(PD->getSetterName()),
- PD->getPropertyAttributes());
+ PUnit, PLine,
+ GDecl ? getObjCMethodName(GDecl) : "",
+ SDecl ? getObjCMethodName(SDecl) : "",
+ PD->getPropertyAttributes(),
+ getOrCreateType(PD->getType(), PUnit));
EltTys.push_back(PropertyNode);
}
@@ -1380,11 +1378,18 @@
if (ObjCPropertyImplDecl *PImpD =
ImpD->FindPropertyImplIvarDecl(Field->getIdentifier())) {
if (ObjCPropertyDecl *PD = PImpD->getPropertyDecl()) {
- PropertyNode =
- DBuilder.createObjCProperty(PD->getName(),
- getSelectorName(PD->getGetterName()),
- getSelectorName(PD->getSetterName()),
- PD->getPropertyAttributes());
+ SourceLocation Loc = PD->getLocation();
+ llvm::DIFile PUnit = getOrCreateFile(Loc);
+ unsigned PLine = getLineNumber(Loc);
+ ObjCMethodDecl *GDecl = PD->getGetterMethodDecl();
+ ObjCMethodDecl *SDecl = PD->getSetterMethodDecl();
+ PropertyNode =
+ DBuilder.createObjCProperty(PD->getName(),
+ PUnit, PLine,
+ GDecl ? getObjCMethodName(GDecl) : "",
+ SDecl ? getObjCMethodName(SDecl) : "",
+ PD->getPropertyAttributes(),
+ getOrCreateType(PD->getType(),PUnit));
}
}
}
Modified: cfe/trunk/test/CodeGenObjC/debug-info-property3.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-property3.m?rev=153640&r1=153639&r2=153640&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-property3.m (original)
+++ cfe/trunk/test/CodeGenObjC/debug-info-property3.m Thu Mar 29 03:43:37 2012
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -S -emit-llvm -g %s -o - | FileCheck %s
-// CHECK: metadata !"p1", metadata !"p1", metadata !"setP1:", i32 2316} ; [ DW_TAG_APPLE_property ]
+// CHECK: metadata !"p1", metadata !6, i32 5, metadata !"-[I1 p1]", metadata !"-[I1 setP1:]", i32 2316, metadata !9} ; [ DW_TAG_APPLE_property ]
@interface I1
@property int p1;
@end
More information about the cfe-commits
mailing list