do not click

Meeting C++ 2024   |  Online   |  Training   |  Books   |  Survey   |  Job fair   |  Advertising   |  Jobposting   |  Login

Meeting C++ 2024 - Customising clang-tidy to modernise your legacy C++ code

Conference | Live Schedule | Talks | Get your ticket | Set your timezone

Customising clang-tidy to modernise your legacy C++ code

Join session

Mike Crowe

On Day 2 at 16:00 in Track D online

Modernising your codebase sounds fun to start with, but quickly gets tedious. Can we use tools to help us speed through the tedious bit?

This is tale of how I've modernised over seven thousand individual lines of rather old C++ code by mostly-automatically moving its diagnostic logging from using wrappers for `printf` to libfmt's fmt::printf, then to fmt::print and hopefully on to C++23's std::print by using a small clang-tidy check based on the code behind Clang 17's modernize-use-std-print clang-tidy check.

We'll consider how the move to fmt::printf was easy and beneficial, why moving to fmt::print was rather harder and how that led me to write what became the modernize-use-std-print clang-tidy check and then adapt it for our use case. Having done that, I was able to re-use that work for more checks to modernise more of the code.

If you're thinking, "I'm no LLVM or Clang expert, so maybe this talk is not for me" - I'm not either! So I'll share some of the challenges I faced on the way to help you avoid them and get to the fun part faster.

Please login to comment

Copyright Meetingcpp GmbH Imprint Piwik Opt out Privacy Policy