[clang] Testing Expr internal functions

I’m trying to figure out how to test a change to an internal Expr function that calculates the result of a compile constant expression. The change introduces a new flag that is set internally from clang-tidy, but otherwise shouldn’t affect any output.

Since the vast majority of the testing seems to be lit-based, where the compiler is given an input and the expected output is verified, I’m struggling with how to test this change without introducing a new diagnostic or something like that.

Does anyone have any good ideas? Here’s the PR for anyone interested: [clang-tidy] bugprone-implicit-widening ignores unsigned consts by cwarner-8702 · Pull Request #101073 · llvm/llvm-project · GitHub

Unittest? clang/unittests/AST should have examples of exercising an API.

1 Like