[all-commits] [llvm/llvm-project] ec1171: [Coroutines] [Frontend] Lookup in std namespace first

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Wed Nov 3 20:54:13 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ec117158a390a0ebf64377caa5abd0c976df8f7a
      https://github.com/llvm/llvm-project/commit/ec117158a390a0ebf64377caa5abd0c976df8f7a
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2021-11-04 (Thu, 04 Nov 2021)

  Changed paths:
    M clang-tools-extra/test/clang-tidy/checkers/Inputs/readability-identifier-naming/system/coroutines.h
    M clang/docs/LanguageExtensions.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Frontend/InitPreprocessor.cpp
    M clang/lib/Sema/SemaCoroutine.cpp
    A clang/test/AST/Inputs/std-coroutine-exp-namespace.h
    M clang/test/AST/Inputs/std-coroutine.h
    A clang/test/AST/coroutine-locals-cleanup-exp-namespace.cpp
    M clang/test/AST/coroutine-locals-cleanup.cpp
    A clang/test/AST/coroutine-source-location-crash-exp-namespace.cpp
    M clang/test/AST/coroutine-source-location-crash.cpp
    M clang/test/Analysis/more-dtors-cfg-output.cpp
    M clang/test/CodeGenCXX/ubsan-coroutines.cpp
    A clang/test/CodeGenCoroutines/Inputs/coroutine-exp-namespace.h
    M clang/test/CodeGenCoroutines/Inputs/coroutine.h
    A clang/test/CodeGenCoroutines/coro-alloc-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-alloc.cpp
    A clang/test/CodeGenCoroutines/coro-always-inline-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-always-inline.cpp
    A clang/test/CodeGenCoroutines/coro-await-domination-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-await-domination.cpp
    A clang/test/CodeGenCoroutines/coro-await-exp-namespace.cpp
    A clang/test/CodeGenCoroutines/coro-await-resume-eh-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-await-resume-eh.cpp
    M clang/test/CodeGenCoroutines/coro-await.cpp
    A clang/test/CodeGenCoroutines/coro-cleanup-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-cleanup.cpp
    A clang/test/CodeGenCoroutines/coro-dest-slot-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-dest-slot.cpp
    A clang/test/CodeGenCoroutines/coro-dwarf-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-dwarf.cpp
    A clang/test/CodeGenCoroutines/coro-eh-cleanup-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-eh-cleanup.cpp
    A clang/test/CodeGenCoroutines/coro-gro-exp-namespace.cpp
    A clang/test/CodeGenCoroutines/coro-gro-nrvo-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-gro-nrvo.cpp
    M clang/test/CodeGenCoroutines/coro-gro.cpp
    A clang/test/CodeGenCoroutines/coro-lambda-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-lambda.cpp
    A clang/test/CodeGenCoroutines/coro-newpm-pipeline-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-newpm-pipeline.cpp
    A clang/test/CodeGenCoroutines/coro-params-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-params.cpp
    A clang/test/CodeGenCoroutines/coro-promise-dtor-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-promise-dtor.cpp
    A clang/test/CodeGenCoroutines/coro-ret-void-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-ret-void.cpp
    A clang/test/CodeGenCoroutines/coro-return-exp-namespace.cpp
    A clang/test/CodeGenCoroutines/coro-return-voidtype-initlist-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-return-voidtype-initlist.cpp
    M clang/test/CodeGenCoroutines/coro-return.cpp
    A clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-symmetric-transfer-01.cpp
    A clang/test/CodeGenCoroutines/coro-symmetric-transfer-02-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-symmetric-transfer-02.cpp
    A clang/test/CodeGenCoroutines/coro-unhandled-exception-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/coro-unhandled-exception.cpp
    A clang/test/CodeGenCoroutines/microsoft-abi-operator-coawait-exp-namespace.cpp
    M clang/test/CodeGenCoroutines/microsoft-abi-operator-coawait.cpp
    M clang/test/CoverageMapping/coroutine.cpp
    M clang/test/Index/coroutines.cpp
    M clang/test/Lexer/cxx-features.cpp
    M clang/test/PCH/coroutines.cpp
    A clang/test/SemaCXX/Inputs/std-coroutine-exp-namespace.h
    M clang/test/SemaCXX/Inputs/std-coroutine.h
    A clang/test/SemaCXX/co_await-range-for-exp-namespace.cpp
    M clang/test/SemaCXX/co_await-range-for.cpp
    A clang/test/SemaCXX/coreturn-eh-exp-namespace.cpp
    M clang/test/SemaCXX/coreturn-eh.cpp
    A clang/test/SemaCXX/coreturn-exp-namespace.cpp
    M clang/test/SemaCXX/coreturn.cpp
    M clang/test/SemaCXX/coroutine-builtins.cpp
    A clang/test/SemaCXX/coroutine-final-suspend-noexcept-exp-namespace.cpp
    M clang/test/SemaCXX/coroutine-final-suspend-noexcept.cpp
    A clang/test/SemaCXX/coroutine-mixed-exp-namespace.cpp
    A clang/test/SemaCXX/coroutine-mixed2-exp-namespace.cpp
    A clang/test/SemaCXX/coroutine-rvo-exp-namespace.cpp
    M clang/test/SemaCXX/coroutine-rvo.cpp
    A clang/test/SemaCXX/coroutine-seh-exp-namespace.cpp
    M clang/test/SemaCXX/coroutine-seh.cpp
    A clang/test/SemaCXX/coroutine-traits-undefined-template-exp-namespace.cpp
    M clang/test/SemaCXX/coroutine-traits-undefined-template.cpp
    A clang/test/SemaCXX/coroutine-unhandled_exception-warning-exp-namespace.cpp
    M clang/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
    A clang/test/SemaCXX/coroutine-uninitialized-warning-crash-exp-namespace.cpp
    M clang/test/SemaCXX/coroutine-uninitialized-warning-crash.cpp
    R clang/test/SemaCXX/coroutine_handle-addres-return-type.cpp
    A clang/test/SemaCXX/coroutine_handle-address-return-type-exp-namespace.cpp
    A clang/test/SemaCXX/coroutine_handle-address-return-type.cpp
    A clang/test/SemaCXX/coroutines-exp-namespace.cpp
    M clang/test/SemaCXX/coroutines.cpp
    M clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

  Log Message:
  -----------
  [Coroutines] [Frontend] Lookup in std namespace first

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.

This patch would make clang lookup coroutine_traits in std namespace
first. For the compatibility consideration, clang would lookup in
std::experimental namespace if it can't find definitions in std
namespace. So the existing codes wouldn't be break after update
compiler.

And in case the compiler found std::coroutine_traits and
std::experimental::coroutine_traits at the same time, it would emit an
error for it.

The support for looking up std::experimental::coroutine_traits would be
removed in Clang16.

Reviewed By: lxfind, Quuxplusone

Differential Revision: https://reviews.llvm.org/D108696




More information about the All-commits mailing list