View on GitHub

Principles of Static Program Analysis

Educational and Research Materials

Lecture 14

LLVM and Clang

Lecture

Slides: PDF, PPTX

Notes: PDF

Outline

Workshop

Outline

Examples

Tasks

Exploring test.c:
  1. Dump tokens:
    clang -cc1 -dump-tokens test.c
    
  2. Dump and view AST:
    clang -cc1 -ast-dump test.c
    clang -cc1 -ast-view test.c
    
  3. Dump and view call graph:
    clang -cc1 -analyze -analyzer-checker="debug.DumpCallGraph" test.c
    clang -cc1 -analyze -analyzer-checker="debug.ViewCallGraph" test.c
    
  4. View CFG and Exploded Graph:
    clang -cc1 -analyze -analyzer-checker="debug.ViewCFG" test.c
    clang -cc1 -analyze -analyzer-checker="debug.ViewExplodedGraph" test.c
    

References