[clang] [analyzer] Add BranchCondition callback to 'switch' (PR #182058)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 18 12:08:17 PST 2026


NagyDonat wrote:

> The unittest failure is relevant. Something like this should fix it:
> 
> ```diff
> diff --git a/clang/unittests/StaticAnalyzer/BlockEntranceCallbackTest.cpp b/clang/unittests/StaticAnalyzer/BlockEntranceCallbackTest.cpp
> @@ -361,7 +361,8 @@ TEST(BlockEntranceTester, BlockEntranceVSBranchCondition) {
>                  "Within 'top' B4 -> B5",
>                  "Within 'top' B5 -> B3",
>                  "Within 'top' B6 -> B4",
> -                "Within 'top': branch condition 'x == 6'",
> +                "Within 'top': branch condition 'x == 6'", // 'if (x == 6)'
> +                "Within 'top': branch condition 'x'",      // `switch (x)'
>              }),
>              Diags);
>  }
> ```

Yes, I also realized it, I wrote and pushed a fix commit just now. I didn't add explanatory comments but as the code example is fairly short I think the test is understandable without them.

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


More information about the cfe-commits mailing list