https://bugs.llvm.org/show_bug.cgi?id=46248
Bug ID: 46248
Summary: `-fmodules-local-submodule-visibility` does not work
correctly with Objective-C
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: mboe...@google.com
CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
richard-l...@metafoo.co.uk
Multiple places in AST/DeclObjC.{h,cpp} and Sema/SemaDeclObjC.cpp use
Decl::isHidden() instead of Sema::isVisible().
These two methods are equivalent only if -fmodules-local-submodule-visibility
is not turned on.
If -fmodules-local-submodule-visibility is turned on, Decl::isHidden() can
return true for declarations that have been made visible by importing the
(sub)module that owns them. (See also the FIXME in the comment for
Decl::isHidden().) As a result, the Objective-C code using Decl::isHidden()
will falsely assume that such declarations are hidden when in fact they are
visible.
For examples of how this causes wrong behavior, witness how adding the
-fmodules-local-submodule-visibility option to tests objc-categories.m,
objc-category-2.m and objc-category-3.m in test/Modules causes these tests to
fail.
Fixing this in Sema/SemaDeclObjC.cpp is easy, as Decl::isHidden() can simply be
replaced by Sema::isVisible().
Fixing this in AST/DeclObjC.{h,cpp} is more difficult as AST is not allowed to
depend on Sema. As a result, the functions in question and all of their callers
need to be moved to Sema. From what I have seen, this is a non-trivial
undertaking.
For more context, see also description on this change:
https://github.com/llvm/llvm-project/commit/90dc5254725e32c0fab65213c554b689a2a0bbbf
Also note this in-review change, which changes the name of Decl::isHidden() to
more accurately reflect what it does:
https://reviews.llvm.org/D81392
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs