[clang] Generate empty .clang-format-ignore before running tests (PR #136154)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 17 09:13:59 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-format
Author: Devon Loehr (DKLoehr)
<details>
<summary>Changes</summary>
Followup to #<!-- -->136022, this ensures formatting tests are run with an empty `.clang-format-ignore` in their root directory, to prevent failures if the file also exists higher in the tree.
---
Full diff: https://github.com/llvm/llvm-project/pull/136154.diff
1 Files Affected:
- (modified) clang/test/Format/lit.local.cfg (+6)
``````````diff
diff --git a/clang/test/Format/lit.local.cfg b/clang/test/Format/lit.local.cfg
index b060c79226cbd..cf79e8df89a33 100644
--- a/clang/test/Format/lit.local.cfg
+++ b/clang/test/Format/lit.local.cfg
@@ -1,3 +1,4 @@
+import os
import platform
import lit.formats
@@ -27,3 +28,8 @@ config.suffixes = [
# python implementation does, so use that for cross platform compatibility
if platform.system() == "AIX":
config.test_format = lit.formats.ShTest()
+
+# Create an empty .clang-format-ignore file so that tests don't get messed
+# up if one exists higher in the tree
+with open(os.path.join("Format", ".clang-format-ignore"), 'w'):
+ pass
\ No newline at end of file
``````````
</details>
https://github.com/llvm/llvm-project/pull/136154
More information about the cfe-commits
mailing list