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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 28 08:53:17 PDT 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM, but I have some additional testing requests which might spawn follow-up patches.



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/misc/confusable-identifiers.cpp:43
+  return q0 < q1;
+}
----------------
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.


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