<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - `-fmodules-local-submodule-visibility` does not work correctly with Objective-C"
   href="https://bugs.llvm.org/show_bug.cgi?id=46248">46248</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>`-fmodules-local-submodule-visibility` does not work correctly with Objective-C
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mboehme@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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:
<a href="https://github.com/llvm/llvm-project/commit/90dc5254725e32c0fab65213c554b689a2a0bbbf">https://github.com/llvm/llvm-project/commit/90dc5254725e32c0fab65213c554b689a2a0bbbf</a>

Also note this in-review change, which changes the name of Decl::isHidden() to
more accurately reflect what it does:
<a href="https://reviews.llvm.org/D81392">https://reviews.llvm.org/D81392</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>