GNU Compiler Collection (GCC) is an open-source, cross-platform compiler suite with a mature and widely-used C++ compiler implementation. GCC version 4.5.0 has added a new dynamic plugin architecture which allows the customization of the compilation process as well as the compiler components reuse. The goal of this presentation is to show how to parse C++ using a GCC plugin.
The talk begins with a high-level overview of the GCC plugin architecture as well as the internal representation of a parsed translation unit. It then presents a simple plugin implementation that prints information about C++ declarations being compiled. The talk continues by covering a number of more advanced techniques, including injection of extra C++ code before or after the main translation unit, programmatic template instantiation, and handling of application-specific pragmas and attributes.
The presentation will be incomplete without a brief comparison of the GCC plugin architecture with Clang, another…