Skip to content

Commit 5039e55

Browse files
authored
Merge branch 'main' into mbaluda/importMisra23
2 parents 0804158 + 90abc2d commit 5039e55

File tree

31 files changed

+151
-151
lines changed

31 files changed

+151
-151
lines changed

c/cert/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cert-c-coding-standards
2-
version: 2.29.0-dev
2+
version: 2.30.0-dev
33
description: CERT C 2016
44
suites: codeql-suites
55
license: MIT

c/cert/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cert-c-coding-standards-tests
2-
version: 2.29.0-dev
2+
version: 2.30.0-dev
33
extractor: cpp
44
license: MIT
55
dependencies:

c/common/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/common-c-coding-standards
2-
version: 2.29.0-dev
2+
version: 2.30.0-dev
33
license: MIT
44
dependencies:
55
codeql/common-cpp-coding-standards: '*'

c/common/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/common-c-coding-standards-tests
2-
version: 2.29.0-dev
2+
version: 2.30.0-dev
33
extractor: cpp
44
license: MIT
55
dependencies:
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
| test.c:4:7:4:9 | id1 | Declaration is hiding declaration $@. | test.c:1:5:1:7 | id1 | id1 |
2-
| test.c:7:13:7:15 | id1 | Declaration is hiding declaration $@. | test.c:1:5:1:7 | id1 | id1 |
3-
| test.c:10:12:10:14 | id1 | Declaration is hiding declaration $@. | test.c:1:5:1:7 | id1 | id1 |
4-
| test.c:11:14:11:16 | id1 | Declaration is hiding declaration $@. | test.c:10:12:10:14 | id1 | id1 |
5-
| test.c:24:24:24:26 | id2 | Declaration is hiding declaration $@. | test.c:22:5:22:7 | id2 | id2 |
1+
| test.c:4:7:4:9 | id1 | Variable is hiding variable $@. | test.c:1:5:1:7 | id1 | id1 |
2+
| test.c:7:13:7:15 | id1 | Variable is hiding variable $@. | test.c:1:5:1:7 | id1 | id1 |
3+
| test.c:10:12:10:14 | id1 | Variable is hiding variable $@. | test.c:1:5:1:7 | id1 | id1 |
4+
| test.c:11:14:11:16 | id1 | Variable is hiding variable $@. | test.c:10:12:10:14 | id1 | id1 |
5+
| test.c:24:24:24:26 | id2 | Variable is hiding variable $@. | test.c:22:5:22:7 | id2 | id2 |

c/misra/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/misra-c-coding-standards
2-
version: 2.29.0-dev
2+
version: 2.30.0-dev
33
description: MISRA C 2012
44
suites: codeql-suites
55
license: MIT

c/misra/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/misra-c-coding-standards-tests
2-
version: 2.29.0-dev
2+
version: 2.30.0-dev
33
extractor: cpp
44
license: MIT
55
dependencies:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `A2-10-1`, `RULE-5-3` - `IdentifierHiding.ql`, `IdentifierHidingC.ql`:
2+
- Revert some changes previously made in PR #546 (addressing issue #118). Revert expansion to function identifiers.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `A18-5-8` - `UnnecessaryUseOfDynamicStorage.ql`:
2+
- Address FP reported in #20. Add model of flow from MakeSharedOrUnique to return expression to capture copy/move elision case NRVO.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `A7-1-2` - `VariableMissingConstexpr.ql`:
2+
- Fixes #607. Remove false positives for compiler generated variables and in uninstantiated templates

cpp/autosar/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/autosar-cpp-coding-standards
2-
version: 2.29.0-dev
2+
version: 2.30.0-dev
33
description: AUTOSAR C++14 Guidelines R22-11, R21-11, R20-11, R19-11 and R19-03
44
suites: codeql-suites
55
license: MIT

