[clang] [clang-format] Allow custom pointer/ref alignment in return types (PR #169160)

via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 22 03:14:42 PST 2025


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 36222 tests passed
* 495 tests skipped

All tests passed but another part of the build **failed**. Click on a failure below to see the details.

<details>
<summary>tools/clang/unittests/Format/CMakeFiles/FormatTests.dir/FormatTest.cpp.o</summary>

```
FAILED: tools/clang/unittests/Format/CMakeFiles/FormatTests.dir/FormatTest.cpp.o
sccache /opt/llvm/bin/clang++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/unittests/Format -I/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format -I/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/build/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googletest/include -I/home/gha/actions-runner/_work/llvm-project/llvm-project/third-party/unittest/googlemock/include -gmlt -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT tools/clang/unittests/Format/CMakeFiles/FormatTests.dir/FormatTest.cpp.o -MF tools/clang/unittests/Format/CMakeFiles/FormatTests.dir/FormatTest.cpp.o.d -o tools/clang/unittests/Format/CMakeFiles/FormatTests.dir/FormatTest.cpp.o -c /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:2051:76: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
2051 |                                         {/*Default=*/FormatStyle::PAS_Right}));
|                                                                            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:2054:54: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
2054 |                 {/*Default=*/FormatStyle::RAS_Pointer}));
|                                                      ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:2110:62: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
2110 |   Style.PointerAlignment = {/*Default=*/FormatStyle::PAS_Left};
|                                                              ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:2168:63: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
2168 |   Style.PointerAlignment = {/*Default=*/FormatStyle::PAS_Right};
|                                                               ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:2169:64: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
2169 |   Style.ReferenceAlignment = {/*Default=*/FormatStyle::RAS_Left};
|                                                                ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:2206:62: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
2206 |   Style.PointerAlignment = {/*Default=*/FormatStyle::PAS_Left};
|                                                              ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:2207:66: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
2207 |   Style.ReferenceAlignment = {/*Default=*/FormatStyle::RAS_Middle};
|                                                                  ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:2259:64: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
2259 |   Style.PointerAlignment = {/*Default=*/FormatStyle::PAS_Middle};
|                                                                ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:2260:65: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
2260 |   Style.ReferenceAlignment = {/*Default=*/FormatStyle::RAS_Right};
|                                                                 ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:2502:66: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
2502 |   AlignLeft.PointerAlignment = {/*Default=*/FormatStyle::PAS_Left};
|                                                                  ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:8764:62: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
8764 |   Style.PointerAlignment = {/*Default=*/FormatStyle::PAS_Left};
|                                                              ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:10101:62: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
10101 |   Style.PointerAlignment = {/*Default=*/FormatStyle::PAS_Left};
|                                                              ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:11664:69: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
11664 |   PASLeftStyle.PointerAlignment = {/*Default=*/FormatStyle::PAS_Left};
|                                                                     ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:11792:66: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
11792 |   AlignLeft.PointerAlignment = {/*Default=*/FormatStyle::PAS_Left};
|                                                                  ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:11824:70: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
11824 |   AlignMiddle.PointerAlignment = {/*Default=*/FormatStyle::PAS_Middle};
|                                                                      ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:11907:79: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
11907 |   AlignLeftBreakTemplate.PointerAlignment = {/*Default=*/FormatStyle::PAS_Left};
|                                                                               ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:11992:76: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
11992 |                                         {/*Default=*/FormatStyle::PAS_Right}));
|                                                                            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:11998:62: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
11998 |   Style.PointerAlignment = {/*Default=*/FormatStyle::PAS_Left};
|                                                              ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/Format/FormatTest.cpp:12004:64: error: missing field 'ReturnType' initializer [-Werror,-Wmissing-field-initializers]
12004 |   Style.PointerAlignment = {/*Default=*/FormatStyle::PAS_Middle};
|                                                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/169160


More information about the cfe-commits mailing list