Page MenuHomePhabricator

[Coroutines] [libcxx] Move coroutine component out of experimental namespace
AbandonedPublic

Authored by ChuanqiXu on Aug 23 2021, 11:30 PM.

Details

Summary

Now in libcxx and clang, all the coroutine components are defined in std::experimental namespace.
And now the coroutine TS is merged into C++20. So in the working draft like N4892, we could find the coroutine components is defined in std namespace instead of std::experimental namespace. And the coroutine support in clang seems to be relatively stable. So I think it may be suitable to move the coroutine component into the experiment namespace now.

To make clang compatible with legacy uses, the use of coroutine in std::experimental namespace is remained.

Test Plan: check-all

Diff Detail

Unit TestsFailed

TimeTest
470 mslibcxx CI C++03 > libcxx-trunk-shared.libcxx/language_support/support_coroutines::dialect_support.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/36611c9e0ce3-1/llvm-project/libcxx-ci/libcxx/test/libcxx/language.support/support.coroutines/dialect_support.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/36611c9e0ce3-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/36611c9e0ce3-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++03 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -fcoroutines-ts -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/36611c9e0ce3-1/llvm-project/libcxx-ci/build/generic-cxx03/lib -lc++ -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/36611c9e0ce3-1/llvm-project/libcxx-ci/build/generic-cxx03/lib -pthread -o /home/libcxx-builder/.buildkite-agent/builds/36611c9e0ce3-1/llvm-project/libcxx-ci/build/generic-cxx03/projects/libcxx/libcxx/language.support/support.coroutines/Output/dialect_support.pass.cpp.dir/t.tmp.exe
540 mslibcxx CI C++11 > libcxx-trunk-shared.libcxx/language_support/support_coroutines::dialect_support.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/193e65cab1cb-1/llvm-project/libcxx-ci/libcxx/test/libcxx/language.support/support.coroutines/dialect_support.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/193e65cab1cb-1/llvm-project/libcxx-ci/build/generic-cxx11/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/193e65cab1cb-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++11 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -fcoroutines-ts -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/193e65cab1cb-1/llvm-project/libcxx-ci/build/generic-cxx11/lib -lc++ -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/193e65cab1cb-1/llvm-project/libcxx-ci/build/generic-cxx11/lib -pthread -o /home/libcxx-builder/.buildkite-agent/builds/193e65cab1cb-1/llvm-project/libcxx-ci/build/generic-cxx11/projects/libcxx/libcxx/language.support/support.coroutines/Output/dialect_support.pass.cpp.dir/t.tmp.exe
540 mslibcxx CI C++14 > libcxx-trunk-shared.libcxx/language_support/support_coroutines::dialect_support.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/libcxx/test/libcxx/language.support/support.coroutines/dialect_support.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++14 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -fcoroutines-ts -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/lib -lc++ -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/lib -pthread -o /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/projects/libcxx/libcxx/language.support/support.coroutines/Output/dialect_support.pass.cpp.dir/t.tmp.exe
570 mslibcxx CI C++14 > libcxx-trunk-shared.std/language_support/support_coroutines/coroutine_handle/coroutine_handle_prom::promise.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/libcxx/test/std/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++14 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -fcoroutines-ts -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/lib -lc++ -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/lib -pthread -o /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/projects/libcxx/std/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/Output/promise.pass.cpp.dir/t.tmp.exe
580 mslibcxx CI C++14 > libcxx-trunk-shared.std/language_support/support_coroutines/end_to_end::await_result.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/libcxx/test/std/language.support/support.coroutines/end.to.end/await_result.pass.cpp --target=x86_64-unknown-linux-gnu -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/libcxx/test/support -std=c++14 -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -fcoroutines-ts -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/lib -lc++ -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/lib -pthread -o /home/libcxx-builder/.buildkite-agent/builds/0bd1378d9eb9-1/llvm-project/libcxx-ci/build/generic-cxx14/projects/libcxx/std/language.support/support.coroutines/end.to.end/Output/await_result.pass.cpp.dir/t.tmp.exe
View Full Test Results (43 Failed)

Event Timeline

ChuanqiXu created this revision.Aug 23 2021, 11:30 PM
ChuanqiXu requested review of this revision.Aug 23 2021, 11:30 PM
ChuanqiXu updated this revision to Diff 368305.Aug 24 2021, 1:53 AM

fix tests in clang-tools-extra.

Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2021, 1:53 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I am not familiar with the process of when to move something out of experimental, but I do wonder how this is normally done so that people who uses coroutines can have a smooth migration?
I assume that this is going to be a breaking change that existing code using coroutine will need to be updated and no longer compatible with old versions.

ChuanqiXu updated this revision to Diff 368551.Aug 24 2021, 9:44 PM
ChuanqiXu edited the summary of this revision. (Show Details)
  • Make clang support looking up in std::experimental namespace.

I am not familiar with the process of when to move something out of experimental, but I do wonder how this is normally done so that people who uses coroutines can have a smooth migration?
I assume that this is going to be a breaking change that existing code using coroutine will need to be updated and no longer compatible with old versions.

Thanks for reporting this. Now the clang could still look up in std::experimental namespace of once it fails to look up in std namespace. So now it wouldn't be a break change if the user upgrade the version clang only.

Fix test: libcxx/utils/generate_header_tests.py

Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2021, 11:20 PM
ChuanqiXu abandoned this revision.Aug 25 2021, 5:41 AM

Oh, I find why the CI still fails. Since the compiler used to compile libcxx in the CI doesn't contain the change in this patch! So it would still lookup coroutine components in std::experimental namespace. So here are the failures. To avoid the problems, I had split this patch into D108696 and D108697, which contains the change in clang part and libcxx part respectively.