mgehre / llvm-project

The home of the clang-based implementation of lifetime safety warnings.
39 stars 4 forks source link
clang lifetime llvm safety static-analysis

Actions Status

The -Wlifetime warnings implemented in clang

This project contains clang's experimental implementation of the lifetime safety profile of the C++ core guidelines.

You can try this implementation on Compiler Explorer by choosing the clang version experimental -Wlifetime.

Warning flags

Suppress Warnings

Build

You can either try it on Compiler Explorer, or build clang yourself:

mkdir build
cd build 
cmake ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS=clang
make
# Run the tests (optional)
make check-clang 
# Use clang
./bin/clang++ <some-source> <warning-flags>

Further information

The specification

CppCon 2019 Talk, focusing on statement local analysis

EuroLLVM 2019 Talk, focusing on flow-sensitive analysis

CppCon 2018 Talk, focusing on flow-sensitive analysis

CppCon 2018 Keynote, by Herb Sutter

CppCon 2015 Keynote, by Herb Sutter, first introduction

Development

Tests:

Implementation: