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
2020from DeclStmt ds
2121where
2222 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 ( )
2426select ds , "Declaration list contains more than one declaration."
Original file line number Diff line number Diff line change @@ -15,3 +15,10 @@ class ClassA {
1515 int m1, m2; // NON_COMPLIANT
1616 int m3; // COMPLIANT
1717};
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