File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -20,5 +20,7 @@ import codingstandards.cpp.autosar
20
20
from DeclStmt ds
21
21
where
22
22
not isExcluded ( ds , InitializationPackage:: multipleLocalDeclaratorsQuery ( ) ) and
23
- count ( ds .getADeclaration ( ) ) > 1
23
+ count ( Declaration d | d = ds .getADeclaration ( ) ) > 1 and
24
+ // Not a compiler generated `DeclStmt`, such as in the range-based for loop
25
+ not ds .isCompilerGenerated ( )
24
26
select ds , "Declaration list contains more than one declaration."
Original file line number Diff line number Diff line change @@ -15,3 +15,10 @@ class ClassA {
15
15
int m1, m2; // NON_COMPLIANT
16
16
int m3; // COMPLIANT
17
17
};
18
+
19
+ #include < vector>
20
+ void test_loop (std::vector<ClassA> v) {
21
+ for (const auto b : v) { // COMPLIANT - DeclStmt is compiler generated
22
+ b;
23
+ }
24
+ }
You can’t perform that action at this time.
0 commit comments