[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
Wed Jun 21 19:11:03 PDT 2017


rsmith created this revision.
Herald added subscribers: javed.absar, sanjoy.

Determining whether a declaration is visible or not requires knowledge of the context in which the question is asked: for instance, during template instantiation, additional modules might be visible, and with local submodule visibility, the set of visible declarations can shrink as well as grow throughout the compilation.

This patch explicitly passes an "is hidden" callback to all ObjC lookup functions on Decl rather than relying on the increasingly-inaccurate Hidden bit to provide useful information. (Ideally, these lookup functions would be moved to Sema instead; that change can follow if it makes sense.)

Please pay particular attention to the places where `AllDeclsVisible` is passed: in those places, we do not have any local visibility context. Possibly some of them should be doing something more subtle than ignoring module visibility rules.

The test from PR33552 does /not/ pass with this change, I'm still digging into what else might be wrong here.


Repository:
  rL LLVM

https://reviews.llvm.org/D34494

Files:
  include/clang/AST/DeclObjC.h
  include/clang/Sema/Sema.h
  lib/ARCMigrate/ObjCMT.cpp
  lib/AST/ASTContext.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/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/SemaPseudoObject.cpp
  lib/Sema/SemaStmt.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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34494.103510.patch
Type: text/x-patch
Size: 97671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170622/e7fc64f2/attachment-0001.bin>


More information about the cfe-commits mailing list