[cfe-dev] RFC: unreachable catch-clauses due to superclass cathes
Martin Doucha
next_ghost at quick.cz
Thu Jul 30 16:57:46 PDT 2009
Erik Verbruggen wrote:
> Hi all,
>
> After doing duplicate handlers for exceptions in C++, there is still a FIXME in Sema::ActOnCXXTryBlock which I am thinking of fixing:
>
> // FIXME: We should detect handlers that cannot catch anything because an
> // earlier handler catches a superclass. Need to find a method that is not
> // quadratic for this.
>
> I pondered a bit on this, and I cannot think of a non-quadratic algorithm. So, does anybody have ideas for this?
>
> I am currently thinking of implementing a quadratic algorithm for it, and keep a TODO mentioning that the algorithm should be improved. That way, there at least is a check, albeit maybe not the most efficient one.
Hi,
that sounds like lowest common ancestor problem to me. That's O(n+q) for
trees where n is the total count of classes in the module and q is the
number of queries. Perhaps the problem could be generalized to DAGs.
Regards,
Martin Doucha
More information about the cfe-dev
mailing list