[clang] [analyzer] Introduce the check::BlockEntrance checker callback (PR #140924)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Mon May 26 07:33:12 PDT 2025


================
@@ -548,6 +564,8 @@ class CheckerProgramPointTag : public SimpleProgramPointTag {
 template <typename CHECK1, typename... CHECKs>
 class Checker : public CHECK1, public CHECKs..., public CheckerBase {
 public:
+  using BlockEntrance = clang::BlockEntrance;
----------------
balazs-benics-sonarsource wrote:

Yes, the class `check::BlockEntrance` would have priority within a checker, e.g. the DivByZero checker when spelling an unqualified name `BlockEntrance`. This means that the function parameter of that callback would refer to the wrong class: `checkBlockEntrance(const BlockEntrance &Entrance,...)`.
To circumvent this and provide the expected lookup rules, I need to force it to shadow this name with the `clang::BlockEntrance`, hence this using declaration here.
It's not pretty, but smart and has a low footprint. No users should know why it works.

https://github.com/llvm/llvm-project/pull/140924


More information about the cfe-commits mailing list