[llvm-branch-commits] [clang] [clang] Use uniform lifetime bounds under exceptions (PR #175817)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 13 11:58:42 PST 2026


github-actions[bot] wrote:

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

* 51841 tests passed
* 902 tests skipped
* 2 tests failed

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

### Clang
<details>
<summary>Clang.CodeGen/lifetime-bug-2.c</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\clang.exe -cc1 -internal-isystem C:\_work\llvm-project\llvm-project\build\lib\clang\23\include -nostdsysteminc -O2 -emit-llvm -disable-llvm-passes C:\_work\llvm-project\llvm-project\clang\test\CodeGen\lifetime-bug-2.c -o - | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\clang\test\CodeGen\lifetime-bug-2.c
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\clang.exe' -cc1 -internal-isystem 'C:\_work\llvm-project\llvm-project\build\lib\clang\23\include' -nostdsysteminc -O2 -emit-llvm -disable-llvm-passes 'C:\_work\llvm-project\llvm-project\clang\test\CodeGen\lifetime-bug-2.c' -o -
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\lifetime-bug-2.c:52:58: warning: passing arguments to 'bch2_btree_iter_peek_max' without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]
# |    52 |     bch2_trans_update_extent_k = bch2_btree_iter_peek_max((0, __trans_tmp_85));
# |       |                                                          ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\lifetime-bug-2.c:57:1: warning: label at end of compound statement is a C23 extension [-Wc23-extensions]
# |    57 | }
# |       | ^
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\lifetime-bug-2.c:52:60: warning: left operand of comma operator has no effect [-Wunused-value]
# |    52 |     bch2_trans_update_extent_k = bch2_btree_iter_peek_max((0, __trans_tmp_85));
# |       |                                                            ^
# | 3 warnings generated.
# `-----------------------------
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\clang\test\CodeGen\lifetime-bug-2.c'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\clang\test\CodeGen\lifetime-bug-2.c:16:16: error: CHECK-NEXT: expected string not found in input
# | // CHECK-NEXT: [[UNDEF_AGG_TMP:%.*]] = alloca [[STRUCT_BKEY_S_C]], align 1
# |                ^
# | <stdin>:18:41: note: scanning from here
# |  %agg.tmp = alloca %struct.anon, align 1
# |                                         ^
# | <stdin>:18:41: note: with "STRUCT_BKEY_S_C" equal to "%struct.bkey_s_c"
# |  %agg.tmp = alloca %struct.anon, align 1
# |                                         ^
# | <stdin>:19:17: note: possible intended match here
# |  %cleanup.dest.slot = alloca i32, align 4
# |                 ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\clang\test\CodeGen\lifetime-bug-2.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           13: ; Function Attrs: nounwind 
# |           14: define dso_local void @bch2_trans_update_extent() #0 { 
# |           15: entry: 
# |           16:  %done = alloca i8, align 1 
# |           17:  %tmp = alloca %struct.bkey_s_c, align 1 
# |           18:  %agg.tmp = alloca %struct.anon, align 1 
# | next:16'0                                             X error: no match found
# | next:16'1                                               with "STRUCT_BKEY_S_C" equal to "%struct.bkey_s_c"
# |           19:  %cleanup.dest.slot = alloca i32, align 4 
# | next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:16'2                     ?                          possible intended match
# |           20:  call void @llvm.lifetime.start.p0(ptr %done) #4 
# | next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           21:  call void @llvm.lifetime.start.p0(ptr %tmp) #4 
# | next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           22:  call void @llvm.lifetime.start.p0(ptr %agg.tmp) #4 
# | next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           23:  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %agg.tmp, ptr align 1 @__trans_tmp_85, i64 4, i1 false), !tbaa.struct !10 
# | next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           24:  %coerce.dive = getelementptr inbounds nuw %struct.anon, ptr %agg.tmp, i32 0, i32 0 
# | next:16'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

