How to write simple test for my source code change?

Here [CIR]Add name for function type in vtable by y-Adrian · Pull Request #163839 · llvm/llvm-project · GitHub I tried to change some source code, but I don’t know how to write correct test cases for it.

I have some questions:

1.How can I generate the comments for my test case, just like other test cases in clang/test/CIR/CodeGen/throws.cpp?

2. Since I haven’t seen this form of testing before, how can I determine if the test case has reached the branch I want to test?

Could you provide a test example based on the modification of my code?

Normally, we generate the CHECK lines using a tool like utils/update_(llc_|analyze_|)test_checks.py, and there’s a tool called update_cc_test_checks.py – unfortunately, I don’t think there’s an update_cir_test_checks, so I believe you’re going to have to craft the test by hand. The tool that parses CHECK lines is called FileCheck, and it matches regexes as well: just have a look at an existing test file, and try to learn by example.

Tip: Include the original test with the original CHECK lines passing as the first commit, and include your patch along with test changes as the second commit. You can run ninja check-clang-codegen on both commits to ensure that the test is good.