Real-time C++ memory safety analysis: use-after-free, null dereferences, memory leaks, and cross-function UAF. Requires the safecpp binary on PATH — see https://safecpp.dev for install instructions.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Real-time C++ memory safety analysis powered by SafeCpp and Clang LibTooling.
Features
Squiggly underlines on use-after-free, null dereferences, memory leaks, and cross-function UAF — inline, as you save
Hover tooltips explaining what went wrong and how to fix it
Problems panel integration (Ctrl+Shift+M) showing all findings across your project
Status bar showing issue count — click to open the full HTML report
Related information links: for UAF, the error points to the use site and a related location link shows the free site
Dark/light theme in HTML reports
Requirements
The safecpp binary must be installed and on your PATH (or configured in settings).
Quick install:
# From source
git clone https://github.com/you/safecpp && cd safecpp && make
sudo cp safecpp /usr/local/bin/
Usage
Open any .cpp or .c file
Save it — analysis runs automatically
See squiggly underlines for any violations
Check the Problems panel (Ctrl+Shift+M) for the full list
Click the SafeCpp: N issues status bar item to open the HTML report
Commands
Command
Description
SafeCpp: Analyze Current File
Run on the active file
SafeCpp: Analyze Workspace
Run on all C/C++ files in workspace
SafeCpp: Open HTML Report
Open last report in browser
SafeCpp: Clear All Diagnostics
Remove squiggly lines
Settings
Setting
Default
Description
safecpp.binaryPath
"safecpp"
Path to binary
safecpp.runOnSave
true
Auto-analyze on save
safecpp.compileCommandsPath
""
Path to compile_commands.json
safecpp.autoDetect
true
Auto-detect build system
safecpp.severityThreshold
"warning"
Minimum severity to show
safecpp.configFile
""
Path to .safecpp.json
Example
void example() {
int* ptr = new int(42);
delete ptr;
int val = *ptr; // ← red squiggly: use-after-free
// SafeCpp: Use-after-free: 'ptr' freed at line 3, used here
}