diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst --- a/clang/docs/ClangCommandLineReference.rst +++ b/clang/docs/ClangCommandLineReference.rst @@ -1418,6 +1418,10 @@ Enable support for the C++ Coroutines TS +.. option:: -fcoroutines-aligned-alloc, -fno-coroutines-aligned-alloc + +Enable support for using aligned allocation/deallocation for the C++ Coroutines TS + .. option:: -fcoverage-mapping, -fno-coverage-mapping Generate coverage mapping to enable code coverage analysis diff --git a/clang/include/clang/Basic/Builtins.def b/clang/include/clang/Basic/Builtins.def --- a/clang/include/clang/Basic/Builtins.def +++ b/clang/include/clang/Basic/Builtins.def @@ -1583,6 +1583,7 @@ BUILTIN(__builtin_coro_promise, "v*v*IiIb", "n") BUILTIN(__builtin_coro_size, "z", "n") +BUILTIN(__builtin_coro_align, "z", "n") BUILTIN(__builtin_coro_frame, "v*", "n") BUILTIN(__builtin_coro_noop, "v*", "n") BUILTIN(__builtin_coro_free, "v*v*", "n") diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def --- a/clang/include/clang/Basic/LangOptions.def +++ b/clang/include/clang/Basic/LangOptions.def @@ -145,6 +145,7 @@ LANGOPT(NoMathBuiltin , 1, 0, "disable math builtin functions") LANGOPT(GNUAsm , 1, 1, "GNU-style inline assembly") LANGOPT(Coroutines , 1, 0, "C++20 coroutines") +LANGOPT(CoroutinesAlignedAlloc, 1, 0, "C++20 coroutines aligned allocation") LANGOPT(DllExportInlines , 1, 1, "dllexported classes dllexport inline methods") LANGOPT(RelaxedTemplateTemplateArgs, 1, 0, "C++17 relaxed matching of template template arguments") diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1105,6 +1105,10 @@ LangOpts<"Coroutines">, Default, PosFlag, NegFlag>; +defm coroutines_aligned_alloc : BoolFOption<"coroutines-aligned-alloc", + LangOpts<"CoroutinesAlignedAlloc">, DefaultFalse, + PosFlag, + NegFlag>; def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">, Group, Flags<[NoXarchOption, CC1Option, CC1AsOption]>, MetaVarName<"