diff options
author | Balazs Benics <balazs.benics@sigmatechnology.se> | 2022-06-14 13:43:04 +0200 |
---|---|---|
committer | Balazs Benics <balazs.benics@sigmatechnology.se> | 2022-06-14 13:43:04 +0200 |
commit | de6ba9704d0b4fa047a030b5bf369e425b937198 (patch) | |
tree | 1687bae651c87c24c625192c02cc7ac79a33621a /clang/lib/CodeGen/ModuleBuilder.cpp | |
parent | 6bf27918144cb843cf5ae9a93cb5f936730f3cce (diff) | |
download | llvm-de6ba9704d0b4fa047a030b5bf369e425b937198.zip llvm-de6ba9704d0b4fa047a030b5bf369e425b937198.tar.gz llvm-de6ba9704d0b4fa047a030b5bf369e425b937198.tar.bz2 |
[analyzer][Casting] Support isa, cast, dyn_cast of SVals
This change specializes the LLVM RTTI mechanism for SVals.
After this change, we can use the well-known `isa`, `cast`, `dyn_cast`.
Examples:
// SVal V = ...;
// Loc MyLoc = ...;
bool IsInteresting = isa<loc::MemRegionVal, loc::GotoLabel>(MyLoc);
auto MRV = cast<loc::MemRegionVal>(MyLoc);
Optional<loc::MemRegionVal> MaybeMRV = dyn_cast<loc::MemRegionVal>(V)
The current `SVal::getAs` and `castAs` member functions are redundant at
this point, but I believe that they are still handy.
The member function version is terse and reads left-to-right, which IMO
is a great plus. However, we should probably add a variadic `isa` member
function version to have the same casting API in both cases.
Thanks for the extensive TMP help @bzcheeseman!
Reviewed By: bzcheeseman
Differential Revision: https://reviews.llvm.org/D125709
Diffstat (limited to 'clang/lib/CodeGen/ModuleBuilder.cpp')
0 files changed, 0 insertions, 0 deletions