Skip to content

Commit 2043d9c

Browse files
author
Dave Bartolomeo
committed
C++: QLDoc for Operand.qll
1 parent ead2a14 commit 2043d9c

File tree

5 files changed

+115
-0
lines changed

5 files changed

+115
-0
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes that represent the input values of IR instructions.
3+
*/
4+
15
private import internal.IRInternal
26
private import Instruction
37
private import IRBlock
@@ -78,10 +82,17 @@ private PhiOperandBase phiOperand(
7882
* A source operand of an `Instruction`. The operand represents a value consumed by the instruction.
7983
*/
8084
class Operand extends TOperand {
85+
/** Gets a textual representation of this element. */
8186
string toString() { result = "Operand" }
8287

88+
/**
89+
* Gets the location of the source code for this operand.
90+
*/
8391
final Language::Location getLocation() { result = getUse().getLocation() }
8492

93+
/**
94+
* Gets the function that contains this operand.
95+
*/
8596
final IRFunction getEnclosingIRFunction() { result = getUse().getEnclosingIRFunction() }
8697

8798
/**
@@ -270,6 +281,9 @@ class NonPhiOperand extends Operand {
270281

271282
final override int getDumpSortOrder() { result = tag.getSortOrder() }
272283

284+
/**
285+
* Gets the `OperandTag` that specifies how this operand is used by its `Instruction`.
286+
*/
273287
final OperandTag getOperandTag() { result = tag }
274288
}
275289

@@ -292,6 +306,9 @@ class RegisterOperand extends NonPhiOperand, RegisterOperandBase {
292306
}
293307
}
294308

309+
/**
310+
* A memory operand other than the operand of a `Phi` instruction.
311+
*/
295312
class NonPhiMemoryOperand extends NonPhiOperand, MemoryOperand, NonPhiMemoryOperandBase {
296313
override MemoryOperandTag tag;
297314

@@ -313,6 +330,9 @@ class NonPhiMemoryOperand extends NonPhiOperand, MemoryOperand, NonPhiMemoryOper
313330
}
314331
}
315332

333+
/**
334+
* A memory operand whose type may be different from the type of the result of its definition.
335+
*/
316336
class TypedOperand extends NonPhiMemoryOperand {
317337
override TypedOperandTag tag;
318338

@@ -416,6 +436,9 @@ class PositionalArgumentOperand extends ArgumentOperand {
416436
final int getIndex() { result = tag.getArgIndex() }
417437
}
418438

439+
/**
440+
* An operand representing memory read as a side effect of evaluating another instruction.
441+
*/
419442
class SideEffectOperand extends TypedOperand {
420443
override SideEffectOperandTag tag;
421444
}

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes that represent the input values of IR instructions.
3+
*/
4+
15
private import internal.IRInternal
26
private import Instruction
37
private import IRBlock
@@ -78,10 +82,17 @@ private PhiOperandBase phiOperand(
7882
* A source operand of an `Instruction`. The operand represents a value consumed by the instruction.
7983
*/
8084
class Operand extends TOperand {
85+
/** Gets a textual representation of this element. */
8186
string toString() { result = "Operand" }
8287

88+
/**
89+
* Gets the location of the source code for this operand.
90+
*/
8391
final Language::Location getLocation() { result = getUse().getLocation() }
8492

93+
/**
94+
* Gets the function that contains this operand.
95+
*/
8596
final IRFunction getEnclosingIRFunction() { result = getUse().getEnclosingIRFunction() }
8697

8798
/**
@@ -270,6 +281,9 @@ class NonPhiOperand extends Operand {
270281

271282
final override int getDumpSortOrder() { result = tag.getSortOrder() }
272283

284+
/**
285+
* Gets the `OperandTag` that specifies how this operand is used by its `Instruction`.
286+
*/
273287
final OperandTag getOperandTag() { result = tag }
274288
}
275289

@@ -292,6 +306,9 @@ class RegisterOperand extends NonPhiOperand, RegisterOperandBase {
292306
}
293307
}
294308

309+
/**
310+
* A memory operand other than the operand of a `Phi` instruction.
311+
*/
295312
class NonPhiMemoryOperand extends NonPhiOperand, MemoryOperand, NonPhiMemoryOperandBase {
296313
override MemoryOperandTag tag;
297314

@@ -313,6 +330,9 @@ class NonPhiMemoryOperand extends NonPhiOperand, MemoryOperand, NonPhiMemoryOper
313330
}
314331
}
315332

333+
/**
334+
* A memory operand whose type may be different from the type of the result of its definition.
335+
*/
316336
class TypedOperand extends NonPhiMemoryOperand {
317337
override TypedOperandTag tag;
318338

@@ -416,6 +436,9 @@ class PositionalArgumentOperand extends ArgumentOperand {
416436
final int getIndex() { result = tag.getArgIndex() }
417437
}
418438

439+
/**
440+
* An operand representing memory read as a side effect of evaluating another instruction.
441+
*/
419442
class SideEffectOperand extends TypedOperand {
420443
override SideEffectOperandTag tag;
421444
}

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes that represent the input values of IR instructions.
3+
*/
4+
15
private import internal.IRInternal
26
private import Instruction
37
private import IRBlock
@@ -78,10 +82,17 @@ private PhiOperandBase phiOperand(
7882
* A source operand of an `Instruction`. The operand represents a value consumed by the instruction.
7983
*/
8084
class Operand extends TOperand {
85+
/** Gets a textual representation of this element. */
8186
string toString() { result = "Operand" }
8287

88+
/**
89+
* Gets the location of the source code for this operand.
90+
*/
8391
final Language::Location getLocation() { result = getUse().getLocation() }
8492

93+
/**
94+
* Gets the function that contains this operand.
95+
*/
8596
final IRFunction getEnclosingIRFunction() { result = getUse().getEnclosingIRFunction() }
8697

8798
/**
@@ -270,6 +281,9 @@ class NonPhiOperand extends Operand {
270281

271282
final override int getDumpSortOrder() { result = tag.getSortOrder() }
272283

284+
/**
285+
* Gets the `OperandTag` that specifies how this operand is used by its `Instruction`.
286+
*/
273287
final OperandTag getOperandTag() { result = tag }
274288
}
275289

@@ -292,6 +306,9 @@ class RegisterOperand extends NonPhiOperand, RegisterOperandBase {
292306
}
293307
}
294308

309+
/**
310+
* A memory operand other than the operand of a `Phi` instruction.
311+
*/
295312
class NonPhiMemoryOperand extends NonPhiOperand, MemoryOperand, NonPhiMemoryOperandBase {
296313
override MemoryOperandTag tag;
297314

@@ -313,6 +330,9 @@ class NonPhiMemoryOperand extends NonPhiOperand, MemoryOperand, NonPhiMemoryOper
313330
}
314331
}
315332

333+
/**
334+
* A memory operand whose type may be different from the type of the result of its definition.
335+
*/
316336
class TypedOperand extends NonPhiMemoryOperand {
317337
override TypedOperandTag tag;
318338

@@ -416,6 +436,9 @@ class PositionalArgumentOperand extends ArgumentOperand {
416436
final int getIndex() { result = tag.getArgIndex() }
417437
}
418438

439+
/**
440+
* An operand representing memory read as a side effect of evaluating another instruction.
441+
*/
419442
class SideEffectOperand extends TypedOperand {
420443
override SideEffectOperandTag tag;
421444
}

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes that represent the input values of IR instructions.
3+
*/
4+
15
private import internal.IRInternal
26
private import Instruction
37
private import IRBlock
@@ -78,10 +82,17 @@ private PhiOperandBase phiOperand(
7882
* A source operand of an `Instruction`. The operand represents a value consumed by the instruction.
7983
*/
8084
class Operand extends TOperand {
85+
/** Gets a textual representation of this element. */
8186
string toString() { result = "Operand" }
8287

88+
/**
89+
* Gets the location of the source code for this operand.
90+
*/
8391
final Language::Location getLocation() { result = getUse().getLocation() }
8492

93+
/**
94+
* Gets the function that contains this operand.
95+
*/
8596
final IRFunction getEnclosingIRFunction() { result = getUse().getEnclosingIRFunction() }
8697

8798
/**
@@ -270,6 +281,9 @@ class NonPhiOperand extends Operand {
270281

271282
final override int getDumpSortOrder() { result = tag.getSortOrder() }
272283

284+
/**
285+
* Gets the `OperandTag` that specifies how this operand is used by its `Instruction`.
286+
*/
273287
final OperandTag getOperandTag() { result = tag }
274288
}
275289

@@ -292,6 +306,9 @@ class RegisterOperand extends NonPhiOperand, RegisterOperandBase {
292306
}
293307
}
294308

309+
/**
310+
* A memory operand other than the operand of a `Phi` instruction.
311+
*/
295312
class NonPhiMemoryOperand extends NonPhiOperand, MemoryOperand, NonPhiMemoryOperandBase {
296313
override MemoryOperandTag tag;
297314

@@ -313,6 +330,9 @@ class NonPhiMemoryOperand extends NonPhiOperand, MemoryOperand, NonPhiMemoryOper
313330
}
314331
}
315332

333+
/**
334+
* A memory operand whose type may be different from the type of the result of its definition.
335+
*/
316336
class TypedOperand extends NonPhiMemoryOperand {
317337
override TypedOperandTag tag;
318338

@@ -416,6 +436,9 @@ class PositionalArgumentOperand extends ArgumentOperand {
416436
final int getIndex() { result = tag.getArgIndex() }
417437
}
418438

439+
/**
440+
* An operand representing memory read as a side effect of evaluating another instruction.
441+
*/
419442
class SideEffectOperand extends TypedOperand {
420443
override SideEffectOperandTag tag;
421444
}

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes that represent the input values of IR instructions.
3+
*/
4+
15
private import internal.IRInternal
26
private import Instruction
37
private import IRBlock
@@ -78,10 +82,17 @@ private PhiOperandBase phiOperand(
7882
* A source operand of an `Instruction`. The operand represents a value consumed by the instruction.
7983
*/
8084
class Operand extends TOperand {
85+
/** Gets a textual representation of this element. */
8186
string toString() { result = "Operand" }
8287

88+
/**
89+
* Gets the location of the source code for this operand.
90+
*/
8391
final Language::Location getLocation() { result = getUse().getLocation() }
8492

93+
/**
94+
* Gets the function that contains this operand.
95+
*/
8596
final IRFunction getEnclosingIRFunction() { result = getUse().getEnclosingIRFunction() }
8697

8798
/**
@@ -270,6 +281,9 @@ class NonPhiOperand extends Operand {
270281

271282
final override int getDumpSortOrder() { result = tag.getSortOrder() }
272283

284+
/**
285+
* Gets the `OperandTag` that specifies how this operand is used by its `Instruction`.
286+
*/
273287
final OperandTag getOperandTag() { result = tag }
274288
}
275289

@@ -292,6 +306,9 @@ class RegisterOperand extends NonPhiOperand, RegisterOperandBase {
292306
}
293307
}
294308

309+
/**
310+
* A memory operand other than the operand of a `Phi` instruction.
311+
*/
295312
class NonPhiMemoryOperand extends NonPhiOperand, MemoryOperand, NonPhiMemoryOperandBase {
296313
override MemoryOperandTag tag;
297314

@@ -313,6 +330,9 @@ class NonPhiMemoryOperand extends NonPhiOperand, MemoryOperand, NonPhiMemoryOper
313330
}
314331
}
315332

333+
/**
334+
* A memory operand whose type may be different from the type of the result of its definition.
335+
*/
316336
class TypedOperand extends NonPhiMemoryOperand {
317337
override TypedOperandTag tag;
318338

@@ -416,6 +436,9 @@ class PositionalArgumentOperand extends ArgumentOperand {
416436
final int getIndex() { result = tag.getArgIndex() }
417437
}
418438

439+
/**
440+
* An operand representing memory read as a side effect of evaluating another instruction.
441+
*/
419442
class SideEffectOperand extends TypedOperand {
420443
override SideEffectOperandTag tag;
421444
}

0 commit comments

Comments
 (0)