Skip to content
0:00 / 0:00

#clang#llvm#chandlercarruth

Chandler Carruth: Refactoring C++ with Clang

CppNow

39K subscribers • 47 videos on Hallway • Conference channel

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • A classic. People kept recommending it from 2013 to 2024.
  • Presented by Chandler Carruth

Intermediate. Assumes working knowledge.

19K views14 years ago2 recommendations

Systems programmingTools and practiceC++Compilers and interpretersRefactoring and legacy code

Chandler Carruth introduces the Clang-based tooling infrastructure for automated, safe C++ source-to-source code transformations and refactoring.

Chandler's talk from C++Now 2012 For over a decade, C++ developers have envied the tooling support that languages like Java have. With Clang we finally have a tooling framework that allows us to reason about C++ code easily enough to be able to build safe automated transformations. This talk will introduce the infrastructure we are building on top of Clang to support automatic recognition and transformation of specific C++ patterns. We'll then show all of the pieces necessary to build an actual source-to-source translation tool to update from an old API to a new and different API. --- *--* ---

Why it's here

2 people recommend this

What people say. Recommended as an excellent introduction to using Clang tooling for automated C++ refactoring.

u/grunzlin r/programming • Recommends

On “[Bash] C++ code refactoring tool”

Google seems to have developed clang-based refactoring tools (see e.g. this). Not sure if they have released that toolset, all I could find was this.

u/ewmailingin r/C_Programming • Recommends

On “Tools for parsing and modifying hundreds if not thousands of C files?”

There are clang tools (e.g. clang-rename) to assist refactoring and changing C/C++ code. I remember Chandler Carruth (clang/LLVM guru that works at Google) spoke about them in some talks. link to this video Somebody else mentioned awk/sed/grep and Perl, which are good for changing things using regular expressions. (I use Perl myself for a lot of simple changes.) But since language grammars are more complex than what regular expressions can handle, you might want to move up the computer science automata ladder. Lua helped popularize Parsable Expression Grammars (PEGs) and has a parsing library called LPEG which is loosely analogous from moving up from regular expressions to context-free grammars. Bo…