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

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


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 3182 tests passed
* 32 tests skipped

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

<details>
<summary>[code=1] tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/CheckLifetimeEndTest.cpp.obj</summary>

```
FAILED: [code=1] tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/StaticAnalyzer/CheckLifetimeEndTest.cpp.obj
sccache C:\clang\clang-msvc\bin\clang-cl.exe  /nologo -TP -DCLANG_BUILD_STATIC -DLLVM_BUILD_STATIC -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GLIBCXX_ASSERTIONS -D_HAS_EXCEPTIONS=0 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IC:\_work\llvm-project\llvm-project\build\tools\clang\unittests -IC:\_work\llvm-project\llvm-project\clang\unittests -IC:\_work\llvm-project\llvm-project\clang\include -IC:\_work\llvm-project\llvm-project\build\tools\clang\include -IC:\_work\llvm-project\llvm-project\build\include -IC:\_work\llvm-project\llvm-project\llvm\include -IC:\_work\llvm-project\llvm-project\clang\unittests\Tooling -IC:\_work\llvm-project\llvm-project\third-party\unittest\googletest\include -IC:\_work\llvm-project\llvm-project\third-party\unittest\googlemock\include /DWIN32 /D_WINDOWS   /Zc:inline /Zc:__cplusplus /Oi /Brepro /bigobj /permissive- -Werror=unguarded-availability-new /W4  -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -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 /Gw /O2 /Ob2  -std:c++17 -MD -UNDEBUG -Wno-gnu-zero-variadic-macro-arguments /EHs-c- /GR- -Wno-suggest-override /showIncludes /Fotools\clang\unittests\CMakeFiles\AllClangUnitTests.dir\StaticAnalyzer\CheckLifetimeEndTest.cpp.obj /Fdtools\clang\unittests\CMakeFiles\AllClangUnitTests.dir\ -c -- C:\_work\llvm-project\llvm-project\clang\unittests\StaticAnalyzer\CheckLifetimeEndTest.cpp
C:\_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
C:\_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) {
|                             ^
C:\_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);
|               ^~~~~~~~~~~
C:\_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;
|   ^     ~~~~~~~~~~~~~
C:\_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) {
|                ^     ~~~~~~~~~~~~~~~
C:\_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;
|                ^     ~~~~~~~~~~~~~~
C:\_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, char_traits<char>, allocator<char>> &') for 1st argument
272 |   /*implicit*/ Twine(const std::string &Str) : LHSKind(StdStringKind) {
|                ^     ~~~~~~~~~~~~~~~~~~~~~~
C:\_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) {
|                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\_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) {
|                ^     ~~~~~~~~~~~~~
C:\_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) {
|                ^     ~~~~~~~~~~~~~~~~~~~~~~~~
C:\_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)
|                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\_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)
|                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\_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) {
|            ^
C:\_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; }
|            ^
C:\_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) {
|            ^
C:\_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) {
|            ^
C:\_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; }
|            ^
C:\_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; }
|            ^
C:\_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; }
|            ^
C:\_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; }
|            ^
C:\_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) {
|            ^
C:\_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; }
|            ^
C:\_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 C:\_work\llvm-project\llvm-project\clang\unittests\StaticAnalyzer\CheckLifetimeEndTest.cpp:9:
In file included from C:\_work\llvm-project\llvm-project\clang\unittests\StaticAnalyzer\CheckerRegistration.h:9:
In file included from C:\_work\llvm-project\llvm-project\clang\include\clang/Analysis/PathDiagnostic.h:16:
In file included from C:\_work\llvm-project\llvm-project\clang\include\clang/AST/Stmt.h:26:
In file included from C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/LangOptions.h:27:
In file included from C:\_work\llvm-project\llvm-project\llvm\include\llvm/BinaryFormat/DXContainer.h:20:
In file included from C:\_work\llvm-project\llvm-project\llvm\include\llvm/Support/Error.h:23:
C:\_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>> && ...),
|          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\_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...);
|          ^
C:\_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 C:\_work\llvm-project\llvm-project\clang\unittests\StaticAnalyzer\CheckLifetimeEndTest.cpp:9:
In file included from C:\_work\llvm-project\llvm-project\clang\unittests\StaticAnalyzer\CheckerRegistration.h:9:
In file included from C:\_work\llvm-project\llvm-project\clang\include\clang/Analysis/PathDiagnostic.h:16:
In file included from C:\_work\llvm-project\llvm-project\clang\include\clang/AST/Stmt.h:26:
In file included from C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/LangOptions.h:27:
In file included from C:\_work\llvm-project\llvm-project\llvm\include\llvm/BinaryFormat/DXContainer.h:20:
In file included from C:\_work\llvm-project\llvm-project\llvm\include\llvm/Support/Error.h:23:
C:\_work\llvm-project\llvm-project\llvm\include\llvm/Support/Format.h(100,47): error: cannot pass object of non-trivial type 'const tuple_element_t<0ULL, 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]
100 |     return _snprintf(Buffer, BufferSize, Fmt, std::get<Is>(Vals)...);
|                                               ^
C:\_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<0ULL, 1ULL>' requested here
115 |     return snprint_tuple(Buffer, BufferSize, std::index_sequence_for<Ts...>());
|            ^
C:\_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