Skip to content

Commit 4c44c84

Browse files
committed
C++: Add QLdoc in Initializer.qll-Macro.qll
1 parent d2d235d commit 4c44c84

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

cpp/ql/src/semmle/code/cpp/Initializer.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides the `Initializer` class, representing C/C++ declaration initializers.
3+
*/
4+
15
import semmle.code.cpp.controlflow.ControlFlowGraph
26

37
/**

cpp/ql/src/semmle/code/cpp/Iteration.qll

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes for loop iteration variables.
3+
*/
4+
15
import semmle.code.cpp.Variable
26

37
/**
@@ -7,14 +11,18 @@ import semmle.code.cpp.Variable
711
class LoopCounter extends Variable {
812
LoopCounter() { exists(ForStmt f | f.getAnIterationVariable() = this) }
913

10-
// Gets an access of this variable within loop `f`.
14+
/**
15+
* Gets an access of this variable within loop `f`.
16+
*/
1117
VariableAccess getVariableAccessInLoop(ForStmt f) {
1218
this.getALoop() = f and
1319
result.getEnclosingStmt().getParent*() = f and
1420
this = result.getTarget()
1521
}
1622

17-
// Gets a loop which uses this variable as its counter.
23+
/**
24+
* Gets a loop which uses this variable as its counter.
25+
*/
1826
ForStmt getALoop() { result.getAnIterationVariable() = this }
1927
}
2028

@@ -25,14 +33,18 @@ class LoopCounter extends Variable {
2533
class LoopControlVariable extends Variable {
2634
LoopControlVariable() { this = loopControlVariable(_) }
2735

28-
// Gets an access of this variable within loop `f`.
36+
/**
37+
* Gets an access of this variable within loop `f`.
38+
*/
2939
VariableAccess getVariableAccessInLoop(ForStmt f) {
3040
this.getALoop() = f and
3141
result.getEnclosingStmt().getParent*() = f and
3242
this = result.getTarget()
3343
}
3444

35-
// Gets a loop which uses this variable as its control variable.
45+
/**
46+
* Gets a loop which uses this variable as its control variable.
47+
*/
3648
ForStmt getALoop() { this = loopControlVariable(result) }
3749
}
3850

cpp/ql/src/semmle/code/cpp/Linkage.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Proivdes the `LinkTarget` class representing linker invocations at compile time.
3+
*/
4+
15
import semmle.code.cpp.Class
26
import semmle.code.cpp.File
37
import semmle.code.cpp.Function

cpp/ql/src/semmle/code/cpp/Location.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes and predicates for locations in the source code.
3+
*/
4+
15
import semmle.code.cpp.Element
26
import semmle.code.cpp.File
37

cpp/ql/src/semmle/code/cpp/Macro.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ class MacroInvocation extends MacroAccess {
179179
result.(Stmt).getGeneratingMacro() = this
180180
}
181181

182+
/**
183+
* Gets a function that includes an expression that is affected by this macro
184+
* invocation. If the macro expansion includes the end of one function and
185+
* the beginning of another, this predicate will get both.
186+
*/
182187
Function getEnclosingFunction() {
183188
result = this.getAnAffectedElement().(Expr).getEnclosingFunction()
184189
}

0 commit comments

Comments
 (0)