[clang] [clang-format] Preserve trailing NOLINTEND placement with SeparateDefinitionBlocks (PR #190741)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 7 14:59:03 PDT 2026
================
@@ -4768,5 +4768,25 @@ bool isClangFormatOff(StringRef Comment) {
return isClangFormatOnOff(Comment, /*On=*/false);
}
+static bool isNoLintBeginEnd(StringRef Comment, bool On) {
+ if (Comment == (On ? "/* NOLINTBEGIN */" : "/* NOLINTEND */"))
+ return true;
+
+ static const char NoLintBegin[] = "// NOLINTBEGIN";
+ static const char NoLintEnd[] = "// NOLINTEND";
+ const unsigned Size = (On ? sizeof NoLintBegin : sizeof NoLintEnd) - 1;
+
+ return Comment.starts_with(On ? NoLintBegin : NoLintEnd) &&
+ (Comment.size() == Size || Comment[Size] == ':');
+}
+
+bool isNoLintEnd(StringRef Comment) {
+ return isNoLintBeginEnd(Comment, /*On=*/false);
+}
+
+bool isNoLintBegin(StringRef Comment) {
----------------
HazardyKnusperkeks wrote:
For what? You never call this one.
https://github.com/llvm/llvm-project/pull/190741
More information about the cfe-commits
mailing list