[PATCH] D128715: [clang-tidy] Fix confusable identifiers interaction with DeclContext

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 08:19:28 PDT 2022


LegalizeAdulthood added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/misc/confusable-identifiers.cpp:43
+  return q0 < q1;
+}
----------------
aaron.ballman wrote:
> It looks like there's quite a bit of missing test coverage for all the various situations in C++. Here are some additional test cases to add:
> ```
> template <typename i1>
> struct S {
>   template <typename il> // Should warn on this one, right?
>   void func2() {}
> };
> 
> template <typename i1>
> void func(int il) { // Should warn on this one, right?
> }
> 
> template <typename O0>
> void other() {
>   int OO = 0; // Should warn on this one, right?
> }
> int OO = 0; // But not this one
> 
> namespace foo {
>   int i1;
> }
> 
> namespace bar {
>   int il;  // Should not warn about this
> }
> 
> namespace foo {
>   int il; // But should warn about this
> }
> 
> struct Base {
>   virtual void O0();
> 
> private:
>   void II();
> };
> 
> struct Derived : Base {
>   void OO(); // We should warn about this
>   void I1(); // But not this
> };
> ```
> (I'm sure there are more that I've missed, but you get the idea.) If any of these point out other issues, feel free to address them in a follow-up patch if you'd prefer.
Another case to consider:
```
template <typename O0, typename OO>
void f();
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128715/new/

https://reviews.llvm.org/D128715



More information about the cfe-commits mailing list