cpp/autosar/src/rules/A18-5-8/UnnecessaryUseOfDynamicStorage.ql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class MakeSharedOrUnique extends FunctionCall, CandidateFunctionLocalHeapAllocat
5353
// This includes the case where a result of `make_shared` or `make_unique` is return by a function
5454
// because the compiler will call the appropriate constructor.
5555
not exists(FunctionCall fc | DataFlow::localExprFlow(this, fc.getAnArgument())) and
56+
// The flow to a return statement is explicitly modelled for the case where
57+
// the copy/move constructor is elided and therefore there is no actual function call in the database
58+
not exists(ReturnStmt ret | DataFlow::localExprFlow(this, ret.getExpr())) and
5659
// Not assigned to a field
5760
not exists(Field f | DataFlow::localExprFlow(this, f.getAnAssignedValue()))
5861
}

cpp/autosar/src/rules/A7-1-2/VariableMissingConstexpr.ql

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,9 @@ where
6262
// Not assigned by a user in a constructor
6363
not exists(ConstructorFieldInit cfi | cfi.getTarget() = v and not cfi.isCompilerGenerated()) and
6464
// Ignore union members
65-
not v.getDeclaringType() instanceof Union
66-
select v, "Variable " + v.getName() + " could be marked 'constexpr'."
65+
not v.getDeclaringType() instanceof Union and
66+
// Exclude variables in uninstantiated templates, as they may be incomplete
67+
not v.isFromUninstantiatedTemplate(_) and
68+
// Exclude compiler generated variables, which are not user controllable
69+
not v.isCompilerGenerated()
70+
select v, "Variable '" + v.getName() + "' could be marked 'constexpr'."

cpp/autosar/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/autosar-cpp-coding-standards-tests
2-
version: 2.29.0-dev
2+
version: 2.30.0-dev
33
extractor: cpp
44
license: MIT
55
dependencies:

cpp/autosar/test/rules/A18-5-8/test.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,13 @@ StructA *test_failure() {
6868
a = nullptr;
6969
}
7070
return a;
71+
}
72+
73+
#include <string>
74+
std::unique_ptr<StructA>
75+
test_for_fp_reported_in_20(const std::string &s) noexcept {
76+
// make_unique performs heap allocation
77+
// but this outlives the function due to copy elision
78+
// (specifically NRVO)
79+
return std::make_unique<StructA>(s); // COMPLIANT
7180
}

