Inside a static analyser: type system
summary
PVS‑Studio’s C/C++ analyser replaces slow encoded string representation of types with a class‑hierarchy and factory that interns every unique type, yielding single‑instance types and faster equality checks. It adds canonical types to collapse typedef chains, uses a pointer‑with‑qualifier byte trick to store const/volatile in low bits, and exposes compile‑time‑style traits (no virtuals) for cheap checks like “is pointer to int”. Implementation targets practical speed and memory wins and is already used to simplify rule logic and reduce repeated string traversal.
AI-written summary · about
chapters (21)
- 0:00Intro
- 1:03What is this about
- 1:58A static analyser?
- 5:32Back to types
- 7:58Representing types
- 10:01Encoding
- 11:58One tiny issue
- 12:51Another tiny issue
- 16:09Huge problems
- 19:00Let's estimate
- 22:05The better system
- 23:16Structure
- 25:32Canonical type
- 31:53Qualifiers
- 36:29Quality pointer
- 37:02How it fits together
- 39:29Profit
- 42:42Polymorphism?
- 45:41Another way
- 46:02Traits
- 48:40Summary
related talks
09mModern Static Code Analysis the Example of PVS-Studio
43mEverything I learned about static analysis and program safety in C++
01h 01m“Static Analysis and C++: More Than Lint"
01h 10mThe C++ Type System Is Your Friend
19mA Dependent Nominal Physical Type System for Static Analysis of Memory in Low Level Code
51mThe C++ Type System is your Friend
55mLessons learned while coding my first functional type system in constexpr C++
53mDebug C++ Without Running
