[PATCH] D68108: Redeclare Objective-C property accessors inside the ObjCImplDecl in which they are synthesized.

Adrian Prantl via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 26 16:50:53 PDT 2019


aprantl created this revision.
aprantl added reviewers: rjmccall, dergachev.a, dcoughlin, theraven, ahatanak, erik.pilkington, davide.
Herald added subscribers: arphaman, dexonsmith.
Herald added a project: clang.
aprantl added a child revision: D66121: Debug Info: Nest Objective-C property function decls inside their container..

This patch is motivated by (and factored out from) https://reviews.llvm.org/D66121 which is a debug info bugfix. Starting with DWARF 5 all Objective-C methods are nested inside their containing type, and that patch implements this for synthesized Objective-C properties.

This patch became much longer than I hoped it would be but most of the changes are mechanical in nature.

1. SemaObjCProperty populates a list of synthesized accessors that may need to inserted into an ObjCImplDecl.
2. SemaDeclObjC::ActOnEnd inserts forward-declarations for all accessors for which no override was provided into their ObjCImplDecl. This patch does *not* synthesize AST function *bodies*. Moving that code from the static analyzer into Sema may be a good idea though.
3. Places that expect all methods to have bodies have been updated.

Most of the updates are very straightforward, the most irritating part was updating the static analyzer, there may be a more elegant way to do this.
I'm somewhat concerned that I didn't have to update the GNU Objective-C runtime for the testsuite to pass. I did not update the static analyzer's inliner for synthesized properties to point back to the property declaration (see test/Analysis/Inputs/expected-plists/nullability-notes.m.plist), which I believed to be more bug than a feature.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68108

Files:
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/DeclObjC.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/CodeGen/CGObjCMac.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Frontend/Rewrite/RewriteObjC.cpp
  clang/lib/Index/IndexDecl.cpp
  clang/lib/Sema/SemaDeclObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp
  clang/lib/StaticAnalyzer/Core/CallEvent.cpp
  clang/test/AST/ast-dump-decl-json.m
  clang/test/Analysis/Inputs/expected-plists/nullability-notes.m.plist
  clang/test/Analysis/properties.m
  clang/test/CodeGenObjC/debug-info-synthesis.m
  clang/test/CodeGenObjC/debug-property-synth.m
  clang/test/CodeGenObjC/debuginfo-properties.m
  clang/test/CodeGenObjC/instance-method-metadata.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68108.222047.patch
Type: text/x-patch
Size: 41968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190926/fb42134b/attachment-0001.bin>


More information about the cfe-commits mailing list