cpp/autosar/test/rules/A7-1-2/FunctionMissingConstexpr.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010
| test.cpp:162:3:162:26 | VariantMemberInitialized | VariantMemberInitialized function could be marked as 'constexpr'. |
1111
| test.cpp:163:3:163:26 | VariantMemberInitialized | VariantMemberInitialized function could be marked as 'constexpr'. |
1212
| test.cpp:190:3:190:22 | VariantMemberNotInit | VariantMemberNotInit function could be marked as 'constexpr'. |
13+
| test.cpp:269:26:269:26 | init | init function could be marked as 'constexpr'. |
14+
| test.cpp:269:26:269:29 | init | init function could be marked as 'constexpr'. |
15+
| test.cpp:271:26:271:26 | init | init function could be marked as 'constexpr'. |
16+
| test.cpp:277:6:277:32 | test_template_instantiation | test_template_instantiation function could be marked as 'constexpr'. |
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
| test.cpp:4:5:4:6 | g1 | Variable g1 could be marked 'constexpr'. |
2-
| test.cpp:6:5:6:6 | g2 | Variable g2 could be marked 'constexpr'. |
3-
| test.cpp:13:14:13:15 | lc | Variable lc could be marked 'constexpr'. |
4-
| test.cpp:15:14:15:16 | lca | Variable lca could be marked 'constexpr'. |
5-
| test.cpp:23:15:23:17 | lc2 | Variable lc2 could be marked 'constexpr'. |
6-
| test.cpp:25:15:25:18 | lc2a | Variable lc2a could be marked 'constexpr'. |
7-
| test.cpp:41:14:41:15 | l2 | Variable l2 could be marked 'constexpr'. |
8-
| test.cpp:44:16:44:17 | lc | Variable lc could be marked 'constexpr'. |
9-
| test.cpp:45:17:45:19 | lc2 | Variable lc2 could be marked 'constexpr'. |
10-
| test.cpp:55:7:55:8 | m2 | Variable m2 could be marked 'constexpr'. |
11-
| test.cpp:130:7:130:8 | m1 | Variable m1 could be marked 'constexpr'. |
12-
| test.cpp:141:7:141:8 | m1 | Variable m1 could be marked 'constexpr'. |
13-
| test.cpp:221:7:221:8 | l1 | Variable l1 could be marked 'constexpr'. |
14-
| test.cpp:235:7:235:8 | l6 | Variable l6 could be marked 'constexpr'. |
15-
| test.cpp:237:7:237:8 | l8 | Variable l8 could be marked 'constexpr'. |
16-
| test.cpp:240:7:240:9 | l10 | Variable l10 could be marked 'constexpr'. |
17-
| test.cpp:243:7:243:9 | l12 | Variable l12 could be marked 'constexpr'. |
18-
| test.cpp:248:7:248:9 | l15 | Variable l15 could be marked 'constexpr'. |
19-
| test.cpp:250:7:250:9 | l16 | Variable l16 could be marked 'constexpr'. |
20-
| test.cpp:251:7:251:9 | l17 | Variable l17 could be marked 'constexpr'. |
21-
| test.cpp:257:7:257:9 | l21 | Variable l21 could be marked 'constexpr'. |
22-
| test.cpp:262:7:262:9 | l24 | Variable l24 could be marked 'constexpr'. |
23-
| test.cpp:263:7:263:9 | l25 | Variable l25 could be marked 'constexpr'. |
1+
| test.cpp:4:5:4:6 | g1 | Variable 'g1' could be marked 'constexpr'. |
2+
| test.cpp:6:5:6:6 | g2 | Variable 'g2' could be marked 'constexpr'. |
3+
| test.cpp:13:14:13:15 | lc | Variable 'lc' could be marked 'constexpr'. |
4+
| test.cpp:15:14:15:16 | lca | Variable 'lca' could be marked 'constexpr'. |
5+
| test.cpp:23:15:23:17 | lc2 | Variable 'lc2' could be marked 'constexpr'. |
6+
| test.cpp:25:15:25:18 | lc2a | Variable 'lc2a' could be marked 'constexpr'. |
7+
| test.cpp:41:14:41:15 | l2 | Variable 'l2' could be marked 'constexpr'. |
8+
| test.cpp:44:16:44:17 | lc | Variable 'lc' could be marked 'constexpr'. |
9+
| test.cpp:45:17:45:19 | lc2 | Variable 'lc2' could be marked 'constexpr'. |
10+
| test.cpp:55:7:55:8 | m2 | Variable 'm2' could be marked 'constexpr'. |
11+
| test.cpp:130:7:130:8 | m1 | Variable 'm1' could be marked 'constexpr'. |
12+
| test.cpp:141:7:141:8 | m1 | Variable 'm1' could be marked 'constexpr'. |
13+
| test.cpp:221:7:221:8 | l1 | Variable 'l1' could be marked 'constexpr'. |
14+
| test.cpp:235:7:235:8 | l6 | Variable 'l6' could be marked 'constexpr'. |
15+
| test.cpp:237:7:237:8 | l8 | Variable 'l8' could be marked 'constexpr'. |
16+
| test.cpp:240:7:240:9 | l10 | Variable 'l10' could be marked 'constexpr'. |
17+
| test.cpp:243:7:243:9 | l12 | Variable 'l12' could be marked 'constexpr'. |
18+
| test.cpp:248:7:248:9 | l15 | Variable 'l15' could be marked 'constexpr'. |
19+
| test.cpp:250:7:250:9 | l16 | Variable 'l16' could be marked 'constexpr'. |
20+
| test.cpp:251:7:251:9 | l17 | Variable 'l17' could be marked 'constexpr'. |
21+
| test.cpp:257:7:257:9 | l21 | Variable 'l21' could be marked 'constexpr'. |
22+
| test.cpp:262:7:262:9 | l24 | Variable 'l24' could be marked 'constexpr'. |
23+
| test.cpp:263:7:263:9 | l25 | Variable 'l25' could be marked 'constexpr'. |

