March 1st, 2022

Execution and Static Analysis Support for MSVC on Compiler Explorer

Sy Brand
C++ Developer Advocate

Compiler Explorer is a popular resource for visualizing the assembly output of various compilers, trying out different compiler versions and flags, and testing many popular libraries.

We’re pleased to announce that, as of today, code execution and static analysis are now available for MSVC on Compiler Explorer. Execution on CE has been one of our highest voted tickets on Developer Community, so we hope many of you will find it useful. The static analysis tool provided is the same as offered in GitHub Actions and in the IDE as background code analysis.

To enable code execution, tick the “Execute the code” box in the “Output…” menu. Now, every time the code is compiled, it will be run and the output will be displayed in the Output window.

Execute the code and compile to binary options highlighted in the output menu

To enable static analysis, select “Static Analysis” from the “Add tool…” menu. Output from the tool will be written to a new Static Analysis window. You can find out more about our toolchain’s static analysis capabilities in our code analysis documentation.

Static analysis highlighted in the add tool menu

You can see the static analysis in action below.

Static analysis finding an issue with the code

A huge thanks to Matt Godbolt and Patrick Quist from the Compiler Explorer team for their support. On the Microsoft side, much of this work was done by Tim Myers and Dale Hirt.

You can let us know what you think of the new support on Twitter @visualc or in the comments below.

Category
Announcement

Author

Sy Brand
C++ Developer Advocate

Sy Brand is Microsoft’s C++ Developer Advocate. Their background is in compilers and debuggers for embedded accelerators, but they’re also interested in generic library design, metaprogramming, functional-style C++, undefined behaviour, and making our communities more inclusive and welcoming.

1 comment

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

  • Olaf van der Spek

    Nice!
    It’d also be nice if we could kinda do the same in MSVC itself..
    It shouldn’t be necessary to create an entire project just to compile some C++ snippet.