[clang-tools-extra] [clang-tidy] Header check support for check_clang_tidy.py (PR #175735)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 6 08:10:12 PST 2026
================
@@ -196,15 +210,36 @@ def get_prefixes(self) -> None:
)
assert expect_diagnosis or self.expect_no_diagnosis
+ def _sanitize_content(self, text: str) -> str:
+ return re.sub("// *CHECK-[A-Z0-9\\-]*:[^\r\n]*", "//", text)
+
+ def _filter_prefixes(self, prefixes: Sequence[str], check_file: str) -> List[str]:
+ if check_file == self.input_file_name:
+ content = self.input_text
+ else:
+ with open(check_file, "r", encoding="utf-8") as f:
+ content = f.read()
+ return [p for p in prefixes if p in content]
+
def prepare_test_inputs(self) -> None:
# Remove the contents of the CHECK lines to avoid CHECKs matching on
# themselves. We need to keep the comments to preserve line numbers while
# avoiding empty lines which could potentially trigger formatting-related
# checks.
----------------
vbvictor wrote:
Can we make this comment as description of new method
https://github.com/llvm/llvm-project/pull/175735
More information about the cfe-commits
mailing list