Awesome
Awesome Clang
Useful resources and samples for using Clang-related tools, or for building stuff on top of Clang.
*Inspired by the awesome list thing.
Tools
clang-format
- clang-format docs - A tool to format C/C++/Java/JavaScript/Objective-C/Protobuf code.
- style options - clang-format style options.
- configurator - clang-format configurator.
clang-tidy
- clang-tidy - clang-based C++ linter tool.
- List of clang-tidy checks
- Writing a basic clang static analysis check
pp-trace
- pp-trace - tool that traces preprocessor activity.
Clang static analyzer
- Clang Static Analyzer - a source code analysis tool that finds bugs in C, C++, and Objective-C programs.
- scan-build -Running the analyzer from the command line.
- Static Analysis with clang
- CodeChecker - defect database and viewer extension for Clang Static Analyzer.
- clang-analyzer-guide An easy guide to Clang Static Analyzer extension.
AddressSanitizer
- AddressSanitizer - a fast memory error detector.
- Address Sanitizer - overview by Mike Ash.
Other Clang-based tools
- C++ Insights - a clang-based tool which does source to source transformation. Its goal is it to make things visible which normally, and intentionally, happen behind the scenes. Live/online demo available.
- Clang Power Tools - Visual Studio extension with Clang/LLVM tools (
clang++
,clang-tidy
andclang-format
).
Libraries
LibClang
- libclang: - C Interface to Clang.
- Introduction to libclang
- LLVM & Clang library usage samples
- lloccount - C/C++ Logical Lines Of Code Counter.
- libclangmm - C++-wrapper for libclang (developed for juCi++)
- Customizable Naming Convention Checker - similar to clang-format, but for naming conventions only.
- irony-mode - A C/C++ minor mode for Emacs powered by libclang.
- c99-to-c89 - Tool to convert C99 code to MSVC-compatible C89.
- ClangKit - Objective-C frontend to LibClang.
- Skipping library code in gdb with help from libClang - using libClang’s Python bindings.
LibTooling
- LibTooling - library to support writing standalone tools based on Clang
- Tutorial for building tools using LibTooling and LibASTMatchers
- Modern source-to-source transformation with Clang and libTooling
- AST matchers and Clang refactoring tools
- Compilation databases for Clang-based tools
- LibTooling Example
Important Clang concepts
- Quick overview of how Clang works internally
- Getting Started with LLVM Core Libraries - PacktPub books can be a bit hit and miss, but this one is excellent. (A PDF with updates for Clang 3.5 is available for free download).
- Introduction to the Clang AST - a gentle introduction to the mysteries of the Clang AST.
- Matching the Clang AST - how to use Clang’s LibASTMatchers to match interesting nodes of the AST and execute code that uses the matched nodes.
- AST Matcher Reference - AST matchers implemented by Clang.
- How to build LLVM from source - Step-by step, using the GitHub mirror.
- Writing LLVM Pass in 2018 — Part I - New Pass & Pass Manager in a Peek.
- The future of Clang-based tooling
Videos
- Create your own Refactoring Tool in Clang - Richard Thompson's presentation from C++Now 2014.
- Refactoring C++ with Clang - Chandler Carruth's talk from C++Now 2012.
- Automatic C++ source code generation with clang - Sergei Sadovnikov's ACCU 2017 talk.
Tips
Contributions welcome :)
License
<a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.