October 3rd, 2023
heart4 reactions

Open Sourcing IFC SDK for C++ Modules

GDR
Software Architect

Back withVS2019 version 16.10, we announced a complete implementation of C++ Modules (and, generally, of all C++20 features) across the MSVC compiler toolset, static analysis, IntelliSense, and debugger. Implementing Modules requires principled intermediate representation of C++ source programs. Today, we are thrilled to announce the availability of theIFC SDK, a Microsoft implementation of theIFC Specification. This is an open-source project under theApache 2-with-LLVM-exception license. The IFC Specification formalizes C++ programs as data amenable to semantics-based manipulation. We are open sourcing the IFC SDK in the hope of accelerating widespread use and implementation of C++ Modules across the C++ community and the C++ tools ecosystem.

What Is an IFC and What Is It Good for?

A popular compilation strategy of a C++ Module interface (or header unit) source file is to translate the source file, exactly once, into an internal representation suitable for reuse in other source files. That intermediate form is generally referred to as a Built Module Interface (BMI). AnIFC file is an implementation of the BMI concept. An IFC file is a persistent representation of all information pertaining to the semantics of a C++ program. In addition to direct use by compilers to implement C++ Modules, an IFC can also be inspected by non-compiler tools for semantics-based exploration of C++ source files. Such tools are useful for explorers in understanding how C++ source-level constructs can be represented in a form suitable for C++ Modules implementation.

IFC SDK Scope

The IFC SDK is currently an experimental project. It focuses on providing datatypes and source code supporting the read and write of IFC files. This SDK is the same tested implementation used in the MSVC compiler front-end to implement C++ Modules.  Consequently, while the GitHub OSS repo is “experimental”, the code is far from it. Those datatypes can be memory-mapped directly for scalable and efficient processing. The project also features utilities for formatting or viewing IFC files. We welcome, and we are looking for, contributions that fix gaps between the SDK and theSpecification, and for changes required to support C++ standards starting from C++20 and upwards.

Call to Action

We encourage you to check out theIFC SDK repo,build it, experiment with it, andcontribute. We would like to hear from you. If you’re a C++ compiler writer interested in supporting the IFC file format, please reach out at theIFC Specification repo and share feedback, suggestions, or bug fixes.  You can also reach us on Twitter (@VisualC), or via email atvisualcpp@microsoft.com.

 

Author

GDR
Software Architect

A mathematician interested in all aspects of software construction, with bias towards computational logic, formal methods, systems programming, and the fun of building tools

6 comments

Discussion is closed.Login to edit/delete existing comments.

Stay informed

Get notified when new posts are published.
Follow this blog