Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 279fc16

Browse files
committed
C++: ConvertToBase -> ConvertToNonVirtualBase
This rename was done with perl -p -i -e's/ConvertToBase/ConvertToNonVirtualBase/g' **/*.ql* **/*.expected followed by re-running the affected tests.
1 parent f3e691b commit 279fc16

16 files changed

Lines changed: 651 additions & 675 deletions

File tree

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowDispatch.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ private predicate overrideMayAffectCall(
5757
* should usually be fewer classes than calls.
5858
*
5959
* If a value is cast several classes up in the hierarchy, that will be modeled
60-
* as a chain of `ConvertToBaseInstruction`s and will cause the search to start
60+
* as a chain of `ConvertToNonVirtualBaseInstruction`s and will cause the search to start
6161
* from each of them and pass through subsequent ones. There might be
6262
* performance to gain by stopping before a second upcast and reconstructing
6363
* the full chain in a "big-step" recursion after this one.
6464
*/
6565
private predicate nodeMayHaveClass(Class derived, DataFlow::Node node) {
66-
exists(ConvertToBaseInstruction toBase |
66+
exists(ConvertToNonVirtualBaseInstruction toBase |
6767
derived = toBase.getDerivedClass() and
6868
overrideMayAffectCall(derived, _, toBase.getEnclosingFunction(), _, _) and
6969
node.asInstruction() = toBase

cpp/ql/src/semmle/code/cpp/ir/implementation/Opcode.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private newtype TOpcode =
3434
TPointerSub() or
3535
TPointerDiff() or
3636
TConvert() or
37-
TConvertToBase() or
37+
TConvertToNonVirtualBase() or
3838
TConvertToVirtualBase() or
3939
TConvertToDerived() or
4040
TCheckedConvertOrNull() or
@@ -302,8 +302,8 @@ module Opcode {
302302
final override string toString() { result = "Convert" }
303303
}
304304

305-
class ConvertToBase extends UnaryOpcode, TConvertToBase {
306-
final override string toString() { result = "ConvertToBase" }
305+
class ConvertToNonVirtualBase extends UnaryOpcode, TConvertToNonVirtualBase {
306+
final override string toString() { result = "ConvertToNonVirtualBase" }
307307
}
308308

309309
class ConvertToVirtualBase extends UnaryOpcode, TConvertToVirtualBase {

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,8 @@ class InheritanceConversionInstruction extends UnaryInstruction {
980980
* Represents an instruction that converts from the address of a derived class
981981
* to the address of a direct non-virtual base class.
982982
*/
983-
class ConvertToBaseInstruction extends InheritanceConversionInstruction {
984-
ConvertToBaseInstruction() { getOpcode() instanceof Opcode::ConvertToBase }
983+
class ConvertToNonVirtualBaseInstruction extends InheritanceConversionInstruction {
984+
ConvertToNonVirtualBaseInstruction() { getOpcode() instanceof Opcode::ConvertToNonVirtualBase }
985985
}
986986

987987
/**

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasAnalysis.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private predicate operandIsPropagated(Operand operand, IntValue bitOffset) {
109109
instr = operand.getUse() and
110110
(
111111
// Converting to a non-virtual base class adds the offset of the base class.
112-
exists(ConvertToBaseInstruction convert |
112+
exists(ConvertToNonVirtualBaseInstruction convert |
113113
convert = instr and
114114
bitOffset = Ints::mul(convert.getDerivation().getByteOffset(), 8)
115115
)

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,8 @@ class InheritanceConversionInstruction extends UnaryInstruction {
980980
* Represents an instruction that converts from the address of a derived class
981981
* to the address of a direct non-virtual base class.
982982
*/
983-
class ConvertToBaseInstruction extends InheritanceConversionInstruction {
984-
ConvertToBaseInstruction() { getOpcode() instanceof Opcode::ConvertToBase }
983+
class ConvertToNonVirtualBaseInstruction extends InheritanceConversionInstruction {
984+
ConvertToNonVirtualBaseInstruction() { getOpcode() instanceof Opcode::ConvertToNonVirtualBase }
985985
}
986986

987987
/**

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ class TranslatedInheritanceConversion extends TranslatedSingleInstructionConvers
10381038
then
10391039
if expr.(BaseClassConversion).isVirtual()
10401040
then result instanceof Opcode::ConvertToVirtualBase
1041-
else result instanceof Opcode::ConvertToBase
1041+
else result instanceof Opcode::ConvertToNonVirtualBase
10421042
else result instanceof Opcode::ConvertToDerived
10431043
}
10441044
}

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/TranslatedInitialization.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ abstract class TranslatedBaseStructorCall extends TranslatedStructorCallFromStru
752752

753753
final override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
754754
tag = OnlyInstructionTag() and
755-
opcode instanceof Opcode::ConvertToBase and
755+
opcode instanceof Opcode::ConvertToNonVirtualBase and
756756
resultType = getTypeForGLValue(call.getTarget().getDeclaringType())
757757
}
758758

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,8 @@ class InheritanceConversionInstruction extends UnaryInstruction {
980980
* Represents an instruction that converts from the address of a derived class
981981
* to the address of a direct non-virtual base class.
982982
*/
983-
class ConvertToBaseInstruction extends InheritanceConversionInstruction {
984-
ConvertToBaseInstruction() { getOpcode() instanceof Opcode::ConvertToBase }
983+
class ConvertToNonVirtualBaseInstruction extends InheritanceConversionInstruction {
984+
ConvertToNonVirtualBaseInstruction() { getOpcode() instanceof Opcode::ConvertToNonVirtualBase }
985985
}
986986

987987
/**

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/AliasAnalysis.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private predicate operandIsPropagated(Operand operand, IntValue bitOffset) {
109109
instr = operand.getUse() and
110110
(
111111
// Converting to a non-virtual base class adds the offset of the base class.
112-
exists(ConvertToBaseInstruction convert |
112+
exists(ConvertToNonVirtualBaseInstruction convert |
113113
convert = instr and
114114
bitOffset = Ints::mul(convert.getDerivation().getByteOffset(), 8)
115115
)

cpp/ql/test/library-tests/ir/escape/points_to.expected

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
| escape.cpp:146:5:146:18 | CopyValue | no_Point+8:0 | no_Point+8:0 |
3636
| escape.cpp:146:7:146:17 | CopyValue | no_Point+8:0 | no_Point+8:0 |
3737
| escape.cpp:146:17:146:17 | FieldAddress[z] | no_Point+8:0 | no_Point+8:0 |
38-
| escape.cpp:149:5:149:14 | ConvertToBase[Derived : Intermediate1] | no_Derived+0:0 | no_Derived+0:0 |
39-
| escape.cpp:149:5:149:14 | ConvertToBase[Intermediate1 : Base] | no_Derived+0:0 | no_Derived+0:0 |
38+
| escape.cpp:149:5:149:14 | ConvertToNonVirtualBase[Derived : Intermediate1] | no_Derived+0:0 | no_Derived+0:0 |
39+
| escape.cpp:149:5:149:14 | ConvertToNonVirtualBase[Intermediate1 : Base] | no_Derived+0:0 | no_Derived+0:0 |
4040
| escape.cpp:149:16:149:16 | FieldAddress[b] | no_Derived+0:0 | no_Derived+0:0 |
41-
| escape.cpp:150:18:150:27 | ConvertToBase[Derived : Intermediate1] | no_Derived+0:0 | no_Derived+0:0 |
42-
| escape.cpp:150:18:150:27 | ConvertToBase[Intermediate1 : Base] | no_Derived+0:0 | no_Derived+0:0 |
41+
| escape.cpp:150:18:150:27 | ConvertToNonVirtualBase[Derived : Intermediate1] | no_Derived+0:0 | no_Derived+0:0 |
42+
| escape.cpp:150:18:150:27 | ConvertToNonVirtualBase[Intermediate1 : Base] | no_Derived+0:0 | no_Derived+0:0 |
4343
| escape.cpp:150:29:150:29 | FieldAddress[b] | no_Derived+0:0 | no_Derived+0:0 |
44-
| escape.cpp:151:5:151:14 | ConvertToBase[Derived : Intermediate2] | no_Derived+12:0 | no_Derived+12:0 |
44+
| escape.cpp:151:5:151:14 | ConvertToNonVirtualBase[Derived : Intermediate2] | no_Derived+12:0 | no_Derived+12:0 |
4545
| escape.cpp:151:16:151:17 | FieldAddress[i2] | no_Derived+16:0 | no_Derived+16:0 |
46-
| escape.cpp:152:19:152:28 | ConvertToBase[Derived : Intermediate2] | no_Derived+12:0 | no_Derived+12:0 |
46+
| escape.cpp:152:19:152:28 | ConvertToNonVirtualBase[Derived : Intermediate2] | no_Derived+12:0 | no_Derived+12:0 |
4747
| escape.cpp:152:30:152:31 | FieldAddress[i2] | no_Derived+16:0 | no_Derived+16:0 |
4848
| escape.cpp:155:17:155:30 | CopyValue | no_ssa_addrOf+0:0 | no_ssa_addrOf+0:0 |
4949
| escape.cpp:155:17:155:30 | Store | no_ssa_addrOf+0:0 | no_ssa_addrOf+0:0 |

0 commit comments

Comments
 (0)