-
Notifications
You must be signed in to change notification settings - Fork 2k
C++: IR field flow #3118
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
C++: IR field flow #3118
Changes from 1 commit
22381f3
a5f08e1
077c282
f92dd3c
fbef146
c6c6138
a43abaa
580310f
5ba5791
7fce4ce
020c273
af9e05b
dda3aaa
ce5d8d5
317734f
3aa2932
c577541
5719967
d56284f
52b179a
d65c52d
7f5330d
945ecff
daac5c5
cde34c9
209e084
f02feac
62e2ffe
8c03423
ba0429c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…ll arguments need a PostUpdateNode). Also generalized the added flow rule in simpleLocalFlowStep since there isn't always a ChiInstruction - for instance of it's a write to a struct that only has a single field.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -218,7 +218,17 @@ abstract class PostUpdateNode extends InstructionNode { | |
| override string toString() { result = getPreUpdateNode().toString() + " [post update]" } | ||
| } | ||
|
|
||
| abstract class PartialDefinitionNode extends PostUpdateNode, TInstructionNode { } | ||
| abstract private class PartialDefinitionNode extends PostUpdateNode, TInstructionNode { | ||
| final Instruction getInstructionOrChi() { | ||
| exists(ChiInstruction chi | | ||
| // TODO: This should be a non-conflated ChiInstruction once #3123 is merged | ||
| chi.getPartial() = getInstruction() and | ||
| result = chi | ||
| ) | ||
| or | ||
| result = getInstruction() | ||
| } | ||
| } | ||
|
|
||
| class ExplicitFieldStoreQualifierNode extends PartialDefinitionNode { | ||
| override StoreInstruction instr; | ||
|
|
@@ -268,22 +278,6 @@ class DefinitionByReferenceNode extends PartialDefinitionNode { | |
| override string toString() { result = "ref arg " + getPreUpdateNode().toString() } | ||
| } | ||
|
|
||
| class PositionalArgumentWithoutWriteSideEffectNode extends PartialDefinitionNode { | ||
| override CallInstruction instr; | ||
| PositionalArgumentOperand op; | ||
|
|
||
| PositionalArgumentWithoutWriteSideEffectNode() { | ||
| instr.getAnOperand() = op and | ||
| not exists(WriteSideEffectInstruction write | | ||
| write.getIndex() = op.getIndex() and write.getPrimaryInstruction() = instr | ||
| ) | ||
| } | ||
|
|
||
| override Node getPreUpdateNode() { result.asInstruction() = op.getDef() } | ||
|
|
||
| override string toString() { result = "no change to " + op.toString() } | ||
| } | ||
|
|
||
| /** | ||
| * A `Node` corresponding to a variable in the program, as opposed to the | ||
| * value of that variable at some particular point. This can be used for | ||
|
|
@@ -365,10 +359,10 @@ predicate localFlowStep(Node nodeFrom, Node nodeTo) { simpleLocalFlowStep(nodeFr | |
| predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) { | ||
| simpleInstructionLocalFlowStep(nodeFrom.asInstruction(), nodeTo.asInstruction()) | ||
| or | ||
| exists(ChiInstruction chi, LoadInstruction load | | ||
| chi.getPartial() = nodeFrom.(PartialDefinitionNode).getInstruction() and | ||
| // TODO: This can probably be getSourceValue() after #3112 is merged | ||
| load.getSourceValueOperand().getAnyDef() = chi and | ||
| exists(LoadInstruction load | | ||
| // TODO: These can probably be getSourceValue() after #3112 is merged | ||
| load.getSourceValueOperand().getAnyDef() = | ||
| nodeFrom.(PartialDefinitionNode).getInstructionOrChi() and | ||
| nodeTo.asInstruction() = load.getSourceAddress().(FieldAddressInstruction).getObjectAddress() | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can move this case into
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've done this now in d56284f. This case I've added in |
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's now merged (that's the line I meant to comment on a minute ago).
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly my comment turned out to be incorrect. The flow in the following program is not captured by only following exact
Chioperands:since the load on
b->conly is a total overlap.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then you'll want to merge #3097 and use
isResultConflatedhere.