cpp/autosar/test/rules/A7-1-2/test.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,14 @@ constexpr void fp_reported_in_466(int p) {
264264
// compile time constant
265265
int l26 =
266266
add4(1, l3); // COMPLIANT - l3 is not compile time constant on all paths
267-
}
267+
}
268+
269+
template <typename T> T *init(T **t) {}
270+
271+
template <typename T> T *init() {
272+
T *t = nullptr; // COMPLIANT - initialized below
273+
init(&t); // Init is ignored in uninitialized template
274+
return t;
275+
}
276+
277+
void test_template_instantiation() { int *t = init<int>(); }

cpp/cert/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cert-cpp-coding-standards
2-
version: 2.29.0-dev
2+
version: 2.30.0-dev
33
description: CERT C++ 2016
44
suites: codeql-suites
55
license: MIT

cpp/cert/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cert-cpp-coding-standards-tests
2-
version: 2.29.0-dev
2+
version: 2.30.0-dev
33
extractor: cpp
44
license: MIT
55
dependencies:

cpp/common/src/codingstandards/cpp/Scope.qll

Lines changed: 40 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,10 @@ private Element getParentScope(Element e) {
5757

5858
/** A variable which is defined by the user, rather than being from a third party or compiler generated. */
5959
class UserVariable extends Variable {
60-
UserVariable() { this instanceof UserDeclaration }
61-
}
62-
63-
/** A construct which is defined by the user, rather than being from a third party or compiler generated. */
64-
class UserDeclaration extends Declaration {
65-
UserDeclaration() {
60+
UserVariable() {
6661
exists(getFile().getRelativePath()) and
67-
not this.(Variable).isCompilerGenerated() and
68-
not this.(Function).isCompilerGenerated() and
62+
not isCompilerGenerated() and
6963
not this.(Parameter).getFunction().isCompilerGenerated() and
70-
// Class template instantiations are compiler generated instances that share the same parent scope. This will result in a cross-product on class template instantiations because they have the same name and same parent scope. We therefore exclude these from consideration like we do with other compiler generated identifiers of interest.
71-
not this instanceof ClassTemplateInstantiation and
7264
// compiler inferred parameters have name of p#0
7365
not this.(Parameter).getName() = "p#0"
7466
}
@@ -82,13 +74,11 @@ class Scope extends Element {
8274

8375
int getNumberOfVariables() { result = count(getAVariable()) }
8476

85-
int getNumberOfDeclarations() { result = count(getADeclaration()) }
86-
8777
Scope getAnAncestor() { result = this.getStrictParent+() }
8878

8979
Scope getStrictParent() { result = getParentScope(this) }
9080

91-
UserDeclaration getADeclaration() { getParentScope(result) = this }
81+
Declaration getADeclaration() { getParentScope(result) = this }
9282

9383
Expr getAnExpr() { this = getParentScope(result) }
9484

@@ -132,31 +122,31 @@ class GeneratedBlockStmt extends BlockStmt {
132122
GeneratedBlockStmt() { this.getLocation() instanceof UnknownLocation }
133123
}
134124

135-
/** Gets a Declaration that is in the potential scope of Declaration `v`. */
136-
private UserDeclaration getPotentialScopeOfDeclaration_candidate(UserDeclaration v) {
125+
/** Gets a variable that is in the potential scope of variable `v`. */
126+
private UserVariable getPotentialScopeOfVariable_candidate(UserVariable v) {
137127
exists(Scope s |
138-
result = s.getADeclaration() and
128+
result = s.getAVariable() and
139129
(
140-
// Declaration in an ancestor scope, but only if there are less than 100 declarations in this scope
141-
v = s.getAnAncestor().getADeclaration() and
142-
s.getNumberOfDeclarations() < 100
130+
// Variable in an ancestor scope, but only if there are less than 100 variables in this scope
131+
v = s.getAnAncestor().getAVariable() and
132+
s.getNumberOfVariables() < 100
143133
or
144-
// In the same scope, but not the same Declaration, and choose just one to report
145-
v = s.getADeclaration() and
134+
// In the same scope, but not the same variable, and choose just one to report
135+
v = s.getAVariable() and
146136
not result = v and
147137
v.getName() <= result.getName()
148138
)
149139
)
150140
}
151141

152-
/** Gets a Declaration that is in the potential scope of Declaration `v`. */
153-
private UserDeclaration getPotentialScopeOfDeclarationStrict_candidate(UserDeclaration v) {
142+
/** Gets a variable that is in the potential scope of variable `v`. */
143+
private UserVariable getOuterScopesOfVariable_candidate(UserVariable v) {
154144
exists(Scope s |
155-
result = s.getADeclaration() and
145+
result = s.getAVariable() and
156146
(
157-
// Declaration in an ancestor scope, but only if there are less than 100 variables in this scope
158-
v = s.getAnAncestor().getADeclaration() and
159-
s.getNumberOfDeclarations() < 100
147+
// Variable in an ancestor scope, but only if there are less than 100 variables in this scope
148+
v = s.getAnAncestor().getAVariable() and
149+
s.getNumberOfVariables() < 100
160150
)
161151
)
162152
}
@@ -171,20 +161,20 @@ predicate inSameTranslationUnit(File f1, File f2) {
171161
}
172162

173163
/**
174-
* Gets a user Declaration which occurs in the "outer scope" of Declaration `v`.
164+
* Gets a user variable which occurs in the "potential scope" of variable `v`.
175165
*/
176166
cached
177-
UserDeclaration getPotentialScopeOfDeclarationStrict(UserDeclaration v) {
178-
result = getPotentialScopeOfDeclarationStrict_candidate(v) and
167+
UserVariable getPotentialScopeOfVariable(UserVariable v) {
168+
result = getPotentialScopeOfVariable_candidate(v) and
179169
inSameTranslationUnit(v.getFile(), result.getFile())
180170
}
181171

182172
/**
183-
* Gets a user variable which occurs in the "potential scope" of variable `v`.
173+
* Gets a user variable which occurs in the "outer scope" of variable `v`.
184174
*/
185175
cached
186-
UserDeclaration getPotentialScopeOfDeclaration(UserDeclaration v) {
187-
result = getPotentialScopeOfDeclaration_candidate(v) and
176+
UserVariable getPotentialScopeOfVariableStrict(UserVariable v) {
177+
result = getOuterScopesOfVariable_candidate(v) and
188178
inSameTranslationUnit(v.getFile(), result.getFile())
189179
}
190180

@@ -214,9 +204,18 @@ class TranslationUnit extends SourceFile {
214204
}
215205

216206
/** Holds if `v2` may hide `v1`. */
217-
private predicate hides_candidateStrict(UserDeclaration v1, UserDeclaration v2) {
207+
private predicate hides_candidate(UserVariable v1, UserVariable v2) {
208+
not v1 = v2 and
209+
v2 = getPotentialScopeOfVariable(v1) and
210+
v1.getName() = v2.getName() and
211+
// Member variables cannot hide other variables nor be hidden because the can be referenced through their qualified name.
212+
not (v1.isMember() or v2.isMember())
213+
}
214+
215+
/** Holds if `v2` may hide `v1`. */
216+
private predicate hides_candidateStrict(UserVariable v1, UserVariable v2) {
218217
not v1 = v2 and
219-
v2 = getPotentialScopeOfDeclarationStrict(v1) and
218+
v2 = getPotentialScopeOfVariableStrict(v1) and
220219
v1.getName() = v2.getName() and
221220
// Member variables cannot hide other variables nor be hidden because the can be referenced through their qualified name.
222221
not (v1.isMember() or v2.isMember()) and
@@ -240,15 +239,6 @@ private predicate hides_candidateStrict(UserDeclaration v1, UserDeclaration v2)
240239
)
241240
}
242241

243-
/** Holds if `v2` may hide `v1`. */
244-
private predicate hides_candidate(UserDeclaration v1, UserDeclaration v2) {
245-
not v1 = v2 and
246-
v2 = getPotentialScopeOfDeclaration(v1) and
247-
v1.getName() = v2.getName() and
248-
// Member variables cannot hide other variables nor be hidden because the can be referenced through their qualified name.
249-
not (v1.isMember() or v2.isMember())
250-
}
251-
252242
/**
253243
* Gets the enclosing statement of the given variable, if any.
254244
*/
@@ -267,22 +257,20 @@ private Stmt getEnclosingStmt(LocalScopeVariable v) {
267257
}
268258

269259
/** Holds if `v2` hides `v1`. */
270-
predicate hides(UserDeclaration v1, UserDeclaration v2) {
260+
predicate hides(UserVariable v1, UserVariable v2) {
271261
hides_candidate(v1, v2) and
272262
// Confirm that there's no closer candidate variable which `v2` hides
273-
not exists(UserDeclaration mid |
263+
not exists(UserVariable mid |
274264
hides_candidate(v1, mid) and
275265
hides_candidate(mid, v2)
276-
) and
277-
// Unlike `hidesStrict`, that requires a different scope, `hides` considers declarations in the same scope. This will include function overloads based on their name. To remove overloads from consideration, we exclude them.
278-
not v1.(Function).getAnOverload() = v2
266+
)
279267
}
280268

281269
/** Holds if `v2` strictly (`v2` is in an inner scope compared to `v1`) hides `v1`. */
282-
predicate hidesStrict(UserDeclaration v1, UserDeclaration v2) {
270+
predicate hidesStrict(UserVariable v1, UserVariable v2) {
283271
hides_candidateStrict(v1, v2) and
284272
// Confirm that there's no closer candidate variable which `v2` hides
285-
not exists(UserDeclaration mid |
273+
not exists(UserVariable mid |
286274
hides_candidateStrict(v1, mid) and
287275
hides_candidateStrict(mid, v2)
288276
)
@@ -303,7 +291,7 @@ predicate hasBlockScope(Declaration decl) { exists(BlockStmt b | b.getADeclarati
303291
/**
304292
* identifiers in nested (named/nonglobal) namespaces are exceptions to hiding due to being able access via fully qualified ids
305293
*/
306-
predicate excludedViaNestedNamespaces(UserDeclaration outerDecl, UserDeclaration innerDecl) {
294+
predicate excludedViaNestedNamespaces(UserVariable outerDecl, UserVariable innerDecl) {
307295
exists(Namespace inner, Namespace outer |
308296
outer.getAChildNamespace+() = inner and
309297
//outer is not global

cpp/common/src/codingstandards/cpp/rules/differentidentifiersnottypographicallyunambiguous/DifferentIdentifiersNotTypographicallyUnambiguous.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ string step1(string s) {
4747
string step2(string s) { s = "m_" and result = "rn" }
4848

4949
predicate violation(UserVariable v1, UserVariable v2) {
50-
v2 = getPotentialScopeOfDeclaration(v1) and
50+
v2 = getPotentialScopeOfVariable(v1) and
5151
exists(string s1, string s2 |
5252
// over-approximate a match, because it is cheaper to compute
5353
getCanon(v1) = getCanon(v2) and

0 commit comments

Comments
 (0)