Skip to content

msvc: recognize direct clang-cl instrumentation generation - #3074

Open
marcpems wants to merge 4 commits into
mozilla:mainfrom
marcpems:fix/clang-cl-direct-profile-generate
Open

marcpems wants to merge 4 commits into
mozilla:mainfrom
marcpems:fix/clang-cl-direct-profile-generate

Conversation

@marcpems

@marcpems marcpems commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #2962:

  • Direct generation flag: recognize -fprofile-instr-generate for clang-cl so it selects -E (preserving line markers), just like -clang:-fprofile-instr-generate. The regression test checks that the direct flag sets profile_generate and is still forwarded to clang-cl.
  • Fallback cleanup: share the existing CannotCache arm for unsupported clang-specific flags.

Validation on Windows: cargo fmt -- --check, cargo clippy --locked --lib --tests, and cargo test --locked --lib -- --test-threads=1 (696 passed).

Authored with GHCP assistance.

marcpems and others added 2 commits November 26, 2026 22:04
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov-commenter

codecov-commenter commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.68%. Comparing base (fdda84b) to head (c28e9ed).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
src/compiler/msvc.rs 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3074      +/-   ##
==========================================
+ Coverage   79.99%   80.68%   +0.68%     
==========================================
  Files          76       78       +2     
  Lines       47374    48629    +1255     
==========================================
+ Hits        37897    39235    +1338     
+ Misses       9477     9394      -83     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marcpems
marcpems marked this pull request as ready for review November 26, 2026 22:16
@marcpems

Copy link
Copy Markdown
Contributor Author

@sylvestre please could you take a look at this one please. It's a response to your previous code review comments.

Comment thread src/compiler/msvc.rs
msvc_flag!("forceInterlockedFunctions-", PassThrough),
msvc_take_arg!("fp:", OsString, Concatenated, PassThroughWithSuffix),
msvc_take_arg!("fpcvt:", OsString, Concatenated, PassThroughWithSuffix),
msvc_flag!("fprofile-instr-generate", ClangProfileGenerate),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what about -fprofile-instr-generate=<file>?
it will still be passed as an unknown flag without setting profile_generate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good catch. Fixed.
Both -fprofile-instr-generate= and -clang:-fprofile-instr-generate= now set profile_generate. I extended the existing test to cover both filename forms.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread src/compiler/clang.rs
flag!("-fprebuilt-implicit-modules", TooHardFlag),
take_arg!("-fprebuilt-module-path", OsString, Concatenated, TooHard),
flag!("-fprofile-instr-generate", ProfileGenerate),
take_arg!("-fprofile-instr-generate=", OsString, Concatenated, ProfileGenerateWithPath),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this changes plain clang too, could you please add a test in clang.rs for -fprofile-instr-generate=foo.profraw?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done, line 1250

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants