Skip to content

Commit 3266a89

Browse files
author
Robert Marsh
committed
C++: document DynamicAllocationInstruction
1 parent 3ea3519 commit 3266a89

File tree

5 files changed

+45
-15
lines changed

5 files changed

+45
-15
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,17 +1341,23 @@ class SizedBufferMayWriteSideEffectInstruction extends WriteSideEffectInstructio
13411341
}
13421342

13431343
/**
1344-
*
1344+
* An instruction representing the initial value of newly allocated memory, e.g. the result of a
1345+
* call to `malloc`
13451346
*/
13461347
class InitializeDynamicAllocationInstruction extends SideEffectInstruction {
13471348
InitializeDynamicAllocationInstruction() {
13481349
getOpcode() instanceof Opcode::InitializeDynamicAllocation
13491350
}
1350-
1351+
1352+
/**
1353+
* Gets the address of the allocation this instruction is initializing.
1354+
*/
13511355
final AddressOperand getAllocationAddressOperand() { result = getAnOperand() }
13521356

1357+
/**
1358+
* Gets the operand for the allocation this instruction is initializing.
1359+
*/
13531360
final Instruction getAllocationAddress() { result = getAllocationAddressOperand().getDef() }
1354-
13551361
}
13561362

13571363
/**

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,17 +1341,23 @@ class SizedBufferMayWriteSideEffectInstruction extends WriteSideEffectInstructio
13411341
}
13421342

13431343
/**
1344-
*
1344+
* An instruction representing the initial value of newly allocated memory, e.g. the result of a
1345+
* call to `malloc`
13451346
*/
13461347
class InitializeDynamicAllocationInstruction extends SideEffectInstruction {
13471348
InitializeDynamicAllocationInstruction() {
13481349
getOpcode() instanceof Opcode::InitializeDynamicAllocation
13491350
}
1350-
1351+
1352+
/**
1353+
* Gets the address of the allocation this instruction is initializing.
1354+
*/
13511355
final AddressOperand getAllocationAddressOperand() { result = getAnOperand() }
13521356

1357+
/**
1358+
* Gets the operand for the allocation this instruction is initializing.
1359+
*/
13531360
final Instruction getAllocationAddress() { result = getAllocationAddressOperand().getDef() }
1354-
13551361
}
13561362

13571363
/**

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,17 +1341,23 @@ class SizedBufferMayWriteSideEffectInstruction extends WriteSideEffectInstructio
13411341
}
13421342

13431343
/**
1344-
*
1344+
* An instruction representing the initial value of newly allocated memory, e.g. the result of a
1345+
* call to `malloc`
13451346
*/
13461347
class InitializeDynamicAllocationInstruction extends SideEffectInstruction {
13471348
InitializeDynamicAllocationInstruction() {
13481349
getOpcode() instanceof Opcode::InitializeDynamicAllocation
13491350
}
1350-
1351+
1352+
/**
1353+
* Gets the address of the allocation this instruction is initializing.
1354+
*/
13511355
final AddressOperand getAllocationAddressOperand() { result = getAnOperand() }
13521356

1357+
/**
1358+
* Gets the operand for the allocation this instruction is initializing.
1359+
*/
13531360
final Instruction getAllocationAddress() { result = getAllocationAddressOperand().getDef() }
1354-
13551361
}
13561362

13571363
/**

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,17 +1341,23 @@ class SizedBufferMayWriteSideEffectInstruction extends WriteSideEffectInstructio
13411341
}
13421342

13431343
/**
1344-
*
1344+
* An instruction representing the initial value of newly allocated memory, e.g. the result of a
1345+
* call to `malloc`
13451346
*/
13461347
class InitializeDynamicAllocationInstruction extends SideEffectInstruction {
13471348
InitializeDynamicAllocationInstruction() {
13481349
getOpcode() instanceof Opcode::InitializeDynamicAllocation
13491350
}
1350-
1351+
1352+
/**
1353+
* Gets the address of the allocation this instruction is initializing.
1354+
*/
13511355
final AddressOperand getAllocationAddressOperand() { result = getAnOperand() }
13521356

1357+
/**
1358+
* Gets the operand for the allocation this instruction is initializing.
1359+
*/
13531360
final Instruction getAllocationAddress() { result = getAllocationAddressOperand().getDef() }
1354-
13551361
}
13561362

13571363
/**

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,17 +1341,23 @@ class SizedBufferMayWriteSideEffectInstruction extends WriteSideEffectInstructio
13411341
}
13421342

13431343
/**
1344-
*
1344+
* An instruction representing the initial value of newly allocated memory, e.g. the result of a
1345+
* call to `malloc`
13451346
*/
13461347
class InitializeDynamicAllocationInstruction extends SideEffectInstruction {
13471348
InitializeDynamicAllocationInstruction() {
13481349
getOpcode() instanceof Opcode::InitializeDynamicAllocation
13491350
}
1350-
1351+
1352+
/**
1353+
* Gets the address of the allocation this instruction is initializing.
1354+
*/
13511355
final AddressOperand getAllocationAddressOperand() { result = getAnOperand() }
13521356

1357+
/**
1358+
* Gets the operand for the allocation this instruction is initializing.
1359+
*/
13531360
final Instruction getAllocationAddress() { result = getAllocationAddressOperand().getDef() }
1354-
13551361
}
13561362

13571363
/**

0 commit comments

Comments
 (0)