Get started with Clang Power Tools
All programming languages get updates from time to time, and C++ is no exception. Everyone remembers the C++ 98 standard which we all started with. Remember programming before lambda expressions? All those function objects...
Nowadays, with all the modern features that the language offers, there’s no reason to look back but there are a few excellent reasons to upgrade your legacy code. Most of today's C++ community has enrolled in this mission.
Here is where Clang Power Tools comes to the rescue of Visual Studio C++ developers. It encapsulates in a small package all the Clang LLVM features you need to modernize and improve your code. More than that, Clang Power Tools comes as a Visual Studio Extension, so it’s easy to install and even more comfortable to use directly from the IDE due to the great integration with the development environment.
- What we need to get started
- Installing Clang Power Tools
- Setting up LLVM
- Running your first command
What we need to get started
Before using Clang Power Tools, we must do some prep work and make sure everything set-up and ready to go.
- Be sure you have at least one of the following Visual Studio editions:
- ▪ 2017
- ▪ 2019
- ▪ 2022
💡 Visual Studio 2015 is no longer actively supported. You can download and use Clang Power Tools v7.5, our last version to support that environment.
If you are running Windows 10 then you can easily jump on the next step. Otherwise, be sure you have at least Power Shell 3.0 installed or a newer version.
- The final requirement is to download and install LLVM, which can be done directly from Clang Power Tools after installation. See the Setting up LLVM section for more information.
Installing Clang Power Tools
Open Visual Studio and select the Extensions option from the top menu.
Choose Manage Extensions from the drop-down menu.
💡 For Visual Studio 2017 you will find Manage Extensions under the Tools option.
In the new window select Online from the left panel and search for Clang Power Tools in the top right corner search box.
Press the Download button and close Visual Studio to start the installation process.
💡 In order to begin the installation, all the Visual Studio instances must be closed.
Press Modify and wait for the installation process to finish.
After the installation, reopen Visual Studio code editor and Clang Power Tools will come alive.
💡 Clang Power Tools can also be downloaded from the Visual Studio Marketplace. Once the download is complete simply run the ClangPowerTools.visx file and continue with Step 5 to complete the installation.
Setting up LLVM
We are very close to taking full advantage of the Clang Power Tools functionality. One last step and the configuration is complete.
To install one of the supported LLVM versions is a very smooth process thanks to the install LLVM feature which is already integrated into Clang Power Tools. The fastest way is to:
Open Visual Studio and select the Settings option from our toolbar.
After the Clang Power Tools setting panel will pop-up, select the LLVM tab from the top menu.
Press the Download button on your favorite LLVM version. The installation process will start automatically after the download is complete.
In a short time, the installation will be finished, and Clang Power Tools will be all set.
💡 Learn more about Setting up LLVM.
Running your first command
Clang Power Tools is created to offer the best experience out of the box. That being said, after the short requirements set-up, the extension comes with a predefined set of options activated and is ready to run. Here is all you need to do:
Execute one of the commands from Clang Power Tools Toolbar or Context Menu on a .cpp file. Let’s choose Clang Compile as an example.
After the command was pressed, keep the eyes on the Visual Studio Output window for more information from the Clang compiler.
When the command is finished, all the error messages found in your code will be revealed in the Error List.
Now you know how to launch the main commands with the default configuration. Also, you made the first steps into the Clang compile experience, and all of this was possible with the help of Clang Power Tools.
This is just the beginning of your journey with Clang Power Tools. Many other features are waiting to be discovered, and many more will come in the near feature.
If you have any suggestion or feedback report, we highly encourage you to let us know on our GitHub. Until then, happy coding!