C++Now 2017 has ended
Back To Schedule
Saturday, May 20 • 8:45am - 10:15am
clang-useful: Building useful tools with LLVM and clang for fun and profit

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
Slides: https://github.com/boostcon/cppnow_presentations_2017/blob/master/05-20-2017_saturday/clang_useful_building_useful_tools_with_llvm_and_clang_for_fun_and_profit__peter_goldsborough__cppnow_05-20-2017.pdf
Video: https://www.youtube.com/watch?v=E6i8jmiy8MY

The talk will consist of two parts. The first will be a general overview of the LLVM and clang library infrastructure available for creating custom tools such as static analyzers or source-to-source transformation tools. I will explain the ecosystem of the LLVM and clang tooling environment and outline options, tradeoffs and examples of the different ways of creating a tool (e.g. the difference between creating a plugin vs. a LibTooling executable). I will then go further in depth about how clang represents C++ source code by means of an AST and ways of traversing the AST to look for certain points of interest, e.g. old-style for loops that could be converted to range-based loops, or braces that are indented in Allman instead of One-True-Brace-Style, which could be useful for any company with a style guide it wants to enforce at compile-time rather than on paper or in code-reviews.

For the second part, I will then branch out into the two common tasks one might want to perform with a custom-built tool: emitting warnings or errors (for static analysis), and transforming and emitting new code (source-to-source transformations, such as clang-tidy). For each use-case, I will walk through real code that shows how one might approach a simple task in each category.

At the end of the talk, I expect listeners to have a basic understanding of the LLVM/clang tooling environment and AST representation. However, most importantly, I expect people to take away knowledge they can take home or to their office and immediately build tools in no time at all that *genuinely* improve their workflow and productivity. This is not a "give a man a fish" talk. This is a "teach a man to fish" talk.

avatar for Peter Goldsborough

Peter Goldsborough

Software Engineer, Anduril
I enjoy the intersection of blue-skies machine learning research and low-level infra engineering.

Saturday May 20, 2017 8:45am - 10:15am MDT
Flug Auditorium