hjanuschka wrote:

feedback addressed, you were right about the template case, it is really 
broken, adding:
```
  std::optional<TraversalKind> getCheckTraversalKind() const override {
    return TK_IgnoreUnlessSpelledInSource;
  }
  ```
  
fixes it, but now templates seem to be skipped completely. and existing tests 
are not "passing" anymore:

```
template <typename T>
void testTemplate() {
  T arr[] = {1, 2, 3, 4, 5};
  std::span<T> s(arr, 5);

  auto sub1 = s.subspan(0, 3);
  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: prefer 'span::first()' over 
'subspan()'
  // CHECK-FIXES: auto sub1 = s.first(3);

  auto sub2 = s.subspan(s.size() - 2);
  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: prefer 'span::last()' over 
'subspan()'
  // CHECK-FIXES: auto sub2 = s.last(2);

  __SIZE_TYPE__ n = 2;
  auto sub3 = s.subspan(0, n);
  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: prefer 'span::first()' over 
'subspan()'
  // CHECK-FIXES: auto sub3 = s.first(n);

  auto sub4 = s.subspan(1, 2);  // No warning
  auto sub5 = s.subspan(2);     // No warning

  auto complex = s.subspan(0 + (s.size() - 2), 3);  // No warning

  auto complex2 = s.subspan(100 + (s.size() - 2));  // No warning
}
```

do you have any ideas? 

https://github.com/llvm/llvm-project/pull/118074
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to