-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[MC/DC] Nested decision #125403
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
Draft
chapuni
wants to merge
31
commits into
main
Choose a base branch
from
users/chapuni/mcdc/nest/trunk
base: main
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.
Draft
[MC/DC] Nested decision #125403
Conversation
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
To resolve the error, rename mcdc-error-nests.cpp -> mcdc-nested-expr.cpp at first. - `func_condop` A corner case that contains close decisions. - `func_expect` Uses `__builtin_expect`. (#124565) - `func_lnot` Contains logical not(s) `!` among MC/DC binary operators. (#124563) mcdc-single-cond.cpp is for #95336.
CoverageMappingWriter reorders `Region`s by `endLoc DESC` to prioritize wider `Decision` with the same `startLoc`. In `llvm-cov`, tweak seeking Decisions by reversal order to find smaller Decision first.
Introduce `ID` and `InvalidID`. Then `DecisionByStmt` can have three states. * Not assigned if the Stmt(Expr) doesn't exist. * When `DecisionByStmt[Expr]` exists: * Invalid and should be ignored if `ID == Invalid`. * Valid if `ID != Invalid`. Other member will be filled in the Mapper.
- Get rid of the old `DecisionStack` and dissolve it into push/pop `CurCondIDs` in `VisitBin`, since `VisitBin` is recursive. - Introduce the new `DecisionStack` with `DecisionState` to handle the current `Decision` in nested `Decision`s. - The stack has the sentinel that has `DecisionExpr = nullptr`. - Split out `checkDecisionRootOrPush` from `pushAndAssignIDs` for non-BinOp. It assigns `CondID` to `E` (instead of assignment LHS in `pushAndAssignIDs`). - The stack is manupilated at the top Decision operator in `VisitBin`. - The stack grows at the entrance of the Decision with the initial state. - In the same level in `VisitBin`, the stack is popped and the `Decision` record is emitted. - Introduce `DecisionEndToSince` to sweep `MCDCBranch`es partially in `cancelDecision`.
`MCDCLogOpStack` is used only for detection of the Decision root. It can be detected with `MCDC::State::DecisionByStmt`.
MCDCCondBitmapAddr is moved from `CodeGenFunction` into `MCDCState` and created for each Decision. In `maybeCreateMCDCCondBitmap`, Allocate bitmaps for all valid Decisions and emit them order by ID, to prevent nondeterminism.
…est/covmapdesc', 'users/chapuni/mcdc/nest/covgen' and 'users/chapuni/mcdc/nest/logopstack' into users/chapuni/mcdc/nest/nest-base
…mcdc/nest/nest-base
A warning "contains an operation with a nested boolean expression." is no longer emitter. At the moment, split expressions are treated as individual Decisions.
In the current implementation, `!(a || b) && c` was not treated as one Decision with three terms. Fixes #124563
…/nest/expect' into users/chapuni/mcdc/nest/trunk Conflicts: clang/include/clang/AST/IgnoreExpr.h clang/lib/CodeGen/CodeGenFunction.cpp
…onditions `-fmcdc-single-conditions` is `CC1Option` for now. This change discovers `isInstrumentedCondition(Cond)` on `DoStmt/ForStmt/IfStmt/WhleStmt/AbstractConditionalOperator` and add them into Decisions. An example of the report: ``` MC/DC Decision Region (mmm:nn) to (mmm:nn) Number of Conditions: 1 Condition C1 -->(mmm:nn) Executed MC/DC Test Vectors: C1 Result 1 { F = F } 2 { T = T } C1-Pair: covered: (1,2) MC/DC Coverage for Expression: 100.00% ``` The Decision is covered only if both `true` and `false` are covered. Fixes #95336
…dc/nest/lnot' into users/chapuni/mcdc/nest/trunk Conflicts: clang/docs/ReleaseNotes.rst
…cdc/nest/bitmapaddr
…mcdc/nest/nest-base Conflicts: clang/test/CoverageMapping/mcdc-single-cond.cpp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
-fmcdc-single-conditions
to include also single conditions #125484!
among&&
and||
#125406