Skip to content

Commit fe5fbaa

Browse files
committed
C++: Replace hasQualifiedName by hasGlobalName in docs examples
1 parent f6ce270 commit fe5fbaa

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

cpp/ql/test/examples/docs-examples/analyzing-data-flow-in-cpp/exercise4.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import cpp
22
import semmle.code.cpp.dataflow.new.DataFlow
33

44
class GetenvSource extends DataFlow::Node {
5-
GetenvSource() { this.asIndirectExpr(1).(FunctionCall).getTarget().hasQualifiedName("getenv") }
5+
GetenvSource() { this.asIndirectExpr(1).(FunctionCall).getTarget().hasGlobalName("getenv") }
66
}
77

88
class GetenvToGethostbynameConfiguration extends DataFlow::Configuration {

cpp/ql/test/examples/docs-examples/analyzing-data-flow-in-cpp/fopen-flow-from-expr.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import semmle.code.cpp.dataflow.new.DataFlow
33

44
from Function fopen, FunctionCall fc, Expr src, DataFlow::Node source, DataFlow::Node sink
55
where
6-
fopen.hasQualifiedName("fopen") and
6+
fopen.hasGlobalName("fopen") and
77
fc.getTarget() = fopen and
88
source.asIndirectExpr(1) = src and
99
sink.asIndirectExpr(1) = fc.getArgument(0) and

cpp/ql/test/examples/docs-examples/analyzing-data-flow-in-cpp/fopen-flow-from-getenv.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ class EnvironmentToFileConfiguration extends DataFlow::Configuration {
77
override predicate isSource(DataFlow::Node source) {
88
exists(Function getenv |
99
source.asIndirectExpr(1).(FunctionCall).getTarget() = getenv and
10-
getenv.hasQualifiedName("getenv")
10+
getenv.hasGlobalName("getenv")
1111
)
1212
}
1313

1414
override predicate isSink(DataFlow::Node sink) {
1515
exists(FunctionCall fc |
1616
sink.asIndirectExpr(1) = fc.getArgument(0) and
17-
fc.getTarget().hasQualifiedName("fopen")
17+
fc.getTarget().hasGlobalName("fopen")
1818
)
1919
}
2020
}

cpp/ql/test/examples/docs-examples/analyzing-data-flow-in-cpp/fopen-flow-from-param.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import semmle.code.cpp.dataflow.new.DataFlow
33

44
from Function fopen, FunctionCall fc, Parameter p, DataFlow::Node source, DataFlow::Node sink
55
where
6-
fopen.hasQualifiedName("fopen") and
6+
fopen.hasGlobalName("fopen") and
77
fc.getTarget() = fopen and
88
source.asParameter(1) = p and
99
sink.asIndirectExpr(1) = fc.getArgument(0) and

cpp/ql/test/examples/docs-examples/analyzing-data-flow-in-cpp/fopen-no-flow.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import cpp
22

33
from Function fopen, FunctionCall fc
44
where
5-
fopen.hasQualifiedName("fopen") and
5+
fopen.hasGlobalName("fopen") and
66
fc.getTarget() = fopen
77
select fc.getArgument(0)

docs/codeql/codeql-language-guides/analyzing-data-flow-in-cpp-new.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ The following query finds the filename passed to ``fopen``.
9797
9898
from Function fopen, FunctionCall fc
9999
where
100-
fopen.hasQualifiedName("fopen") and
100+
fopen.hasGlobalName("fopen") and
101101
fc.getTarget() = fopen
102102
select fc.getArgument(0)
103103
@@ -110,7 +110,7 @@ Unfortunately, this will only give the expression in the argument, not the value
110110
111111
from Function fopen, FunctionCall fc, Expr src, DataFlow::Node source, DataFlow::Node sink
112112
where
113-
fopen.hasQualifiedName("fopen") and
113+
fopen.hasGlobalName("fopen") and
114114
fc.getTarget() = fopen and
115115
source.asIndirectExpr(1) = src and
116116
sink.asIndirectExpr(1) = fc.getArgument(0) and
@@ -126,7 +126,7 @@ Then we can vary the source and, for example, use the parameter of a function. T
126126
127127
from Function fopen, FunctionCall fc, Parameter p, DataFlow::Node source, DataFlow::Node sink
128128
where
129-
fopen.hasQualifiedName("fopen") and
129+
fopen.hasGlobalName("fopen") and
130130
fc.getTarget() = fopen and
131131
source.asParameter(1) = p and
132132
sink.asIndirectExpr(1) = fc.getArgument(0) and
@@ -253,14 +253,14 @@ The following data flow configuration tracks data flow from environment variable
253253
override predicate isSource(DataFlow::Node source) {
254254
exists(Function getenv |
255255
source.asIndirectExpr(1).(FunctionCall).getTarget() = getenv and
256-
getenv.hasQualifiedName("getenv")
256+
getenv.hasGlobalName("getenv")
257257
)
258258
}
259259
260260
override predicate isSink(DataFlow::Node sink) {
261261
exists(FunctionCall fc |
262262
sink.asIndirectExpr(1) = fc.getArgument(0) and
263-
fc.getTarget().hasQualifiedName("fopen")
263+
fc.getTarget().hasGlobalName("fopen")
264264
)
265265
}
266266
}
@@ -386,7 +386,7 @@ Exercise 3
386386
import semmle.code.cpp.dataflow.new.DataFlow
387387
388388
class GetenvSource extends DataFlow::Node {
389-
GetenvSource() { this.asIndirectExpr(1).(FunctionCall).getTarget().hasQualifiedName("getenv") }
389+
GetenvSource() { this.asIndirectExpr(1).(FunctionCall).getTarget().hasGlobalName("getenv") }
390390
}
391391
392392
Exercise 4
@@ -398,7 +398,7 @@ Exercise 4
398398
import semmle.code.cpp.dataflow.new.DataFlow
399399
400400
class GetenvSource extends DataFlow::Node {
401-
GetenvSource() { this.asIndirectExpr(1).(FunctionCall).getTarget().hasQualifiedName("getenv") }
401+
GetenvSource() { this.asIndirectExpr(1).(FunctionCall).getTarget().hasGlobalName("getenv") }
402402
}
403403
404404
class GetenvToGethostbynameConfiguration extends DataFlow::Configuration {

docs/codeql/codeql-language-guides/analyzing-data-flow-in-cpp.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ The following query finds the filename passed to ``fopen``.
8888
import cpp
8989
9090
from Function fopen, FunctionCall fc
91-
where fopen.hasQualifiedName("fopen")
91+
where fopen.hasGlobalName("fopen")
9292
and fc.getTarget() = fopen
9393
select fc.getArgument(0)
9494
@@ -100,7 +100,7 @@ Unfortunately, this will only give the expression in the argument, not the value
100100
import semmle.code.cpp.dataflow.DataFlow
101101
102102
from Function fopen, FunctionCall fc, Expr src
103-
where fopen.hasQualifiedName("fopen")
103+
where fopen.hasGlobalName("fopen")
104104
and fc.getTarget() = fopen
105105
and DataFlow::localFlow(DataFlow::exprNode(src), DataFlow::exprNode(fc.getArgument(0)))
106106
select src
@@ -113,7 +113,7 @@ Then we can vary the source and, for example, use the parameter of a function. T
113113
import semmle.code.cpp.dataflow.DataFlow
114114
115115
from Function fopen, FunctionCall fc, Parameter p
116-
where fopen.hasQualifiedName("fopen")
116+
where fopen.hasGlobalName("fopen")
117117
and fc.getTarget() = fopen
118118
and DataFlow::localFlow(DataFlow::parameterNode(p), DataFlow::exprNode(fc.getArgument(0)))
119119
select p
@@ -236,14 +236,14 @@ The following data flow configuration tracks data flow from environment variable
236236
override predicate isSource(DataFlow::Node source) {
237237
exists (Function getenv |
238238
source.asExpr().(FunctionCall).getTarget() = getenv and
239-
getenv.hasQualifiedName("getenv")
239+
getenv.hasGlobalName("getenv")
240240
)
241241
}
242242
243243
override predicate isSink(DataFlow::Node sink) {
244244
exists (FunctionCall fc |
245245
sink.asExpr() = fc.getArgument(0) and
246-
fc.getTarget().hasQualifiedName("fopen")
246+
fc.getTarget().hasGlobalName("fopen")
247247
)
248248
}
249249
}
@@ -356,7 +356,7 @@ Exercise 3
356356
357357
class GetenvSource extends FunctionCall {
358358
GetenvSource() {
359-
this.getTarget().hasQualifiedName("getenv")
359+
this.getTarget().hasGlobalName("getenv")
360360
}
361361
}
362362
@@ -369,7 +369,7 @@ Exercise 4
369369
370370
class GetenvSource extends DataFlow::Node {
371371
GetenvSource() {
372-
this.asExpr().(FunctionCall).getTarget().hasQualifiedName("getenv")
372+
this.asExpr().(FunctionCall).getTarget().hasGlobalName("getenv")
373373
}
374374
}
375375

0 commit comments

Comments
 (0)