[cfe-commits] r70256 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/Sema.h lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp test/SemaCXX/exceptions.cpp www/cxx_status.html
Sebastian Redl
sebastian.redl at getdesigned.at
Wed May 13 00:56:56 PDT 2009
On Tue, 12 May 2009 23:45:44 -0700, Chris Lattner <clattner at apple.com>
wrote:
> On Apr 27, 2009, at 11:25 PM, Sebastian Redl wrote:
>
>>
>> On Mon, 27 Apr 2009 15:10:30 -0700, Chris Lattner <clattner at apple.com>
>> wrote:
>>>
>>> Instead of doing this as a treewalk, how about handling this in sema
>>> of a return. Just check to see if the context is a construction
>>> function whose body is a try block there?
>>
>> I've thought about this. However, this would mean either an additional
>> state variable in Sema (and it would have to be saved for members of
>> local
>> classes), or a non-trivial query for every return statement.
>> Function-try-blocks are so rare in real-world code that I think my
>> way is
>> better.
>
> How is this query non-trivial? Isn't it just a context check?
The way I see it, I either have to walk the scope tree upwards until I get
to the function scope, to discover that it's a catch, or I have to take the
current function, get its body, discover that it's a try, and then somehow
discover that I'm in one of the catches of the try. I don't even know how
to do that, but I'm certain its cost is not negligible.
Sebastian
More information about the cfe-commits
mailing list