[libcxx-commits] [PATCH] D150885: [libc++] Fix issue with std::map::find in Objective-C++ with modules

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 19 13:56:48 PDT 2023


This revision was automatically updated to reflect the committed changes.
ldionne marked an inline comment as done.
Closed by commit rGe89bdc6bd714: [libc++] Fix issue with std::map::find in Objective-C++ with modules (authored by ldionne).

Changed prior to commit:
  https://reviews.llvm.org/D150885?vs=523541&id=523930#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150885/new/

https://reviews.llvm.org/D150885

Files:
  libcxx/include/module.modulemap.in
  libcxx/test/libcxx/containers/associative/map/find.modules.compile.pass.mm


Index: libcxx/test/libcxx/containers/associative/map/find.modules.compile.pass.mm
===================================================================
--- /dev/null
+++ libcxx/test/libcxx/containers/associative/map/find.modules.compile.pass.mm
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Make sure that we don't get a compiler error when trying to use std::map::find
+// from Objective-C++. This happened in Objective-C++ mode with modules enabled (rdar://106813461).
+
+// REQUIRES: objective-c++
+
+#include <map>
+
+void f(std::map<int, int> const& map, int key) {
+    (void)map.find(key);
+}
Index: libcxx/include/module.modulemap.in
===================================================================
--- libcxx/include/module.modulemap.in
+++ libcxx/include/module.modulemap.in
@@ -847,18 +847,6 @@
       module condition_variable { private header "__condition_variable/condition_variable.h" }
     }
   }
-  module coroutine {
-    header "coroutine"
-    export compare
-    export *
-
-    module __coroutine {
-      module coroutine_handle           { private header "__coroutine/coroutine_handle.h" }
-      module coroutine_traits           { private header "__coroutine/coroutine_traits.h" }
-      module noop_coroutine_handle      { private header "__coroutine/noop_coroutine_handle.h" }
-      module trivial_awaitables         { private header "__coroutine/trivial_awaitables.h" }
-    }
-  }
   module deque {
     header "deque"
     export initializer_list
@@ -1799,6 +1787,20 @@
   module __undef_macros      {         header "__undef_macros"      export * }
   module __verbose_abort     {         header "__verbose_abort"     export * }
 
+  // This one needs to appear after __tree to work around issues with modules in Objective-C++ mode.
+  module coroutine {
+    header "coroutine"
+    export compare
+    export *
+
+    module __coroutine {
+      module coroutine_handle           { private header "__coroutine/coroutine_handle.h" }
+      module coroutine_traits           { private header "__coroutine/coroutine_traits.h" }
+      module noop_coroutine_handle      { private header "__coroutine/noop_coroutine_handle.h" }
+      module trivial_awaitables         { private header "__coroutine/trivial_awaitables.h" }
+    }
+  }
+
   module experimental {
     requires cplusplus11
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150885.523930.patch
Type: text/x-patch
Size: 2675 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230519/7872d67b/attachment.bin>


More information about the libcxx-commits mailing list