[PATCH] D33366: Fix that global delete operator get's assigned to a submodule.

Richard Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 23 12:46:41 PDT 2017


rsmith added inline comments.


================
Comment at: lib/Sema/SemaExprCXX.cpp:2661-2669
+    // If we're in local visibility mode, we reuse this allocation function
+    // in all submodules of the current module. To make sure that the other
+    // submodules can lookup this function, we unhide it and make sure it's
+    // not owned by the current submodule.
+    if (getLangOpts().ModulesLocalVisibility &&
+        !getLangOpts().CurrentModule.empty()) {
+      Alloc->setLocalOwningModule(nullptr);
----------------
Let's just unconditionally `setHidden(false)` and leave the owning module alone.

(On reflection, changing the owning module is problematic because we'll assert if the declaration is not already marked as hidden, which the above checks are not sufficient to ensure, and it doesn't seem necessary, since the owning module doesn't have any visibility impact if the declaration is not hidden.)

I'd also prefer to not restrict this to local visibility mode / to the case where we have a current module if we don't need to (and as far as I can tell, we shouldn't need to do so).


https://reviews.llvm.org/D33366





More information about the cfe-commits mailing list