~/talk

Refactoring Legacy Codebases with LibTooling

Talkat CppCon 2018 · 2018-09-23..09-28· [developer-experience, c-and-cpp]
slides:none on file

Describes using LibTooling with Clang AST matchers to write automated refactors that run on large legacy codebases, including creating a compile_commands database (CMake or Bear), running regressions on open‑source code (~2 million lines in LLVM/Clang) to catalog edge cases, and testing via unit tests plus binary diffing for nonbehavioral changes. Shows a concrete tool that adds const qualifiers to lvalue references by matching AST nodes, emitting replacements, and running multi‑pass or cross‑TU steps; full runs take hours.

AI-written summary · about

  1. 0:00Introduction to legacy refactoring
  2. 1:09What is LibTooling
  3. 1:52Legacy code challenges
  4. 3:16Mitigating risk without tests
  5. 6:10Testing tools on open source
  6. 7:41Making code Clang-compatible
  7. 8:48Building your first tool
  8. 15:12Multi-translation unit changes
  9. 17:17Atomic vs non-atomic refactoring
  10. 19:34Tool development workflow
  11. 20:19Q&A session
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.