[cfe-commits] r112482 - in /cfe/trunk: lib/Sema/SemaExceptionSpec.cpp test/SemaCXX/MicrosoftExtensions.cpp test/SemaCXX/exception-spec.cpp

Douglas Gregor dgregor at apple.com
Mon Aug 30 11:48:12 PDT 2010


On Aug 30, 2010, at 11:46 AM, Michael Spencer wrote:

> On Mon, Aug 30, 2010 at 11:04 AM, Douglas Gregor <dgregor at apple.com> wrote:
>> Author: dgregor
>> Date: Mon Aug 30 10:04:51 2010
>> New Revision: 112482
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=112482&view=rev
>> Log:
>> Emulate (some of) Microsoft's looser semantic checking of exception
>> specifications, from Martin Vejnar!
>> 
>> 
>> Modified:
>>    cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
>>    cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp
>>    cfe/trunk/test/SemaCXX/exception-spec.cpp
>> 
>> Modified: cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExceptionSpec.cpp?rev=112482&r1=112481&r2=112482&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaExceptionSpec.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaExceptionSpec.cpp Mon Aug 30 10:04:51 2010
>> @@ -261,6 +261,14 @@
>> 
>>   bool OldAny = !Old->hasExceptionSpec() || Old->hasAnyExceptionSpec();
>>   bool NewAny = !New->hasExceptionSpec() || New->hasAnyExceptionSpec();
>> +  if (getLangOptions().Microsoft) {
>> +    // Treat throw(whatever) as throw(...) to be compatible with MS headers.
>> +    if (New->hasExceptionSpec() && New->getNumExceptions() > 0)
>> +      NewAny = true;
>> +    if (Old->hasExceptionSpec() && Old->getNumExceptions() > 0)
>> +      OldAny = true;
>> +  }
> 
> I really don't like accepting bugs without any warnings. Clang should
> complain if it ever sees this in anything but a Windows Platform
> header (or macro expanded from such).

Yes, that's a good point. This should ExtWarn when it's actually accepting incompatible exception specifications.

	- Doug



More information about the cfe-commits mailing list