mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user