[PATCH] D34494: fix determination of whether declarations are visible during ObjC lookups

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 22 18:17:01 PDT 2017


rsmith updated this revision to Diff 103678.
rsmith added a comment.

The remaining missing pieces were `ObjCInterfaceDecl::visible_categories` and `ObjCInterfaceDecl::visible_extensions`. The new revision of the patch gets a bit further down the road of passing through real visibility information into those, but that approach seems to snowball out of control. For example, `ASTContext::mergeTypes` now needs visibility information in order to determine whether two ObjC object types are compatible (because this depends on whether the types have compatible sets of protocols, which in turn can vary depending on which categories are visible for those two types). I have not completed this patch: there are still a lot of places that an IsHiddenFunction would need to be plumbed through to make this work.

The fact that type compatibility can vary depending on the context in which you ask seems like a significant design issue with ObjC categories; perhaps a modest and reasonable change to the language (and particularly the interaction between modules and categories) could avoid at least some of this implementation complexity, but I'm not the right person to design or champion such a change.


Repository:
  rL LLVM

https://reviews.llvm.org/D34494

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/DeclObjC.h
  include/clang/Sema/Sema.h
  lib/ARCMigrate/ObjCMT.cpp
  lib/AST/ASTContext.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/DeclObjC.cpp
  lib/Analysis/BodyFarm.cpp
  lib/Analysis/CallGraph.cpp
  lib/CodeGen/CGObjCMac.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/Edit/RewriteObjCFoundationAPI.cpp
  lib/Frontend/Rewrite/RewriteModernObjC.cpp
  lib/Index/IndexDecl.cpp
  lib/Sema/ScopeInfo.cpp
  lib/Sema/SemaCodeComplete.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclObjC.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprMember.cpp
  lib/Sema/SemaExprObjC.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaObjCProperty.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Sema/SemaStmt.cpp
  lib/Sema/SemaType.cpp
  lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp
  lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
  lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
  lib/StaticAnalyzer/Checkers/ObjCPropertyChecker.cpp
  lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
  lib/StaticAnalyzer/Core/CallEvent.cpp
  test/Modules/interface-visibility.m
  tools/libclang/CIndex.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34494.103678.patch
Type: text/x-patch
Size: 158983 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170623/0c539d91/attachment-0001.bin>


More information about the cfe-commits mailing list