C++: Restore and deprecate getPosInBasicBlock

This predicte was still used in a test, so it might be used in external
code too.
This commit is contained in:
Jonas Jensen
2019-08-28 08:29:06 +02:00
parent 4cae5917cb
commit b98d6379e9
2 changed files with 20 additions and 2 deletions

View File

@@ -71,7 +71,7 @@ class SubBasicBlock extends ControlFlowNodeBase {
}
/**
* Gets the rank of this `SubBasicBlock` among the other `SubBasicBlock`s in
* Gets the (1-based) rank of this `SubBasicBlock` among the other `SubBasicBlock`s in
* its containing basic block `bb`, where `bb` is equal to `getBasicBlock()`.
*/
int getRankInBasicBlock(BasicBlock bb) {
@@ -81,6 +81,15 @@ class SubBasicBlock extends ControlFlowNodeBase {
)
}
/**
* DEPRECATED: use `getRankInBasicBlock` instead. Note that this predicate
* returns a 0-based position, while `getRankInBasicBlock` returns a 1-based
* position.
*/
deprecated int getPosInBasicBlock(BasicBlock bb) {
result = getRankInBasicBlock(bb) - 1
}
pragma[noinline]
private int getIndexInBasicBlock(BasicBlock bb) {
this = bb.getNode(result)

View File

@@ -71,7 +71,7 @@ class SubBasicBlock extends ControlFlowNodeBase {
}
/**
* Gets the rank of this `SubBasicBlock` among the other `SubBasicBlock`s in
* Gets the (1-based) rank of this `SubBasicBlock` among the other `SubBasicBlock`s in
* its containing basic block `bb`, where `bb` is equal to `getBasicBlock()`.
*/
int getRankInBasicBlock(BasicBlock bb) {
@@ -81,6 +81,15 @@ class SubBasicBlock extends ControlFlowNodeBase {
)
}
/**
* DEPRECATED: use `getRankInBasicBlock` instead. Note that this predicate
* returns a 0-based position, while `getRankInBasicBlock` returns a 1-based
* position.
*/
deprecated int getPosInBasicBlock(BasicBlock bb) {
result = getRankInBasicBlock(bb) - 1
}
pragma[noinline]
private int getIndexInBasicBlock(BasicBlock bb) {
this = bb.getNode(result)