-
-
Notifications
You must be signed in to change notification settings - Fork 701
Fix #18337 - Emit coverage counters at call sites of inlined functions #22922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
suyashkumar102
wants to merge
15
commits into
dlang:master
Choose a base branch
from
suyashkumar102:fix/cov-inline-final
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
09f3a9b
fix coverage showing 0000000 for inlined functions
suyashkumar102 33a2036
Merge branch 'master' of https://github.com/suyashkumar102/dmd into f…
suyashkumar102 69c1143
fix accurate hit counts on inlined function lines
suyashkumar102 02eb5e8
retrigger CI
suyashkumar102 3fc7c53
retrigger CI : 2
suyashkumar102 15a53cb
Apply suggestion from @dkorpel
suyashkumar102 1d63717
add isInlineSequence to expression.h
suyashkumar102 af1da09
use e.loc.isValid() to check for valid source location
suyashkumar102 8c25429
count DeclarationExp in inline coverage
suyashkumar102 b9633d3
circleci test
suyashkumar102 67907d2
retrigger CI
suyashkumar102 25ff287
ci: retrigger
suyashkumar102 ebe5efa
fix: correct CURL_USER_AGENT quoting in run.sh
suyashkumar102 13ec246
Merge branch 'dlang:master' into fix/cov-inline-final
suyashkumar102 899e105
ci: rerun
suyashkumar102 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| Coverage counters are now emitted at call sites of inlined functions | ||
|
|
||
| Functions marked `pragma(inline, true)` (and functions inlined via the | ||
| `-inline` flag) would always show `0000000` in `-cov` coverage reports | ||
| even when executed. The inlined function body is never called as a | ||
| standalone function at runtime - only the inlined copy inside the caller | ||
| runs, so its coverage counters stayed at zero. | ||
|
|
||
| Coverage counters are now emitted at each call site where a function is | ||
| inlined, so the function's lines correctly reflect how many times they | ||
| were executed. | ||
|
|
||
| Fixes $(LINK2 https://issues.dlang.org/show_bug.cgi?id=5848, Issue 5848) / | ||
| $(LINK2 https://github.com/dlang/dmd/issues/18337, #18337) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| |// PERMUTE_ARGS: | ||
| |// REQUIRED_ARGS: -cov | ||
| |// POST_SCRIPT: runnable/extra-files/coverage-postscript.sh | ||
| |// EXECUTE_ARGS: ${RESULTS_DIR}/runnable | ||
| | | ||
| |extern(C) void dmd_coverDestPath(string path); | ||
| | | ||
| |pragma(inline, true) | ||
| |int square(int x) | ||
| |{ | ||
| 2| int y = x * x; | ||
| 2| return y; | ||
| |} | ||
| | | ||
| |pragma(inline, true) | ||
| |int addSquares(int a, int b) | ||
| |{ | ||
| 1| return square(a) + square(b); | ||
| |} | ||
| | | ||
| |void main(string[] args) | ||
| |{ | ||
| 1| dmd_coverDestPath(args[1]); | ||
| 1| auto value = addSquares(2, 3); | ||
| 1| assert(value == 13); | ||
| |} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // PERMUTE_ARGS: | ||
| // REQUIRED_ARGS: -cov | ||
| // POST_SCRIPT: runnable/extra-files/coverage-postscript.sh | ||
| // EXECUTE_ARGS: ${RESULTS_DIR}/runnable | ||
|
|
||
| extern(C) void dmd_coverDestPath(string path); | ||
|
|
||
| pragma(inline, true) | ||
| int square(int x) | ||
| { | ||
| int y = x * x; | ||
| return y; | ||
| } | ||
|
|
||
| pragma(inline, true) | ||
| int addSquares(int a, int b) | ||
| { | ||
| return square(a) + square(b); | ||
| } | ||
|
|
||
| void main(string[] args) | ||
| { | ||
| dmd_coverDestPath(args[1]); | ||
| auto value = addSquares(2, 3); | ||
| assert(value == 13); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.