]> granicus.if.org Git - clang/commit
Fix debug info for Objective-C properties from class extensions after r251874
authorNico Weber <nicolasweber@gmx.de>
Fri, 4 Dec 2015 19:14:14 +0000 (19:14 +0000)
committerNico Weber <nicolasweber@gmx.de>
Fri, 4 Dec 2015 19:14:14 +0000 (19:14 +0000)
commitd2a090fb5a00dd4108f7d7d84b512b2da915bfe2
tree1168767059a67e23053011c8feaaf516b98e79ba
parent132b9a7946c9e0b1ff20374751f1b865a3f7a91f
Fix debug info for Objective-C properties from class extensions after r251874

After r251874, properties from class extensions no longer show up in
ObjCInterfaceDecl::properties().  Make debug info emission explicitly
look for properties in class extensions before looking at direct properties.

Also add a test that checks for this.  There are three interesting cases:

1. A property is only declared in a class extension, and the @implementation
   is in a different file.  This used to generated a DIObjcProperty before
   r251874 and does again with this fix.

2. A property is declared as readonly in the class itself and redeclared as
   readwrite in a class extension. clang before r251874 put the DIObjcProperty
   on the first declaration. clang after r251874 didn't emit any DIObjcProperty,
   and clang with this fix puts it on the readwrite redeclaration (which is
   what lookup finds).  This seems like a progression.

3. Like 2, but with an @implementation in the same file.  In this case,
   the property debug info gets generated a second time through the ivar
   from the definition.  In this case, lookup and declaration code need
   to agree on the line number so that the DIObjcProperty isn't emitted
   twice.  In this case, clang before r251874 emitted one DIObjcProperty
   on the first declaration, clang with r251874 emitted one on the second
   declaration, and clang with this patch still does the latter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254750 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGDebugInfo.cpp
test/CodeGenObjC/debug-info-property-class-extension.m [new file with mode: 0644]