https://github.com/5chmidti commented:

You could try to implement the check with `TK_TraverseUnlessSpelledInSource` if 
you'd like, which would only add two more matchers via `addMatcher`, and the 
traversal kind function (https://godbolt.org/z/GrfMTxeGa). IMO, this can be 
done in a follow-up by someone else as well.

`TK_TraversUnlessSpelledInSource` would not only have performance implications, 
but also niche correctness improvements: 
```diff
struct IntSpan {
    IntSpan(int*);
    IntSpan subspan(int, int);
};

template <typename T>
void test_instantiations(T val) {
-    val.subspan(0, 5);
+    val.first(5); // `IntSpan` does not have `first`
}

void test_intantiations() {
    int array[] = {0, 1, 2, 3, 4};
    auto sp = std::span<int>{array, 5};
    test_instantiations(sp);
    IntSpan intsp = array;
    test_instantiations(intsp);
}
```

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