### Clang Tools
<details>
<summary>Clang Tools.clang-tidy/checkers/cppcoreguidelines/owning-memory.cpp</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
C:/Python312/python.exe C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\cppcoreguidelines\owning-memory.cpp cppcoreguidelines-owning-memory C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp
# executed command: C:/Python312/python.exe 'C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py' 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\cppcoreguidelines\owning-memory.cpp' cppcoreguidelines-owning-memory 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp'
# .---command stdout------------
# | Running ['clang-tidy', '--experimental-custom-checks', 'C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\cppcoreguidelines\\Output\\owning-memory.cpp.tmp.cpp', '-fix', '--checks=-*,cppcoreguidelines-owning-memory', '--config={}', '--', '-std=c++11', '-nostdinc++']...
# | ------------------------ clang-tidy output -----------------------
# | 51 warnings generated.
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:38:3: warning: returning a newly created resource of type 'int *' or 'gsl::owner<>' from a function whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |    38 |   return new int(42);
# |       |   ^~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:47:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |    47 |   gsl::owner<int *> owner = new int(42);
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:48:3: warning: returning a newly created resource of type 'int *' or 'gsl::owner<>' from a function whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |    48 |   return owner;
# |       |   ^~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:59:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |    59 |   gsl::owner<int *> o1 = new int(42); // Ok
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:73:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |    73 |   gsl::owner<int *> owned_int1 = &stack_int1; // BAD
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:77:3: warning: expected assignment source to be of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |    77 |   owned_int2 = &stack_int2; // BAD since no owner, bad since uninitialized
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:80:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |    80 |   gsl::owner<int *> owned_int3 = new int(42); // Good
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:99:3: warning: initializing non-owner 'int *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |    99 |   int *unowned_int3 = returns_owner1();            // Bad
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:106:3: warning: assigning newly created 'gsl::owner<>' to non-owner 'int *' [cppcoreguidelines-owning-memory]
# |   106 |   unowned_int4 = returns_owner1(); // Bad
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:109:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   109 |   gsl::owner<int *> owned_int11 = returns_no_owner1(); // Bad since no owner
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:113:3: warning: expected assignment source to be of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   113 |   owned_int12 = returns_no_owner1(); // Bad since no owner
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:124:3: warning: assigning newly created 'gsl::owner<>' to non-owner 'int *' [cppcoreguidelines-owning-memory]
# |   124 |   unowned_int8 = new int(42);
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:131:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   131 |   gsl::owner<int *> owned_int1 = new int(42);
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:134:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   134 |   gsl::owner<int *> owned_int2 = new int[42];
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:139:3: warning: deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead [cppcoreguidelines-owning-memory]
# |   139 |   delete unowned_int1; // BAD, since no owner
# |       |   ^      ~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:137:3: note: variable declared here
# |   137 |   int *unowned_int1 = new int(42); // BAD, since new creates and owner
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:145:3: warning: deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead [cppcoreguidelines-owning-memory]
# |   145 |   delete[] unowned_int2; // BAD since no owner
# |       |   ^        ~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:143:3: note: variable declared here
# |   143 |   int *unowned_int2 = new int[42]; // BAD, since new creates and owner
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:156:15: warning: expected argument of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   156 |   takes_owner(&stack_int); // BAD
# |       |               ^~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:158:15: warning: expected argument of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   158 |   takes_owner(unowned_int1); // BAD
# |       |               ^~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:161:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   161 |   gsl::owner<int *> owned_int1 = new int(42);
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:164:28: warning: expected argument of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   164 |   takes_owner_and_more(42, &stack_int, 42.0f); // BAD
# |       |                            ^~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:166:28: warning: expected argument of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   166 |   takes_owner_and_more(42, unowned_int1, 42.0f); // BAD
# |       |                            ^~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:174:25: warning: expected argument of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   174 |   takes_templated_owner(unowned_int1); // Bad
# |       |                         ^~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:178:15: warning: expected argument of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   178 |   takes_owner(returns_no_owner1()); // BAD
# |       |               ^~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:185:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   185 |   gsl::owner<int *> owned_int1 = new int(42);
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:190:17: warning: initializing non-owner argument of type 'int *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |   190 |   takes_pointer(new int(42));  // Bad, since new creates and owner
# |       |                 ^~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:193:17: warning: initializing non-owner argument of type 'int *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |   193 |   takes_pointer(returns_owner1()); // Bad
# |       |                 ^~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:237:43: warning: expected initialization of owner member variable with value of type 'gsl::owner<>'; got 'ArbitraryClass *' [cppcoreguidelines-owning-memory]
# |   237 |   ClassWithOwner(ArbitraryClass &other) : owner_var(&other) {}
# |       |                                           ^~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:247:5: warning: expected assignment source to be of type 'gsl::owner<>'; got 'ArbitraryClass *' [cppcoreguidelines-owning-memory]
# |   247 |     owner_var = bad_data;
# |       |     ^~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:262:3: warning: member variable of type 'gsl::owner<>' requires the class 'ClassWithOwner' to implement a destructor to release the owned resource [cppcoreguidelines-owning-memory]
# |   262 |   gsl::owner<ArbitraryClass *> owner_var;
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:268:3: warning: member variable of type 'gsl::owner<>' requires the class 'DefaultedDestructor' to implement a destructor to release the owned resource [cppcoreguidelines-owning-memory]
# |   268 |   gsl::owner<int *> Owner;
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:274:3: warning: member variable of type 'gsl::owner<>' requires the class 'DeletedDestructor' to implement a destructor to release the owned resource [cppcoreguidelines-owning-memory]
# |   274 |   gsl::owner<int *> Owner;
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:288:3: warning: expected assignment source to be of type 'gsl::owner<>'; got 'ArbitraryClass *' [cppcoreguidelines-owning-memory]
# |   288 |   Owner2 = &A; // BAD, since type deduction resulted in owner<ArbitraryClass *>
# |       |   ^~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:292:3: warning: expected assignment source to be of type 'gsl::owner<>'; got 'ArbitraryClass *' [cppcoreguidelines-owning-memory]
# |   292 |   Owner3 = &A;                                                        // Bad, since assignment of non-owner to owner
# |       |   ^~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:299:25: warning: expected initialization of owner member variable with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   299 |   HeapArray(int size) : _data(new int[size]), size(size) {} // Ok
# |       |                         ^~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:306:50: warning: expected initialization of owner member variable with value of type 'gsl::owner<>'; got 'void' [cppcoreguidelines-owning-memory]
# |   306 |   HeapArray(int size, T val, int *problematic) : _data{problematic}, size(size) {} // Bad
# |       |                                                  ^~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:311:5: warning: expected assignment source to be of type 'gsl::owner<>'; got 'std::nullptr_t' [cppcoreguidelines-owning-memory]
# |   311 |     other._data = nullptr;                                              // Ok
# |       |     ^~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:341:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   341 |   gsl::owner<int *> OwningPtr = Array1.data(); // Bad, since it does not return the owner
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:361:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'T' [cppcoreguidelines-owning-memory]
# |   361 |   gsl::owner<int *> owner_t = t; // Probably bad, since type deduction still wrong
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:361:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   361 |   gsl::owner<int *> owner_t = t; // Probably bad, since type deduction still wrong
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:381:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory]
# |   381 |   gsl::owner<int *> IntOwner1 = NonOwner1.getVal(); // Bad, since owner initialized with non-owner
# |       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:396:5: warning: returning a newly created resource of type 'A *' or 'gsl::owner<>' from a function whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |   396 |     return new B;
# |       |     ^~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:417:7: warning: returning a newly created resource of type 'S *' or 'gsl::owner<>' from a lambda whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |   417 |       return ::gsl::owner<S*>{new S{}};
# |       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:433:9: warning: returning a newly created resource of type 'S *' or 'gsl::owner<>' from a function whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |   433 |         return ::gsl::owner<S*>{new S{}};
# |       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:446:5: warning: returning a newly created resource of type 'S *' or 'gsl::owner<>' from a function whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |   446 |     return ::gsl::owner<S*>{new S(MakeI())};
# |       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:461:5: warning: returning a newly created resource of type 'S *' or 'gsl::owner<>' from a function whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |   461 |     return ::gsl::owner<S*>{new S(C().test())};
# |       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:475:7: warning: returning a newly created resource of type 'S *' or 'gsl::owner<>' from a lambda whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |   475 |       return ::gsl::owner<S*>{new S(MakeI())};
# |       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:483:9: warning: returning a newly created resource of type 'S *' or 'gsl::owner<>' from a lambda whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |   483 |         return ::gsl::owner<S*>{new S(1)};
# |       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:486:7: warning: returning a newly created resource of type 'S *' or 'gsl::owner<>' from a lambda whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |   486 |       return ::gsl::owner<S*>{new S(2)};
# |       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:500:39: warning: returning a newly created resource of type 'S *' or 'gsl::owner<>' from a lambda whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# |   500 |       const auto MakeS = []() -> S* { return new S(); };
# |       |                                       ^~~~~~~~~~~~~~
# | Suppressed 3 warnings (1 NOLINT, 2 with check filters).
# | 
# | 
# | ------------------------------------------------------------------
# | ------------------------------ Fixes -----------------------------
# | 
# | ------------------------------------------------------------------
# | FileCheck -input-file=C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp.notes C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\cppcoreguidelines\owning-memory.cpp -check-prefixes=CHECK-NOTES -implicit-check-not={{note|warning|error}}: failed:
# | C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\cppcoreguidelines\owning-memory.cpp:43:18: error: CHECK-NOTES: expected string not found in input
# | 
# |  // CHECK-NOTES: [[@LINE-1]]:3: warning: initializing non-owner 'int *' with a newly created 'gsl::owner<>'
# | 
# |                  ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp.notes:2:281: note: scanning from here
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:38:3: warning: returning a newly created resource of type 'int *' or 'gsl::owner<>' from a function whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# | 
# |                                                                                                                                                                                                                                                                                         ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp.notes:2:281: note: with "@LINE-1" equal to "42"
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:38:3: warning: returning a newly created resource of type 'int *' or 'gsl::owner<>' from a function whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# | 
# |                                                                                                                                                                                                                                                                                         ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp.notes:23:143: note: possible intended match here
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:99:3: warning: initializing non-owner 'int *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
# | 
# |                                                                                                                                               ^
# | 
# | 
# | 
# | Input file: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp.notes
# | 
# | Check file: C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\cppcoreguidelines\owning-memory.cpp
# | 
# | 
# | 
# | -dump-input=help explains the following input dump.
# | 
# | 
# | 
# | Input was:
# | 
# | <<<<<<
# | 
# |             1: 51 warnings generated. 
# | 
# |             2: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:38:3: warning: returning a newly created resource of type 'int *' or 'gsl::owner<>' from a function whose return type is not 'gsl::owner<>' [cppcoreguidelines-owning-memory] 
# | 
# | check:43'0                                                                                                                                                                                                                                                                                             X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | 
# | check:43'1                                                                                                                                                                                                                                                                                                                                 with "@LINE-1" equal to "42"
# | 
# |             3:  38 | return new int(42); 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |             4:  | ^~~~~~~~~~~~~~~~~~ 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~
# | 
# |             5: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:47:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory] 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |             6:  47 | gsl::owner<int *> owner = new int(42); 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |             7:  | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |             .
# | 
# |             .
# | 
# |             .
# | 
# |            18:  77 | owned_int2 = &stack_int2; // BAD since no owner, bad since uninitialized 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            19:  | ^~~~~~~~~~~~~~~~~~~~~~~~ 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            20: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:80:3: warning: expected initialization with value of type 'gsl::owner<>'; got 'int *' [cppcoreguidelines-owning-memory] 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            21:  80 | gsl::owner<int *> owned_int3 = new int(42); // Good 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            22:  | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            23: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:99:3: warning: initializing non-owner 'int *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory] 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# | check:43'2                                                                                                                                                   ?                                                                                                                   possible intended match
# | 
# |            24:  99 | int *unowned_int3 = returns_owner1(); // Bad 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            25:  | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            26: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\cppcoreguidelines\Output\owning-memory.cpp.tmp.cpp:106:3: warning: assigning newly created 'gsl::owner<>' to non-owner 'int *' [cppcoreguidelines-owning-memory] 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            27:  106 | unowned_int4 = returns_owner1(); // Bad 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            28:  | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
# | 
# | check:43'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |             .
# | 
# |             .
# | 
# |             .
# | 
# | >>>>>>
# | 
# | 
# `-----------------------------
# .---command stderr------------
# | Traceback (most recent call last):
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 413, in <module>
# |     main()
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 409, in main
# |     CheckRunner(args, extra_args).run()
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 313, in run
# |     self.check_notes(clang_tidy_output)
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 292, in check_notes
# |     try_run(
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 63, in try_run
# |     process_output = subprocess.check_output(args, stderr=subprocess.STDOUT).decode(
# |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# |   File "c:\python312\Lib\subprocess.py", line 466, in check_output
# |     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
# |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# |   File "c:\python312\Lib\subprocess.py", line 571, in run
# |     raise CalledProcessError(retcode, process.args,
# | subprocess.CalledProcessError: Command '['FileCheck', '-input-file=C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\cppcoreguidelines\\Output\\owning-memory.cpp.tmp.cpp.notes', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\cppcoreguidelines\\owning-memory.cpp', '-check-prefixes=CHECK-NOTES', '-implicit-check-not={{note|warning|error}}:']' returned non-zero exit status 1.
# `-----------------------------
# 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/175817


More information about the llvm-branch-commits mailing list