Back with VS2019 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 the IFC SDK, a Microsoft implementation of the IFC Specification. This is an open-source project under the Apache 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). An IFC 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 the Specification, and for changes required to support C++ standards starting from C++20 and upwards.
Call to Action
We encourage you to check out the IFC SDK repo, build it, experiment with it, and contribute. 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 the IFC Specification repo and share feedback, suggestions, or bug fixes. You can also reach us on Twitter (@VisualC), or via email at visualcpp@microsoft.com.
"Back with VS2019 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."
My current experience with VS2022 and VSCode is that IntelliSense doesn't work at all. It would be nice to have an update on the roadmap completing C++20/C++23 compiler features and IDE support, now that CMake supports modules officially.
Also better cross-compiler tutorials explaining how to properly...
Thanks for the feedback. CMake support for modules in 3.27.x series (the current release, as of this writing) is still experimental. We will be sure to update the community when CMake support for C++ Modules is no longer experimental. We are working on cross-platform educational materials.
What about making use of IFC to provide modern tooling for working with COM and WinRT, instead of IDL files and manually merging generated C++ code?
Thanks for the suggestion; I will pass it along to the teams.
That’s an excellent move, but I have been struggling with compiler bug after compiler bug getting modules to work. I think the compiler needs a bit more stability there, to be honest.
Sorry to hear about your struggles with the compiler. If you’ve submitted bug reports concerning those issues, please could you provide links? If not, I would encourage you to submit bug reports so we can investigate them.