This change specializes the LLVM RTTI mechanism for SVals.
After this change, we can use the well-known isa, cast, dyn_cast.
// 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.
I'm not sure, shall I add tests?
Thanks for the extensive TMP help @bzcheeseman!