Day 17 of 30 · Clang frontend
Use FileCheck and trace a diagnostic
- Time
- About 150 minutes: 40 reading, 80 lab, 20 testing, 10 notes.
- Prerequisites
- Day 16: Write focused diagnostic tests
Toolchain: current-main build
Use build/bin/clang++ and build/bin/llvm-lit from your llvm-main checkout, not whichever clang++ is first on PATH. Reproduce upstream behavior on current main and record the commit SHA. Setup guide
Learn
- Textual output assertions and the diagnostic definition chain.
Read Reading
- R12 · FileCheck manual
Basic checks, labels and captures · 25 min - R1 · Learn LLVM 17, Second Edition
Chapter 8: TableGen introduction, skim · 15 min
Reading budgets cover selected sections, not whole chapters. Link to the book; this site does not reproduce it.
Build Build or investigate
- Read an existing AST or CodeGen test using FileCheck.
- Make a scratch check for one meaningful output property.
- Trace yesterday’s diagnostic through a
.tddefinition and a Sema call site. - Avoid checks against unstable addresses or SSA numbering.
Done when
One focused FileCheck test and a trace from diagnostic ID to source location.
Recall question
When is -verify a better fit than checking stderr with FileCheck?
Completion checks
Progress tracking needs JavaScript. The lesson above is complete without it.
Notes
Saved only in this browser. Keep it short enough to finish in ten minutes; none of the prompts are required. All notes, export and import