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

Reading budgets cover selected sections, not whole chapters. Link to the book; this site does not reproduce it.

Build Build or investigate

  1. Read an existing AST or CodeGen test using FileCheck.
  2. Make a scratch check for one meaningful output property.
  3. Trace yesterday’s diagnostic through a .td definition and a Sema call site.
  4. 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.

Required to complete day 17

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