[LLVMdev] [cfe-dev] UB in TypeLoc casting
Ted Kremenek
kremenek at apple.com
Fri Feb 15 16:55:37 PST 2013
On Feb 11, 2013, at 12:02 PM, David Blaikie <dblaikie at gmail.com> wrote:
> Beyond that, though, I've hit one hierarchy in the Static Analyzer
> that does this as well: ProgramPoint. On IRC Jordan Rose mentioned
> that there's another more pervasive use of this pattern in the Static
> Analyzer, the SVal hierarchy.
>
> So, Ted, how objectionable would it be for me to introduce something
> like (names subject to adjustment):
>
> template<typename T>
> T SVal::castAs();
>
> template<typename T>
> llvm::Optional<T> SVal::getAs();
>
> (the implementations of these functions might involve invoking private
> FooSVal(SVal) ctors in each SVal derived type - so adding a bit of
> boilerplate ctors to all those classes)
>
> and replace "cast<FooSVal>(bar)" with "bar.castAs<FooSVal>()" and
> dyn_cast with getAs similarly? & similarly for the ProgramPoint (&
> TypeLoc - which I'm already working on) hierarchies?
>
Sorry everyone for not seeing this. Jordan was nice enough to ping me. I would be perfectly fine with this change, and I think it looks cleaner anyways. I think it is a great idea.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130215/85b27e5d/attachment.html>
More information about the llvm-dev
mailing list