[llvm-branch-commits] [clang] [analyzer] Correctly highlight the variables' range in UseAfterLifetimeEnd reports (PR #215905)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 14 02:48:18 PDT 2026


github-actions[bot] wrote:

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

* 90781 tests passed
* 1780 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Clang
<details>
<summary>Clang.Analysis/lifetime-bound.cpp</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,alpha.cplusplus.UseAfterLifetimeEnd,debug.DebugLifetimeModeling    -analyzer-config cfg-lifetime=true -analyzer-output=text -verify /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,alpha.cplusplus.UseAfterLifetimeEnd,debug.DebugLifetimeModeling -analyzer-config cfg-lifetime=true -analyzer-output=text -verify /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp
# note: command had no output on stdout or stderr
# RUN: at line 3
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,alpha.cplusplus.UseAfterLifetimeEnd,debug.DebugLifetimeModeling    -analyzer-output=text /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp 2>&1 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --strict-whitespace /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -analyze -setup-static-analyzer -analyzer-checker=core,alpha.cplusplus.UseAfterLifetimeEnd,debug.DebugLifetimeModeling -analyzer-output=text /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --strict-whitespace /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp:470:17: error: CHECK-NEXT: expected string not found in input
# |   // CHECK-NEXT:{{\|   ~~~~~~~~~$}}
# |                 ^
# | <stdin>:533:28: note: scanning from here
# |   455 |   int j = 4, k = 5;
# |                            ^
# | <stdin>:545:7: note: possible intended match here
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |       ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           528:       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
# |           529: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp:455:7: note: 'j' initialized here 
# |           530:   455 |   int j = 4, k = 5; 
# |           531:       |       ^ 
# |           532: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp:458:33: note: Value's lifetime bound to the lifetime of 'j' here 
# |           533:   455 |   int j = 4, k = 5; 
# | next:470'0                               {   search range start (exclusive)
# | next:470'1                                   error: no match found in search range
# |           534:       |       ~ 
# |           535:   456 |   // expected-note at -1 {{'j' initialized here}} 
# |           536:   457 |   // expected-note at -2 {{'k' initialized here}} 
# |           537:   458 |   return multi_params_annotated(&j, &k); 
# |           538:       |                                 ^~ 
# |           539: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp:458:3: note: Lifetime of 'j' ended here 
# |           540:   455 |   int j = 4, k = 5; 
# |           541:       |       ~ 
# |           542:   456 |   // expected-note at -1 {{'j' initialized here}} 
# |           543:   457 |   // expected-note at -2 {{'k' initialized here}} 
# |           544:   458 |   return multi_params_annotated(&j, &k); 
# |           545:       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
# | next:470'2           ?                                           possible intended match
# |           546: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/lifetime-bound.cpp:458:3: warning: Returning value bound to 'k' that will go out of scope [alpha.cplusplus.UseAfterLifetimeEnd] 
# |           547:   455 |   int j = 4, k = 5; 
# |           548:       |              ~ 
# |           549:   456 |   // expected-note at -1 {{'j' initialized here}} 
# |           550:   457 |   // expected-note at -2 {{'k' initialized here}} 
# |             .
# |             .
# |             .
# |           565:       |              ~ 
# |           566:   456 |   // expected-note at -1 {{'j' initialized here}} 
# |           567:   457 |   // expected-note at -2 {{'k' initialized here}} 
# |           568:   458 |   return multi_params_annotated(&j, &k); 
# |           569:       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
# |           570: 50 warnings generated. 
# | next:470'3                            } search range end (exclusive)
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</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/215905


More information about the llvm-branch-commits mailing list