filecheck
LLVM pattern-matching testing tool
TLDR
SYNOPSIS
FileCheck [options] check-file
DESCRIPTION
FileCheck is an LLVM testing tool that verifies text output matches specified patterns. It reads a file containing CHECK directives and verifies they match against input, commonly compiler output.
The tool supports various check types: CHECK for sequential matching, CHECK-NEXT for consecutive lines, CHECK-NOT for absence, CHECK-SAME for same-line matches, CHECK-DAG for unordered matches, CHECK-LABEL for scoping, and CHECK-EMPTY for blank lines.
FileCheck is essential for LLVM and compiler testing, validating generated code matches expected patterns.
PARAMETERS
CHECK-FILE
File containing CHECK directives.--input-file FILE
Input file to verify.-v, --verbose
Print good matches.--match-full-lines
Require full line matches.--strict-whitespace
Strict whitespace matching.--check-prefix PREFIX
Use custom check prefix (default: CHECK).--check-prefixes PREFIXES
Comma-separated list of check prefixes.-vv
Print information useful for diagnostic analysis.--dump-input MODE
Dump annotated input on failure (help, always, fail, never).--allow-empty
Allow the check file to be empty.--help
Display help information.
CAVEATS
Pattern syntax uses a subset of regular expressions with LLVM-specific extensions like variable captures (`[[VAR:regex]]`). Whitespace is canonicalized by default (multiple spaces match one). Primarily designed for LLVM/compiler testing but usable for any text verification.
HISTORY
FileCheck was developed as part of LLVM's testing infrastructure. It provides a flexible pattern-matching system for validating compiler output in regression tests.

