[clang-tools-extra] f7ae0ec - [clang-format][clang-tools-extra] Fix leaking of host-level config into test environment (#206358)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 22 22:59:58 PDT 2026
Author: Damian Höster
Date: 2026-07-23T13:59:53+08:00
New Revision: f7ae0ec1b5821ff219e70218b6877bb977be06b7
URL: https://github.com/llvm/llvm-project/commit/f7ae0ec1b5821ff219e70218b6877bb977be06b7
DIFF: https://github.com/llvm/llvm-project/commit/f7ae0ec1b5821ff219e70218b6877bb977be06b7.diff
LOG: [clang-format][clang-tools-extra] Fix leaking of host-level config into test environment (#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.
Added:
Modified:
clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp
clang/test/Format/dump-config-objc-stdin.m
Removed:
################################################################################
diff --git a/clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp b/clang-tools-extra/unittests/clang-change-namespace/ChangeNamespaceTests.cpp
index 4a6352cd5975e..12d25c7e302a2 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));
}
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
More information about the cfe-commits
mailing list