How to Build Your First C++ Automated Refactoring Tool
Talkat CppCon 2023 · on Wednesday, 2023-10-04· at 16:45· Adams, 6700 North Gaylord Rockies Boulevard·
summary
Shows how to write a real clang-based refactoring: building a clang-tidy check, composing AST matchers, and emitting fix‑its that actually edit code. Covers the matcher APIs, traversal caveats, and applying fixes via compilation databases and ninja builds. Mentions tools that migrated over half a million call sites and removed 600+ APIs and a live example that adds const auto& to stop copies, with tests and build-time integration — practical, concrete, and demonstrably working.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 3:10Why build refactoring tools
- 9:22Clang-tidy and use cases
- 15:57Clang AST for refactoring
- 22:14Building AST matchers
- 32:00First clang-tidy check
- 39:58Live demo of check
- 43:28Advanced tooling examples
- 51:22Designing checks
- 55:13Upstreaming checks
- 1:01:30Q&A
related talks
56mHow to Refactor Millions of Line of Code Without Alienating Colleagues
59mMechanical C++ Refactoring in the Present and in the Future
24mRefactoring Legacy Codebases with LibTooling
01h 05mImprove your code with Clang Tooling
01h 24mExtending clang-tidy in the Present and in the Future
52m“Tools from the C++ eco-system to save a leg”
29mUsing the Clang developer tools
01h 03mElevate Your Code to Modern C++11 with Automated Tooling
