[clang-tools-extra] [clang-tidy] Add newline style note to contributing guide. NFC. (PR #202999)
Zeyi Xu via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 10 07:47:47 PDT 2026
https://github.com/zeyi2 created https://github.com/llvm/llvm-project/pull/202999
None
>From f9d762be808e3c94d0373393b9d1be4bef38d878 Mon Sep 17 00:00:00 2001
From: Zeyi Xu <mitchell.xu2 at gmail.com>
Date: Wed, 10 Jun 2026 22:47:26 +0800
Subject: [PATCH] [clang-tidy] Add newline style note to contributing guide.
NFC.
---
clang-tools-extra/docs/clang-tidy/Contributing.rst | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/clang-tools-extra/docs/clang-tidy/Contributing.rst b/clang-tools-extra/docs/clang-tidy/Contributing.rst
index 79551f60e9b1c..65933061b49f1 100644
--- a/clang-tools-extra/docs/clang-tidy/Contributing.rst
+++ b/clang-tools-extra/docs/clang-tidy/Contributing.rst
@@ -415,7 +415,11 @@ Some suggestions to ensure your check is robust:
- Define macros that contain code matched by your check.
- Define template classes that contain code matched by your check.
- Define template specializations that contain code matched by your check.
-- Test your check under both Windows and Linux environments.
+- Test your check under both Windows and Linux environments. For example, when
+ a fix-it inserts new lines, use the source file's existing newline style
+ instead of hard-coding ``\n``. You can use
+ ``SourceManager::getBufferData(FileID).detectEOL()`` to get the newline style
+ for a file.
- Watch out for high false-positive rates. Ideally, a check would have no
false positives, but given that matching against an AST is not control-
or data flow- sensitive, a number of false positives are expected. The
More information about the cfe-commits
mailing list