[cfe-commits] r70389 - in /cfe/trunk: include/clang/Parse/DeclSpec.h include/clang/Parse/Parser.h lib/Parse/DeclSpec.cpp lib/Parse/ParseDecl.cpp lib/Parse/ParseDeclCXX.cpp lib/Parse/ParseExpr.cpp lib/Sema/SemaDecl.cpp test/Parser/cxx-exception-spec.cpp www/cxx_status.html

Douglas Gregor dgregor at apple.com
Wed Apr 29 13:45:38 PDT 2009


On Apr 29, 2009, at 1:30 PM, Sebastian Redl wrote:

> Douglas Gregor wrote:
>> On Apr 29, 2009, at 10:30 AM, Sebastian Redl wrote:
>>
>>> Author: cornedbee
>>> Date: Wed Apr 29 12:30:04 2009
>>> New Revision: 70389
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=70389&view=rev
>>> Log:
>>> Have the parser communicate the exception specification to the  
>>> action.
>>
>> Oooh, I have a feeling you're going to run into C++'s "shadow type
>> system" very soon :)
>>
> What? Are you talking about compatibility of functions and function
> pointers with exception specifications?

Yes. Exception specifications act like they are part of a function  
pointer type in some cases, but from the type-identity perspective  
they are not part of the function type.

>>>
>>> +    // FIXME: Does an empty vector ever allocate? Exception
>>> specifications are
>>> +    // extremely rare, so we want something like a
>>> SmallVector<TypeTy*, 0>. :-)
>>> +    std::vector<TypeTy*> Exceptions;
>>
>> I've never seen an std::vector that allocates. Now, it might be worth
>> using a SmallVector<TypeTy*, 4>, just so that a one- or two-exception
>> exception specification doesn't need to allocate. Besides, stack  
>> space
>> is cheap :)
> How often are non-empty exception specifications really used in
> real-world code? As far as I know, everyone avoids them. They're  
> ignored
> by MSVC completely, and are a performance pessimization in exchange  
> for
> an inadequate exception translation mechanism everywhere else.


Yes, non-empty are very, very rare . Either the std::vector or the  
llvm::SmallVector is fine here.

	- Doug



More information about the cfe-commits mailing list