Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@autoantwort
Copy link
Contributor

@autoantwort autoantwort commented Aug 10, 2025

Only msvc was tested, worked for simply example.

Fixes #1614 and #1466.

Open questions that I have not looked at:

  • How to handle absolute paths?
  • Should we "rewrite" the arguments like done for other options?

@jrosdahl jrosdahl added the feature New or improved feature label Aug 11, 2025
@jrosdahl jrosdahl linked an issue Aug 11, 2025 that may be closed by this pull request
Only msvc was tested, worked for simply example.
@autoantwort autoantwort marked this pull request as ready for review August 21, 2025 20:02
@autoantwort autoantwort changed the title Add inital handling for sarif output files. Add support for sarif output files. Aug 21, 2025
@autoantwort
Copy link
Contributor Author

It now works in our ci and locally (when using #1627 and #1628)

Comment on lines +1500 to +1501
args_info.output_sarif = args_info.input_file;
args_info.output_sarif.append(".sarif");
Copy link
Member

@jrosdahl jrosdahl Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, this is not how GCC decides where to write sarif data. See my suggested update of the test case in a comment below.

using namespace std::string_view_literals;
auto param = std::string_view(arg).substr("-fdiagnostics-format="sv.size());
if (param == "sarif-file") {
args_info.generating_sarif = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the sarif file includes CWD we should set state.hash_actual_cwd = true here.

Co-authored-by: Joel Rosdahl <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New or improved feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for msvc's /experimental:log Support -fdiagnostics-format=sarif-file

2 participants