[clang] [clang-tools-extra] [clang] fix location information of CXXConstructorExpr AST node (PR #196092)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 6 08:33:53 PDT 2026


github-actions[bot] wrote:

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

* 53844 tests passed
* 1182 tests skipped
* 1 test failed

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

### Clang Tools
<details>
<summary>Clang Tools.clang-tidy/checkers/bugprone/dangling-handle.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 -std=c++11,c++14 -check-suffix=,CXX14 C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\bugprone\dangling-handle.cpp bugprone-dangling-handle C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp --    -config="{CheckOptions:              {bugprone-dangling-handle.HandleClasses:                'std::basic_string_view; ::llvm::StringRef;'}}"
# executed command: C:/Python312/python.exe 'C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py' -std=c++11,c++14 -check-suffix=,CXX14 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\bugprone\dangling-handle.cpp' bugprone-dangling-handle 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp' -- '-config={CheckOptions:              {bugprone-dangling-handle.HandleClasses:                '"'"'std::basic_string_view; ::llvm::StringRef;'"'"'}}'
# .---command stdout------------
# | Running ['clang-tidy', '--experimental-custom-checks', 'C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\bugprone\\Output\\dangling-handle.cpp.tmp.cpp', '-fix', '--checks=-*,bugprone-dangling-handle', "-config={CheckOptions:              {bugprone-dangling-handle.HandleClasses:                'std::basic_string_view; ::llvm::StringRef;'}}", '--', '-std=c++11', '-nostdinc++', '-isystem', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\Inputs\\Headers\\std']...
# | ------------------------ clang-tidy output -----------------------
# | 50 warnings generated.
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:29:28: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    29 |   std::string_view view1 = std::string();
# |       |                            ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:33:29: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    33 |   std::string_view view_2 = ReturnsAString();
# |       |                             ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:37:3: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    37 |   view1 = std::string();
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:41:28: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    41 |   std::string_view view3 = true ? "A" : str_ref;
# |       |                            ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:44:3: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    44 |   view3 = true ? "A" : str_ref;
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:47:20: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    47 |   std::string_view view4(ReturnsAString());
# |       |                    ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:51:28: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    51 |   std::string_view view5 = std::string("test");
# |       |                            ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:55:28: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    55 |   std::string_view view6 = std::string{"test"};
# |       |                            ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:61:25: warning: llvm::StringRef outlives its value [bugprone-dangling-handle]
# |    61 |   llvm::StringRef ref = std::string();
# |       |                         ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:76:7: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    76 |       return array;  // refers to local
# |       |       ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:79:7: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    79 |       return s;  // refers to local
# |       |       ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:82:7: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    82 |       return std::string();  // refers to temporary
# |       |       ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:85:7: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |    85 |       return value_arg;  // refers to by-value arg
# |       |       ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:123:3: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |   123 |   v.assign(3, std::string());
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:125:3: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |   125 |   v.insert(nullptr, std::string());
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:127:3: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |   127 |   v.insert(nullptr, 3, std::string());
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:129:3: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |   129 |   v.push_back(std::string());
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:131:3: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |   131 |   v.resize(3, std::string());
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:135:3: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |   135 |   s.insert(std::string());
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:137:3: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |   137 |   s.insert(nullptr, std::string());
# |       |   ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:141:3: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# |   141 |   m[std::string()];
# |       |   ^
# | Suppressed 29 warnings (29 with check filters).
# | 
# | 
# | ------------------------------------------------------------------
# | ------------------------------ Fixes -----------------------------
# | 
# | ------------------------------------------------------------------
# | FileCheck -input-file=C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp.msg C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\bugprone\dangling-handle.cpp -check-prefixes=CHECK-MESSAGES,CHECK-MESSAGES-CXX14 -implicit-check-not={{warning|error}}: failed:
# | C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\bugprone\dangling-handle.cpp:30:27: error: CHECK-MESSAGES-CXX14: expected string not found in input
# | 
# |  // CHECK-MESSAGES-CXX14: [[@LINE-1]]:20: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# | 
# |                           ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp.msg:1:1: note: scanning from here
# | 
# | 50 warnings generated.
# | 
# | ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp.msg:1:1: note: with "@LINE-1" equal to "29"
# | 
# | 50 warnings generated.
# | 
# | ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp.msg:17:137: note: possible intended match here
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:47:20: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
# | 
# |                                                                                                                                         ^
# | 
# | 
# | 
# | Input file: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp.msg
# | 
# | Check file: C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\bugprone\dangling-handle.cpp
# | 
# | 
# | 
# | -dump-input=help explains the following input dump.
# | 
# | 
# | 
# | Input was:
# | 
# | <<<<<<
# | 
# |             1: 50 warnings generated.
# |  
# | 
# | check:30'0     X~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | 
# | check:30'1                              with "@LINE-1" equal to "29"
# | 
# |             2: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:29:28: warning: std::basic_string_view outlives its value [bugprone-dangling-handle] 
# | 
# | check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |             3:  29 | std::string_view view1 = std::string(); 
# | 
# | check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |             4:  | ^ 
# | 
# | check:30'0     ~~~~~
# | 
# |             5: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:33:29: warning: std::basic_string_view outlives its value [bugprone-dangling-handle] 
# | 
# | check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |             6:  33 | std::string_view view_2 = ReturnsAString(); 
# | 
# | check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |             .
# | 
# |             .
# | 
# |             .
# | 
# |            12:  41 | std::string_view view3 = true ? "A" : str_ref; 
# | 
# | check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            13:  | ^ 
# | 
# | check:30'0     ~~~~~
# | 
# |            14: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:44:3: warning: std::basic_string_view outlives its value [bugprone-dangling-handle] 
# | 
# | check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            15:  44 | view3 = true ? "A" : str_ref; 
# | 
# | check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            16:  | ^ 
# | 
# | check:30'0     ~~~~~
# | 
# |            17: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:47:20: warning: std::basic_string_view outlives its value [bugprone-dangling-handle] 
# | 
# | check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# | check:30'2                                                                                                                                             ?                                                                                   possible intended match
# | 
# |            18:  47 | std::string_view view4(ReturnsAString()); 
# | 
# | check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            19:  | ^ 
# | 
# | check:30'0     ~~~~~
# | 
# |            20: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\dangling-handle.cpp.tmp.cpp:51:28: warning: std::basic_string_view outlives its value [bugprone-dangling-handle] 
# | 
# | check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            21:  51 | std::string_view view5 = std::string("test"); 
# | 
# | check:30'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |            22:  | ^ 
# | 
# | check:30'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 554, in <module>
# |     main()
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 550, 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 433, in run
# |     self.check_messages(main_output)
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 358, in check_messages
# |     try_run(
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 64, 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\\bugprone\\Output\\dangling-handle.cpp.tmp.cpp.msg', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\bugprone\\dangling-handle.cpp', '-check-prefixes=CHECK-MESSAGES,CHECK-MESSAGES-CXX14', '-implicit-check-not={{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/196092


More information about the cfe-commits mailing list