[clang] [analyzer] Trigger checkLifetimeEnd callback from CFGLifetimeEnds element (PR #201123)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 5 09:13:06 PDT 2026


github-actions[bot] wrote:

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

* 36991 tests passed
* 578 tests skipped

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

<details>
<summary>tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/CheckLifetimeEndTest.cpp.o</summary>

```
FAILED: tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/CheckLifetimeEndTest.cpp.o
sccache /opt/llvm/bin/clang++ -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -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 -I/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests -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/clang/unittests/Tooling -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 -UNDEBUG -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -Wno-suggest-override -MD -MT tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/CheckLifetimeEndTest.cpp.o -MF tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/CheckLifetimeEndTest.cpp.o.d -o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/CheckLifetimeEndTest.cpp.o -c /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/StaticAnalyzer/CheckLifetimeEndTest.cpp
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/StaticAnalyzer/CheckLifetimeEndTest.cpp:51:30: error: no member named 'formatv' in namespace 'llvm'; did you mean 'format'?
51 |     auto Description = llvm::formatv("{0} LIFETIME END {1}",
|                              ^~~~~~~
|                              format
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Format.h:129:29: note: 'format' declared here
129 | inline format_object<Ts...> format(const char *Fmt, const Ts &... Vals) {
|                             ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/StaticAnalyzer/CheckLifetimeEndTest.cpp:53:15: error: no viable conversion from 'format_object<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>' to 'const Twine'
53 |     report(C, Description, State);
|               ^~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:250:3: note: candidate constructor not viable: no known conversion from 'format_object<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>' to 'const Twine &' for 1st argument
250 |   Twine(const Twine &) = default;
|   ^     ~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:257:16: note: candidate constructor not viable: no known conversion from 'format_object<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>' to 'const char *' for 1st argument
257 |   /*implicit*/ Twine(const char *Str) {
|                ^     ~~~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:269:16: note: candidate constructor not viable: no known conversion from 'format_object<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>' to 'std::nullptr_t' for 1st argument
269 |   /*implicit*/ Twine(std::nullptr_t) = delete;
|                ^     ~~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:272:16: note: candidate constructor not viable: no known conversion from 'format_object<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>' to 'const std::string &' (aka 'const basic_string<char> &') for 1st argument
272 |   /*implicit*/ Twine(const std::string &Str) : LHSKind(StdStringKind) {
|                ^     ~~~~~~~~~~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:281:16: note: candidate constructor not viable: no known conversion from 'format_object<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>' to 'const std::string_view &' (aka 'const basic_string_view<char> &') for 1st argument
281 |   /*implicit*/ Twine(const std::string_view &Str) : LHSKind(PtrAndLengthKind) {
|                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:288:16: note: candidate constructor not viable: no known conversion from 'format_object<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>' to 'StringRef' for 1st argument
288 |   /*implicit*/ Twine(StringRef Str) : LHSKind(PtrAndLengthKind) {
|                ^     ~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:295:16: note: candidate constructor not viable: no known conversion from 'format_object<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>' to 'const StringLiteral &' for 1st argument
295 |   /*implicit*/ Twine(const StringLiteral &Str) : LHSKind(StringLiteralKind) {
|                ^     ~~~~~~~~~~~~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:302:16: note: candidate constructor not viable: no known conversion from 'format_object<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>' to 'const SmallVectorImpl<char> &' for 1st argument
302 |   /*implicit*/ Twine(const SmallVectorImpl<char> &Str)
|                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:310:16: note: candidate constructor not viable: no known conversion from 'format_object<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>' to 'const formatv_object_base &' for 1st argument
310 |   /*implicit*/ Twine(const formatv_object_base &Fmt)
|                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:172:12: note: explicit constructor is not a candidate
172 |   explicit Twine(NodeKind Kind) : LHSKind(Kind) {
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:317:12: note: explicit constructor is not a candidate
317 |   explicit Twine(char Val) : LHSKind(CharKind) { LHS.character = Val; }
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:320:12: note: explicit constructor is not a candidate
320 |   explicit Twine(signed char Val) : LHSKind(CharKind) {
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:325:12: note: explicit constructor is not a candidate
325 |   explicit Twine(unsigned char Val) : LHSKind(CharKind) {
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:330:12: note: explicit constructor is not a candidate
330 |   explicit Twine(unsigned Val) : LHSKind(DecUIKind) { LHS.decUI = Val; }
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:333:12: note: explicit constructor is not a candidate
333 |   explicit Twine(int Val) : LHSKind(DecIKind) { LHS.decI = Val; }
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:336:12: note: explicit constructor is not a candidate
336 |   explicit Twine(unsigned long Val) : LHSKind(DecULKind) { LHS.decUL = Val; }
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:339:12: note: explicit constructor is not a candidate
339 |   explicit Twine(long Val) : LHSKind(DecLKind) { LHS.decL = Val; }
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:342:12: note: explicit constructor is not a candidate
342 |   explicit Twine(unsigned long long Val) : LHSKind(DecULLKind) {
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/Twine.h:347:12: note: explicit constructor is not a candidate
347 |   explicit Twine(long long Val) : LHSKind(DecLLKind) { LHS.decLL = Val; }
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/StaticAnalyzer/CheckLifetimeEndTest.cpp:33:47: note: passing argument to parameter 'Description' here
33 |   bool report(CheckerContext &C, const Twine &Description,
|                                               ^
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/StaticAnalyzer/CheckLifetimeEndTest.cpp:9:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/StaticAnalyzer/CheckerRegistration.h:9:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/Analysis/PathDiagnostic.h:16:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/Stmt.h:26:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/Basic/LangOptions.h:27:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/BinaryFormat/DXContainer.h:20:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Error.h:23:
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Format.h:110:10: error: static assertion failed due to requirement 'std::is_scalar_v<std::basic_string<char, std::char_traits<char>, std::allocator<char>>>': format can't be used with non fundamental / non pointer type
110 |         (std::is_scalar_v<detail::decay_if_c_char_array_t<Ts>> && ...),
|          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Format.h:130:10: note: in instantiation of member function 'llvm::format_object<std::basic_string<char>, unsigned int>::format_object' requested here
130 |   return format_object<Ts...>(Fmt, Vals...);
|          ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/StaticAnalyzer/CheckLifetimeEndTest.cpp:51:30: note: in instantiation of function template specialization 'llvm::format<std::basic_string<char>, unsigned int>' requested here
51 |     auto Description = llvm::formatv("{0} LIFETIME END {1}",
|                              ^
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/StaticAnalyzer/CheckLifetimeEndTest.cpp:9:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/StaticAnalyzer/CheckerRegistration.h:9:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/Analysis/PathDiagnostic.h:16:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/Stmt.h:26:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/Basic/LangOptions.h:27:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/BinaryFormat/DXContainer.h:20:
In file included from /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Error.h:23:
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Format.h:102:46: error: cannot pass object of non-trivial type 'const __tuple_element_t<0UL, tuple<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned int>>' (aka 'const std::basic_string<char>') through variadic function; call will abort at runtime [-Wnon-pod-varargs]
102 |     return snprintf(Buffer, BufferSize, Fmt, std::get<Is>(Vals)...);
|                                              ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/Support/Format.h:115:12: note: in instantiation of function template specialization 'llvm::format_object<std::basic_string<char>, unsigned int>::snprint_tuple<0UL, 1UL>' requested here
115 |     return snprint_tuple(Buffer, BufferSize, std::index_sequence_for<Ts...>());
|            ^
/home/gha/actions-runner/_work/llvm-project/llvm-project/clang/unittests/StaticAnalyzer/CheckLifetimeEndTest.cpp:51:24: note: in instantiation of member function 'llvm::format_object<std::basic_string<char>, unsigned int>::snprint' requested here
51 |     auto Description = llvm::formatv("{0} LIFETIME END {1}",
|                        ^
4 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/201123


More information about the cfe-commits mailing list