File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ StatementMatcher makeArrayLoopMatcher() {
70
70
expr (hasType (isInteger ())).bind (ConditionBoundName);
71
71
72
72
return forStmt (
73
+ unless (isInTemplateInstantiation ()),
73
74
hasLoopInit (declStmt (hasSingleDecl (InitToZeroMatcher))),
74
75
hasCondition (anyOf (
75
76
binaryOperator (hasOperatorName (" <" ),
@@ -159,6 +160,7 @@ StatementMatcher makeIteratorLoopMatcher() {
159
160
.bind (DerefByRefResultName)))))));
160
161
161
162
return forStmt (
163
+ unless (isInTemplateInstantiation ()),
162
164
hasLoopInit (anyOf (declStmt (declCountIs (2 ),
163
165
containsDeclaration (0 , InitDeclMatcher),
164
166
containsDeclaration (1 , EndDeclMatcher)),
@@ -258,6 +260,7 @@ StatementMatcher makePseudoArrayLoopMatcher() {
258
260
EndInitMatcher));
259
261
260
262
return forStmt (
263
+ unless (isInTemplateInstantiation ()),
261
264
hasLoopInit (
262
265
anyOf (declStmt (declCountIs (2 ),
263
266
containsDeclaration (0 , InitToZeroMatcher),
Original file line number Diff line number Diff line change @@ -626,3 +626,24 @@ void messing_with_macros() {
626
626
}
627
627
628
628
} // namespace Macros
629
+
630
+ namespace Templates {
631
+
632
+ template <class Container >
633
+ void set_union (Container &container) {
634
+ for (typename Container::const_iterator SI = container.begin (),
635
+ SE = container.end (); SI != SE; ++SI) {
636
+ }
637
+ S s;
638
+ for (S::iterator SI = s.begin (), SE = s.end (); SI != SE; ++SI) {
639
+ }
640
+ // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: use range-based for loop instead
641
+ // CHECK-FIXES: for (auto & elem : s) {
642
+ }
643
+
644
+ void template_instantiation () {
645
+ S a;
646
+ set_union (a);
647
+ }
648
+
649
+ } // namespace Templates
You can’t perform that action at this time.
0 commit comments