Skip to content

Commit b889d36

Browse files
author
Dave Bartolomeo
committed
C++: Fix QLDoc review feedback
1 parent 3b4cd70 commit b889d36

File tree

5 files changed

+105
-30
lines changed

5 files changed

+105
-30
lines changed

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

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private Instruction getAnInstructionAtLine(IRFunction irFunc, Language::File fil
3131
}
3232

3333
/**
34-
* A single operation in the IR.
34+
* A single instruction in the IR.
3535
*/
3636
class Instruction extends Construction::TStageInstruction {
3737
Instruction() {
@@ -635,6 +635,14 @@ class NoOpInstruction extends Instruction {
635635
* This instruction represents the normal (non-exception) return from a function, either from an
636636
* explicit `return` statement or from control flow reaching the end of the function's body.
637637
*
638+
* Each function has exactly one `ReturnInstruction`. Each `return` statement in a function is
639+
* represented as an initialization of the temporary variable that holds the return value, with
640+
* control then flowing to the common `ReturnInstruction` for that function. Exception: A function
641+
* that never returns will not have a `ReturnInstruction`.
642+
*
643+
* The `ReturnInstruction` for a function will have a control-flow successor edge to a block
644+
* containing the `ExitFunction` instruction for that function.
645+
*
638646
* There are two differet return instructions: `ReturnValueInstruction`, for returning a value from
639647
* a non-`void`-returning function, and `ReturnVoidInstruction`, for returning from a
640648
* `void`-returning function.
@@ -669,7 +677,13 @@ class ReturnValueInstruction extends ReturnInstruction {
669677
}
670678

671679
/**
672-
* An instruction that returns the value pointed to by a parameter of the function to the caller.
680+
* An instruction that represents the use of the value pointed to by a parameter of the function
681+
* after the function returns control to its caller.
682+
*
683+
* This instruction does not itself return control to the caller. It merely represents the potential
684+
* for a caller to use the memory pointed to by the parameter sometime after the call returns. This
685+
* is the counterpart to the `InitializeIndirection` instruction, which represents the possibility
686+
* that the caller initialized the memory pointed to by the parameter before the call.
673687
*/
674688
class ReturnIndirectionInstruction extends VariableInstruction {
675689
ReturnIndirectionInstruction() { getOpcode() instanceof Opcode::ReturnIndirection }
@@ -1100,10 +1114,11 @@ class PointerSubInstruction extends PointerOffsetInstruction {
11001114
/**
11011115
* An instruction that computes the difference between two pointers.
11021116
*
1103-
* The result must have an integer type whose size is the same as that of the pointer operands. The
1104-
* result is computed by subtracting the byte address in the right operand from the byte address in
1105-
* the left operand, and dividing by the element size. If the difference in byte addresses is not
1106-
* divisible by the element size, the result is undefined.
1117+
* Both operands must have the same pointer type. The result must have an integer type whose size is
1118+
* the same as that of the pointer operands. The result is computed by subtracting the byte address
1119+
* in the right operand from the byte address in the left operand, and dividing by the element size.
1120+
* If the difference in byte addresses is not divisible by the element size, the result is
1121+
* undefined.
11071122
*/
11081123
class PointerDiffInstruction extends PointerArithmeticInstruction {
11091124
PointerDiffInstruction() { getOpcode() instanceof Opcode::PointerDiff }

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

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private Instruction getAnInstructionAtLine(IRFunction irFunc, Language::File fil
3131
}
3232

3333
/**
34-
* A single operation in the IR.
34+
* A single instruction in the IR.
3535
*/
3636
class Instruction extends Construction::TStageInstruction {
3737
Instruction() {
@@ -635,6 +635,14 @@ class NoOpInstruction extends Instruction {
635635
* This instruction represents the normal (non-exception) return from a function, either from an
636636
* explicit `return` statement or from control flow reaching the end of the function's body.
637637
*
638+
* Each function has exactly one `ReturnInstruction`. Each `return` statement in a function is
639+
* represented as an initialization of the temporary variable that holds the return value, with
640+
* control then flowing to the common `ReturnInstruction` for that function. Exception: A function
641+
* that never returns will not have a `ReturnInstruction`.
642+
*
643+
* The `ReturnInstruction` for a function will have a control-flow successor edge to a block
644+
* containing the `ExitFunction` instruction for that function.
645+
*
638646
* There are two differet return instructions: `ReturnValueInstruction`, for returning a value from
639647
* a non-`void`-returning function, and `ReturnVoidInstruction`, for returning from a
640648
* `void`-returning function.
@@ -669,7 +677,13 @@ class ReturnValueInstruction extends ReturnInstruction {
669677
}
670678

671679
/**
672-
* An instruction that returns the value pointed to by a parameter of the function to the caller.
680+
* An instruction that represents the use of the value pointed to by a parameter of the function
681+
* after the function returns control to its caller.
682+
*
683+
* This instruction does not itself return control to the caller. It merely represents the potential
684+
* for a caller to use the memory pointed to by the parameter sometime after the call returns. This
685+
* is the counterpart to the `InitializeIndirection` instruction, which represents the possibility
686+
* that the caller initialized the memory pointed to by the parameter before the call.
673687
*/
674688
class ReturnIndirectionInstruction extends VariableInstruction {
675689
ReturnIndirectionInstruction() { getOpcode() instanceof Opcode::ReturnIndirection }
@@ -1100,10 +1114,11 @@ class PointerSubInstruction extends PointerOffsetInstruction {
11001114
/**
11011115
* An instruction that computes the difference between two pointers.
11021116
*
1103-
* The result must have an integer type whose size is the same as that of the pointer operands. The
1104-
* result is computed by subtracting the byte address in the right operand from the byte address in
1105-
* the left operand, and dividing by the element size. If the difference in byte addresses is not
1106-
* divisible by the element size, the result is undefined.
1117+
* Both operands must have the same pointer type. The result must have an integer type whose size is
1118+
* the same as that of the pointer operands. The result is computed by subtracting the byte address
1119+
* in the right operand from the byte address in the left operand, and dividing by the element size.
1120+
* If the difference in byte addresses is not divisible by the element size, the result is
1121+
* undefined.
11071122
*/
11081123
class PointerDiffInstruction extends PointerArithmeticInstruction {
11091124
PointerDiffInstruction() { getOpcode() instanceof Opcode::PointerDiff }

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

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private Instruction getAnInstructionAtLine(IRFunction irFunc, Language::File fil
3131
}
3232

3333
/**
34-
* A single operation in the IR.
34+
* A single instruction in the IR.
3535
*/
3636
class Instruction extends Construction::TStageInstruction {
3737
Instruction() {
@@ -635,6 +635,14 @@ class NoOpInstruction extends Instruction {
635635
* This instruction represents the normal (non-exception) return from a function, either from an
636636
* explicit `return` statement or from control flow reaching the end of the function's body.
637637
*
638+
* Each function has exactly one `ReturnInstruction`. Each `return` statement in a function is
639+
* represented as an initialization of the temporary variable that holds the return value, with
640+
* control then flowing to the common `ReturnInstruction` for that function. Exception: A function
641+
* that never returns will not have a `ReturnInstruction`.
642+
*
643+
* The `ReturnInstruction` for a function will have a control-flow successor edge to a block
644+
* containing the `ExitFunction` instruction for that function.
645+
*
638646
* There are two differet return instructions: `ReturnValueInstruction`, for returning a value from
639647
* a non-`void`-returning function, and `ReturnVoidInstruction`, for returning from a
640648
* `void`-returning function.
@@ -669,7 +677,13 @@ class ReturnValueInstruction extends ReturnInstruction {
669677
}
670678

671679
/**
672-
* An instruction that returns the value pointed to by a parameter of the function to the caller.
680+
* An instruction that represents the use of the value pointed to by a parameter of the function
681+
* after the function returns control to its caller.
682+
*
683+
* This instruction does not itself return control to the caller. It merely represents the potential
684+
* for a caller to use the memory pointed to by the parameter sometime after the call returns. This
685+
* is the counterpart to the `InitializeIndirection` instruction, which represents the possibility
686+
* that the caller initialized the memory pointed to by the parameter before the call.
673687
*/
674688
class ReturnIndirectionInstruction extends VariableInstruction {
675689
ReturnIndirectionInstruction() { getOpcode() instanceof Opcode::ReturnIndirection }
@@ -1100,10 +1114,11 @@ class PointerSubInstruction extends PointerOffsetInstruction {
11001114
/**
11011115
* An instruction that computes the difference between two pointers.
11021116
*
1103-
* The result must have an integer type whose size is the same as that of the pointer operands. The
1104-
* result is computed by subtracting the byte address in the right operand from the byte address in
1105-
* the left operand, and dividing by the element size. If the difference in byte addresses is not
1106-
* divisible by the element size, the result is undefined.
1117+
* Both operands must have the same pointer type. The result must have an integer type whose size is
1118+
* the same as that of the pointer operands. The result is computed by subtracting the byte address
1119+
* in the right operand from the byte address in the left operand, and dividing by the element size.
1120+
* If the difference in byte addresses is not divisible by the element size, the result is
1121+
* undefined.
11071122
*/
11081123
class PointerDiffInstruction extends PointerArithmeticInstruction {
11091124
PointerDiffInstruction() { getOpcode() instanceof Opcode::PointerDiff }

csharp/ql/src/experimental/ir/implementation/raw/Instruction.qll

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private Instruction getAnInstructionAtLine(IRFunction irFunc, Language::File fil
3131
}
3232

3333
/**
34-
* A single operation in the IR.
34+
* A single instruction in the IR.
3535
*/
3636
class Instruction extends Construction::TStageInstruction {
3737
Instruction() {
@@ -635,6 +635,14 @@ class NoOpInstruction extends Instruction {
635635
* This instruction represents the normal (non-exception) return from a function, either from an
636636
* explicit `return` statement or from control flow reaching the end of the function's body.
637637
*
638+
* Each function has exactly one `ReturnInstruction`. Each `return` statement in a function is
639+
* represented as an initialization of the temporary variable that holds the return value, with
640+
* control then flowing to the common `ReturnInstruction` for that function. Exception: A function
641+
* that never returns will not have a `ReturnInstruction`.
642+
*
643+
* The `ReturnInstruction` for a function will have a control-flow successor edge to a block
644+
* containing the `ExitFunction` instruction for that function.
645+
*
638646
* There are two differet return instructions: `ReturnValueInstruction`, for returning a value from
639647
* a non-`void`-returning function, and `ReturnVoidInstruction`, for returning from a
640648
* `void`-returning function.
@@ -669,7 +677,13 @@ class ReturnValueInstruction extends ReturnInstruction {
669677
}
670678

671679
/**
672-
* An instruction that returns the value pointed to by a parameter of the function to the caller.
680+
* An instruction that represents the use of the value pointed to by a parameter of the function
681+
* after the function returns control to its caller.
682+
*
683+
* This instruction does not itself return control to the caller. It merely represents the potential
684+
* for a caller to use the memory pointed to by the parameter sometime after the call returns. This
685+
* is the counterpart to the `InitializeIndirection` instruction, which represents the possibility
686+
* that the caller initialized the memory pointed to by the parameter before the call.
673687
*/
674688
class ReturnIndirectionInstruction extends VariableInstruction {
675689
ReturnIndirectionInstruction() { getOpcode() instanceof Opcode::ReturnIndirection }
@@ -1100,10 +1114,11 @@ class PointerSubInstruction extends PointerOffsetInstruction {
11001114
/**
11011115
* An instruction that computes the difference between two pointers.
11021116
*
1103-
* The result must have an integer type whose size is the same as that of the pointer operands. The
1104-
* result is computed by subtracting the byte address in the right operand from the byte address in
1105-
* the left operand, and dividing by the element size. If the difference in byte addresses is not
1106-
* divisible by the element size, the result is undefined.
1117+
* Both operands must have the same pointer type. The result must have an integer type whose size is
1118+
* the same as that of the pointer operands. The result is computed by subtracting the byte address
1119+
* in the right operand from the byte address in the left operand, and dividing by the element size.
1120+
* If the difference in byte addresses is not divisible by the element size, the result is
1121+
* undefined.
11071122
*/
11081123
class PointerDiffInstruction extends PointerArithmeticInstruction {
11091124
PointerDiffInstruction() { getOpcode() instanceof Opcode::PointerDiff }

csharp/ql/src/experimental/ir/implementation/unaliased_ssa/Instruction.qll

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private Instruction getAnInstructionAtLine(IRFunction irFunc, Language::File fil
3131
}
3232

3333
/**
34-
* A single operation in the IR.
34+
* A single instruction in the IR.
3535
*/
3636
class Instruction extends Construction::TStageInstruction {
3737
Instruction() {
@@ -635,6 +635,14 @@ class NoOpInstruction extends Instruction {
635635
* This instruction represents the normal (non-exception) return from a function, either from an
636636
* explicit `return` statement or from control flow reaching the end of the function's body.
637637
*
638+
* Each function has exactly one `ReturnInstruction`. Each `return` statement in a function is
639+
* represented as an initialization of the temporary variable that holds the return value, with
640+
* control then flowing to the common `ReturnInstruction` for that function. Exception: A function
641+
* that never returns will not have a `ReturnInstruction`.
642+
*
643+
* The `ReturnInstruction` for a function will have a control-flow successor edge to a block
644+
* containing the `ExitFunction` instruction for that function.
645+
*
638646
* There are two differet return instructions: `ReturnValueInstruction`, for returning a value from
639647
* a non-`void`-returning function, and `ReturnVoidInstruction`, for returning from a
640648
* `void`-returning function.
@@ -669,7 +677,13 @@ class ReturnValueInstruction extends ReturnInstruction {
669677
}
670678

671679
/**
672-
* An instruction that returns the value pointed to by a parameter of the function to the caller.
680+
* An instruction that represents the use of the value pointed to by a parameter of the function
681+
* after the function returns control to its caller.
682+
*
683+
* This instruction does not itself return control to the caller. It merely represents the potential
684+
* for a caller to use the memory pointed to by the parameter sometime after the call returns. This
685+
* is the counterpart to the `InitializeIndirection` instruction, which represents the possibility
686+
* that the caller initialized the memory pointed to by the parameter before the call.
673687
*/
674688
class ReturnIndirectionInstruction extends VariableInstruction {
675689
ReturnIndirectionInstruction() { getOpcode() instanceof Opcode::ReturnIndirection }
@@ -1100,10 +1114,11 @@ class PointerSubInstruction extends PointerOffsetInstruction {
11001114
/**
11011115
* An instruction that computes the difference between two pointers.
11021116
*
1103-
* The result must have an integer type whose size is the same as that of the pointer operands. The
1104-
* result is computed by subtracting the byte address in the right operand from the byte address in
1105-
* the left operand, and dividing by the element size. If the difference in byte addresses is not
1106-
* divisible by the element size, the result is undefined.
1117+
* Both operands must have the same pointer type. The result must have an integer type whose size is
1118+
* the same as that of the pointer operands. The result is computed by subtracting the byte address
1119+
* in the right operand from the byte address in the left operand, and dividing by the element size.
1120+
* If the difference in byte addresses is not divisible by the element size, the result is
1121+
* undefined.
11071122
*/
11081123
class PointerDiffInstruction extends PointerArithmeticInstruction {
11091124
PointerDiffInstruction() { getOpcode() instanceof Opcode::PointerDiff }

0 commit comments

Comments
 (0)