https://github.com/damster101 created https://github.com/llvm/llvm-project/pull/206358
These leaks were causing false test failures due to my global .clang-format being in an ancestor directory of the build directory. These changes prevent those issues when running the tests on my system. I used MiMo v2.5 Pro agentically in Zed to find and fix the issue. But I understand the changes and judge them to be safe and a clear improvement over the status quo. From adfcabc5d0d2dcb11bbaeee63ee85fa210d344ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20H=C3=B6ster?= <[email protected]> Date: Sun, 28 Jun 2026 18:22:54 +0200 Subject: [PATCH] [clang-format] Fix host-level config leaking into test environment These leaks were causing false test failures due to my global .clang-format being in a parent directory of the build directory. --- .../clang-change-namespace/ChangeNamespaceTests.cpp | 6 +++--- clang/test/Format/dump-config-objc-stdin.m | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp b/clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp index 4a6352cd5975e..6d1612e7d3b16 100644 --- a/clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp +++ b/clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp @@ -46,7 +46,7 @@ class ChangeNamespaceTest : public ::testing::Test { if (!tooling::runToolOnCodeWithArgs(Factory->create(), Code, {"-std=c++11"}, FileName)) return ""; - formatAndApplyAllReplacements(FileToReplacements, Context.Rewrite); + formatAndApplyAllReplacements(FileToReplacements, Context.Rewrite, "llvm"); return format(Context.getRewrittenText(ID)); } @@ -63,10 +63,10 @@ class ChangeNamespaceTest : public ::testing::Test { } protected: - std::string FileName = "input.cc"; + std::string FileName = "/test/input.cc"; std::string OldNamespace = "na::nb"; std::string NewNamespace = "x::y"; - std::string FilePattern = "input.cc"; + std::string FilePattern = "/test/input.cc"; }; TEST_F(ChangeNamespaceTest, NoMatchingNamespace) { diff --git a/clang/test/Format/dump-config-objc-stdin.m b/clang/test/Format/dump-config-objc-stdin.m index d81711a84d79b..01a4a78a5a65d 100644 --- a/clang/test/Format/dump-config-objc-stdin.m +++ b/clang/test/Format/dump-config-objc-stdin.m @@ -1,6 +1,6 @@ -// RUN: clang-format -assume-filename=foo.m -dump-config | FileCheck %s +// RUN: clang-format -style=llvm -assume-filename=foo.m -dump-config | FileCheck %s -// RUN: clang-format -dump-config - < %s | FileCheck %s +// RUN: clang-format -style=llvm -dump-config - < %s | FileCheck %s // CHECK: Language: ObjC _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
