r183474 - ObjC Debug Info: Emit the names of accessors whenever they diverge from

Eric Christopher echristo at gmail.com
Fri Jun 7 11:37:25 PDT 2013


Two quick comments:

> +  assert(Setter->getDeclName().isObjCOneArgSelector());
> +  // Construct a setter name like SelectorTable::constructSetterName()
> +  // does, but without entering it into the table.
> +  SmallString<100> DefaultName("set");

100 seems a bit big?

> +  DefaultName += PD->getName();
> +  DefaultName[3] = toUppercase(DefaultName[3]);

Magic numbers! doing magic things! That we don't mention what they are...

How about some documentation here? :)

-eric

> +  return DefaultName ==
> +    Setter->getDeclName().getObjCSelector().getNameForSlot(0);
> +}
> +
>  /// CreateType - get objective-c interface type.
>  llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
>                                       llvm::DIFile Unit) {
> @@ -1524,9 +1554,9 @@ llvm::DIType CGDebugInfo::CreateType(con
>      llvm::MDNode *PropertyNode =
>        DBuilder.createObjCProperty(PD->getName(),
>                                    PUnit, PLine,
> -                                  (Getter && Getter->isImplicit()) ? "" :
> +                                  hasDefaultGetterName(PD, Getter) ? "" :
>                                    getSelectorName(PD->getGetterName()),
> -                                  (Setter && Setter->isImplicit()) ? "" :
> +                                  hasDefaultSetterName(PD, Setter) ? "" :
>                                    getSelectorName(PD->getSetterName()),
>                                    PD->getPropertyAttributes(),
>                                    getOrCreateType(PD->getType(), PUnit));
> @@ -1598,9 +1628,9 @@ llvm::DIType CGDebugInfo::CreateType(con
>            PropertyNode =
>              DBuilder.createObjCProperty(PD->getName(),
>                                          PUnit, PLine,
> -                                        (Getter && Getter->isImplicit()) ? "" :
> +                                        hasDefaultGetterName(PD, Getter) ? "" :
>                                          getSelectorName(PD->getGetterName()),
> -                                        (Setter && Setter->isImplicit()) ? "" :
> +                                        hasDefaultSetterName(PD, Setter) ? "" :
>                                          getSelectorName(PD->getSetterName()),
>                                          PD->getPropertyAttributes(),
>                                          getOrCreateType(PD->getType(), PUnit));
>
> Added: cfe/trunk/test/CodeGenObjC/debug-info-property-accessors.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-property-accessors.m?rev=183474&view=auto
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/debug-info-property-accessors.m (added)
> +++ cfe/trunk/test/CodeGenObjC/debug-info-property-accessors.m Thu Jun  6 20:10:45 2013
> @@ -0,0 +1,56 @@
> +// RUN: %clang_cc1 -emit-llvm -x objective-c -g -triple x86_64-apple-macosx10.8.0 %s -o - | FileCheck %s
> +//
> +// rdar://problem/14035789
> +//
> +// Ensure we emit the names of explicit/renamed accessors even if they
> +// are defined later in the implementation section.
> +//
> +// CHECK: metadata !{i32 {{.*}}, metadata !"blah", {{.*}} metadata !"isBlah", metadata !"", {{.*}}} ; [ DW_TAG_APPLE_property ] [blah]
> +
> + at class NSString;
> +extern void NSLog(NSString *format, ...);
> +typedef signed char BOOL;
> +
> +#define YES             ((BOOL)1)
> +#define NO              ((BOOL)0)
> +
> +typedef unsigned int NSUInteger;
> +
> + at protocol NSObject
> + at end
> +
> + at interface NSObject <NSObject>
> +- (id)init;
> ++ (id)alloc;
> + at end
> +
> + at interface Bar : NSObject
> + at property int normal_property;
> + at property (getter=isBlah, setter=setBlah:) BOOL blah;
> + at end
> +
> + at implementation Bar
> + at synthesize normal_property;
> +
> +- (BOOL) isBlah
> +{
> +  return YES;
> +}
> +- (void) setBlah: (BOOL) newBlah
> +{
> +  NSLog (@"Speak up, I didn't catch that.");
> +}
> + at end
> +
> +int
> +main ()
> +{
> +  Bar *my_bar = [[Bar alloc] init];
> +
> +  if (my_bar.blah)
> +    NSLog (@"It was true!!!");
> +
> +  my_bar.blah = NO;
> +
> +  return 0;
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list