[clang-tools-extra] Follow style configuration in clangd when inserting missing includes (PR #140594)

via cfe-commits cfe-commits at lists.llvm.org
Sat May 24 06:46:14 PDT 2025


================
@@ -306,6 +311,12 @@ TEST(IncludeCleaner, GenerateMissingHeaderDiags) {
                 withFix({Fix(MainFile.range("insert_b"), "#include \"b.h\"\n",
                              "#include \"b.h\""),
                          FixMessage("add all missing includes")})),
+          AllOf(Diag(MainFile.range("b_angled"),
+                     "No header providing \"b_angled\" is directly included"),
+                withFix(
+                    {Fix(MainFile.range("insert_b_angled"),
+                         "#include <b_angled.h>\n", "#include \"b_angled.h\""),
----------------
Harald-R wrote:

Good point. I was under the impression that the `Message` field referred to the original code (which in this test had an instance of quoted inclusion), but it seems that it refers to the fix itself, so it should be angled as well. I was mainly testing the code with the example [here](https://github.com/llvm/llvm-project/pull/67749#issuecomment-1903375837) and missed this. Made some changes to the way the `Message` field is generated in the code to reflect the correct inclusion style: https://github.com/llvm/llvm-project/pull/140594/commits/4896e03140150427f32bca07824dace0612e22e7

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


More information about the cfe-commits mailing list