================
@@ -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) {
----------------
heturing wrote:

I added the function for consistency with the `isClangFormatOn` helper. I have 
removed it since it is unused.

https://github.com/llvm/llvm-project/pull/190741
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to