[clang] [Clang][Diagnose] New feature: Nested/Indented diagnostic message in sarif mode. (PR #174106)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 31 11:17:14 PST 2025
github-actions[bot] wrote:
<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results
The build failed before running any tests. Click on a failure below to see the details.
<details>
<summary>[code=1] tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Sarif.cpp.obj</summary>
```
FAILED: [code=1] tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Sarif.cpp.obj
sccache C:\clang\clang-msvc\bin\clang-cl.exe /nologo -TP -DCLANG_BUILD_STATIC -DGTEST_HAS_RTTI=0 -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_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\clang\lib\Basic -IC:\_work\llvm-project\llvm-project\clang\lib\Basic -IC:\_work\llvm-project\llvm-project\clang\include -Itools\clang\include -Iinclude -IC:\_work\llvm-project\llvm-project\llvm\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 -MD -UNDEBUG /EHs-c- /GR- -std:c++17 /showIncludes /Fotools\clang\lib\Basic\CMakeFiles\obj.clangBasic.dir\Sarif.cpp.obj /Fdtools\clang\lib\Basic\CMakeFiles\obj.clangBasic.dir\ -c -- C:\_work\llvm-project\llvm-project\clang\lib\Basic\Sarif.cpp
In file included from C:\_work\llvm-project\llvm-project\clang\lib\Basic\Sarif.cpp:17:
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,26): error: no member named 'variant' in namespace 'std'
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ^~~~~~~
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,34): error: 'SarifChildResult' does not refer to a value
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(303,7): note: declared here
303 | class SarifChildResult {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,68): error: expected member name or ';' after declaration specifiers
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(417,5): error: use of undeclared identifier 'RelatedLocations'; did you mean 'addRelatedLocations'?
417 | RelatedLocations.append(DiagLocs.begin(), DiagLocs.end());
| ^~~~~~~~~~~~~~~~
| addRelatedLocations
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(422,3): note: 'addRelatedLocations' declared here
422 | addRelatedLocations(llvm::ArrayRef<SarifChildResult> ChildResults) {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(417,5): error: reference to non-static member function must be called
417 | RelatedLocations.append(DiagLocs.begin(), DiagLocs.end());
| ^~~~~~~~~~~~~~~~
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(423,5): error: use of undeclared identifier 'RelatedLocations'; did you mean 'addRelatedLocations'?
423 | RelatedLocations.append(ChildResults.begin(), ChildResults.end());
| ^~~~~~~~~~~~~~~~
| addRelatedLocations
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(422,3): note: 'addRelatedLocations' declared here
422 | addRelatedLocations(llvm::ArrayRef<SarifChildResult> ChildResults) {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(423,5): error: reference to non-static member function must be called
423 | RelatedLocations.append(ChildResults.begin(), ChildResults.end());
| ^~~~~~~~~~~~~~~~
C:\_work\llvm-project\llvm-project\clang\lib\Basic\Sarif.cpp(407,15): error: no member named 'RelatedLocations' in 'clang::SarifResult'
407 | if (!Result.RelatedLocations.empty()) {
| ~~~~~~ ^
C:\_work\llvm-project\llvm-project\clang\lib\Basic\Sarif.cpp(409,41): error: no member named 'RelatedLocations' in 'clang::SarifResult'
409 | for (auto &RelatedLocation : Result.RelatedLocations) {
| ~~~~~~ ^
9 errors generated.
```
</details>
<details>
<summary>[code=1] tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/SARIFDiagnosticPrinter.cpp.obj</summary>
```
FAILED: [code=1] tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/SARIFDiagnosticPrinter.cpp.obj
sccache C:\clang\clang-msvc\bin\clang-cl.exe /nologo -TP -DCLANG_BUILD_STATIC -DGTEST_HAS_RTTI=0 -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_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\clang\lib\Frontend -IC:\_work\llvm-project\llvm-project\clang\lib\Frontend -IC:\_work\llvm-project\llvm-project\clang\include -Itools\clang\include -Iinclude -IC:\_work\llvm-project\llvm-project\llvm\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 -MD -UNDEBUG /EHs-c- /GR- -std:c++17 /showIncludes /Fotools\clang\lib\Frontend\CMakeFiles\obj.clangFrontend.dir\SARIFDiagnosticPrinter.cpp.obj /Fdtools\clang\lib\Frontend\CMakeFiles\obj.clangFrontend.dir\ -c -- C:\_work\llvm-project\llvm-project\clang\lib\Frontend\SARIFDiagnosticPrinter.cpp
In file included from C:\_work\llvm-project\llvm-project\clang\lib\Frontend\SARIFDiagnosticPrinter.cpp:13:
In file included from C:\_work\llvm-project\llvm-project\clang\include\clang/Frontend/SARIFDiagnosticPrinter.h:19:
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,26): error: no member named 'variant' in namespace 'std'
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ^~~~~~~
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,34): error: 'SarifChildResult' does not refer to a value
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(303,7): note: declared here
303 | class SarifChildResult {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,68): error: expected member name or ';' after declaration specifiers
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(417,5): error: use of undeclared identifier 'RelatedLocations'; did you mean 'addRelatedLocations'?
417 | RelatedLocations.append(DiagLocs.begin(), DiagLocs.end());
| ^~~~~~~~~~~~~~~~
| addRelatedLocations
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(422,3): note: 'addRelatedLocations' declared here
422 | addRelatedLocations(llvm::ArrayRef<SarifChildResult> ChildResults) {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(417,5): error: reference to non-static member function must be called
417 | RelatedLocations.append(DiagLocs.begin(), DiagLocs.end());
| ^~~~~~~~~~~~~~~~
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(423,5): error: use of undeclared identifier 'RelatedLocations'; did you mean 'addRelatedLocations'?
423 | RelatedLocations.append(ChildResults.begin(), ChildResults.end());
| ^~~~~~~~~~~~~~~~
| addRelatedLocations
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(422,3): note: 'addRelatedLocations' declared here
422 | addRelatedLocations(llvm::ArrayRef<SarifChildResult> ChildResults) {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(423,5): error: reference to non-static member function must be called
423 | RelatedLocations.append(ChildResults.begin(), ChildResults.end());
| ^~~~~~~~~~~~~~~~
7 errors generated.
```
</details>
<details>
<summary>[code=1] tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/SARIFDiagnostic.cpp.obj</summary>
```
FAILED: [code=1] tools/clang/lib/Frontend/CMakeFiles/obj.clangFrontend.dir/SARIFDiagnostic.cpp.obj
sccache C:\clang\clang-msvc\bin\clang-cl.exe /nologo -TP -DCLANG_BUILD_STATIC -DGTEST_HAS_RTTI=0 -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_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\clang\lib\Frontend -IC:\_work\llvm-project\llvm-project\clang\lib\Frontend -IC:\_work\llvm-project\llvm-project\clang\include -Itools\clang\include -Iinclude -IC:\_work\llvm-project\llvm-project\llvm\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 -MD -UNDEBUG /EHs-c- /GR- -std:c++17 /showIncludes /Fotools\clang\lib\Frontend\CMakeFiles\obj.clangFrontend.dir\SARIFDiagnostic.cpp.obj /Fdtools\clang\lib\Frontend\CMakeFiles\obj.clangFrontend.dir\ -c -- C:\_work\llvm-project\llvm-project\clang\lib\Frontend\SARIFDiagnostic.cpp
In file included from C:\_work\llvm-project\llvm-project\clang\lib\Frontend\SARIFDiagnostic.cpp:9:
In file included from C:\_work\llvm-project\llvm-project\clang\include\clang/Frontend/SARIFDiagnostic.h:20:
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,26): error: no member named 'variant' in namespace 'std'
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ^~~~~~~
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,34): error: 'SarifChildResult' does not refer to a value
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(303,7): note: declared here
303 | class SarifChildResult {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,68): error: expected member name or ';' after declaration specifiers
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(417,5): error: use of undeclared identifier 'RelatedLocations'; did you mean 'addRelatedLocations'?
417 | RelatedLocations.append(DiagLocs.begin(), DiagLocs.end());
| ^~~~~~~~~~~~~~~~
| addRelatedLocations
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(422,3): note: 'addRelatedLocations' declared here
422 | addRelatedLocations(llvm::ArrayRef<SarifChildResult> ChildResults) {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(417,5): error: reference to non-static member function must be called
417 | RelatedLocations.append(DiagLocs.begin(), DiagLocs.end());
| ^~~~~~~~~~~~~~~~
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(423,5): error: use of undeclared identifier 'RelatedLocations'; did you mean 'addRelatedLocations'?
423 | RelatedLocations.append(ChildResults.begin(), ChildResults.end());
| ^~~~~~~~~~~~~~~~
| addRelatedLocations
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(422,3): note: 'addRelatedLocations' declared here
422 | addRelatedLocations(llvm::ArrayRef<SarifChildResult> ChildResults) {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(423,5): error: reference to non-static member function must be called
423 | RelatedLocations.append(ChildResults.begin(), ChildResults.end());
| ^~~~~~~~~~~~~~~~
7 errors generated.
```
</details>
<details>
<summary>[code=1] tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/SarifTest.cpp.obj</summary>
```
FAILED: [code=1] tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/SarifTest.cpp.obj
sccache C:\clang\clang-msvc\bin\clang-cl.exe /nologo -TP -DCLANG_BUILD_STATIC -DGTEST_HAS_RTTI=0 -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_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\clang\unittests\Basic -IC:\_work\llvm-project\llvm-project\clang\unittests\Basic -IC:\_work\llvm-project\llvm-project\clang\include -Itools\clang\include -Iinclude -IC:\_work\llvm-project\llvm-project\llvm\include -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 -MD -UNDEBUG -Wno-gnu-zero-variadic-macro-arguments /EHs-c- /GR- -Wno-suggest-override -std:c++17 /showIncludes /Fotools\clang\unittests\Basic\CMakeFiles\BasicTests.dir\SarifTest.cpp.obj /Fdtools\clang\unittests\Basic\CMakeFiles\BasicTests.dir\ -c -- C:\_work\llvm-project\llvm-project\clang\unittests\Basic\SarifTest.cpp
In file included from C:\_work\llvm-project\llvm-project\clang\unittests\Basic\SarifTest.cpp:9:
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,26): error: no member named 'variant' in namespace 'std'
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ^~~~~~~
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,34): error: 'SarifChildResult' does not refer to a value
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(303,7): note: declared here
303 | class SarifChildResult {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(366,68): error: expected member name or ';' after declaration specifiers
366 | llvm::SmallVector<std::variant<SarifChildResult, CharSourceRange>, 8>
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(417,5): error: use of undeclared identifier 'RelatedLocations'; did you mean 'addRelatedLocations'?
417 | RelatedLocations.append(DiagLocs.begin(), DiagLocs.end());
| ^~~~~~~~~~~~~~~~
| addRelatedLocations
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(422,3): note: 'addRelatedLocations' declared here
422 | addRelatedLocations(llvm::ArrayRef<SarifChildResult> ChildResults) {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(417,5): error: reference to non-static member function must be called
417 | RelatedLocations.append(DiagLocs.begin(), DiagLocs.end());
| ^~~~~~~~~~~~~~~~
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(423,5): error: use of undeclared identifier 'RelatedLocations'; did you mean 'addRelatedLocations'?
423 | RelatedLocations.append(ChildResults.begin(), ChildResults.end());
| ^~~~~~~~~~~~~~~~
| addRelatedLocations
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(422,3): note: 'addRelatedLocations' declared here
422 | addRelatedLocations(llvm::ArrayRef<SarifChildResult> ChildResults) {
| ^
C:\_work\llvm-project\llvm-project\clang\include\clang/Basic/Sarif.h(423,5): error: reference to non-static member function must be called
423 | RelatedLocations.append(ChildResults.begin(), ChildResults.end());
| ^~~~~~~~~~~~~~~~
7 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/174106
More information about the cfe-commits
mailing list