[llvm] [CodingStandard] Require Unix line endings for all source files (PR #161228)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 30 08:41:31 PDT 2025
https://github.com/jurahul updated https://github.com/llvm/llvm-project/pull/161228
>From e32e3d6faf223dc04ae3e0ad5b563241ce3c28a2 Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Mon, 29 Sep 2025 09:47:06 -0700
Subject: [PATCH 1/3] [CodingStandard] Require Unix line endings for C/C++
source and headers
Require all C/C++ source files to use Unix style line endings. This
is just formalizing an already loosely followed convention and not doing
so can cause build failure for some downstream clients of LLVM.
---
llvm/docs/CodingStandards.rst | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst
index dd275f292967b..4800fc345754d 100644
--- a/llvm/docs/CodingStandards.rst
+++ b/llvm/docs/CodingStandards.rst
@@ -1790,6 +1790,13 @@ would help to avoid running into a "dangling else" situation.
markAsIgnored(D);
}
+Use Unix style line endings for source files
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Use Unix style line endings for C/C++ source files (``.c``, ``.cpp`` and header
+files). This is required to avoid various build issue for downstream clients of
+LLVM. Test files like C/C++/HLSL test inputs can continue to use any line ending
+style.
See Also
========
>From 985ef74b1aed12fba13182ce3e90a72f33821f71 Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Tue, 30 Sep 2025 06:01:14 -0700
Subject: [PATCH 2/3] Review feedback
---
llvm/docs/CodingStandards.rst | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst
index 4800fc345754d..bacfae1082788 100644
--- a/llvm/docs/CodingStandards.rst
+++ b/llvm/docs/CodingStandards.rst
@@ -1790,13 +1790,12 @@ would help to avoid running into a "dangling else" situation.
markAsIgnored(D);
}
-Use Unix style line endings for source files
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Use Unix line endings for source files
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Use Unix style line endings for C/C++ source files (``.c``, ``.cpp`` and header
-files). This is required to avoid various build issue for downstream clients of
-LLVM. Test files like C/C++/HLSL test inputs can continue to use any line ending
-style.
+Use Unix line endings for all source files. CRLF line endings are allowed as an
+exception for test files that intend to test CRLF handling or when the file
+format requires it (like ``.bat`` or ``.rc`` files).
See Also
========
>From 07143aa92d11e3f0c56db9c67d67dba3f8495f0b Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Tue, 30 Sep 2025 08:41:01 -0700
Subject: [PATCH 3/3] Review feedback 2
---
llvm/docs/CodingStandards.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst
index bacfae1082788..65dd794103ac3 100644
--- a/llvm/docs/CodingStandards.rst
+++ b/llvm/docs/CodingStandards.rst
@@ -1790,10 +1790,10 @@ would help to avoid running into a "dangling else" situation.
markAsIgnored(D);
}
-Use Unix line endings for source files
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Use Unix line endings for files
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Use Unix line endings for all source files. CRLF line endings are allowed as an
+Use Unix line endings for all files. CRLF line endings are allowed as an
exception for test files that intend to test CRLF handling or when the file
format requires it (like ``.bat`` or ``.rc`` files).
More information about the llvm-commits
mailing list