Pets, Cattle and Automatic Clang Operations with C++ Code
summary
Shows how to use Clang tooling to automate real refactors and searches using clang-query matchers, clang-transform/ClangTidy fixes, and libclang python bindings to script one-off generators. Demonstrates matching a buggy conditional_variable wait pattern and replacing pointer args with references across a codebase, and converting hundreds of span string literals into an enum to cut CPU and network cost. Requires compile_commands.json and yields diffs applied to files so the changes actually compile and run.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 3:17Codebase problems at scale
- 10:27Regex limits for code tasks
- 13:17How compilers parse code
- 16:09Clang tooling: matches & transforms
- 22:22Debugging matchers with Clang Query
- 25:10Fixing code standards with Clang Transform
- 36:18Generating code from patterns
- 46:06Automate or manual tools?
- 47:53Summary & Q&A
related talks
24mRefactoring Legacy Codebases with LibTooling
56mHow to Refactor Millions of Line of Code Without Alienating Colleagues
01h 05mImprove your code with Clang Tooling
01h 01mHow to Refactor Millions of Line of Code Without Alienating your Colleagues
29mUsing the Clang developer tools
01h 03mHow to Build Your First C++ Automated Refactoring Tool
59mMechanical C++ Refactoring in the Present and in the Future
01h 24mExtending clang-tidy in the Present and in the Future
