[cfe-commits] r83764 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/CMakeLists.txt lib/Sema/Sema.h lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExceptionSpec.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaType.cpp test/SemaCXX/exception-spec.cpp

Douglas Gregor dgregor at apple.com
Mon Oct 12 14:10:39 PDT 2009


On Oct 12, 2009, at 2:05 PM, Sebastian Redl wrote:

> Douglas Gregor wrote:
>>
>>> +  // C++ 15.4p2: A type denoted in an exception-specification shall
>>> not denote
>>> +  //   an incomplete type.
>>> +  // FIXME: This isn't right. This will supress diagnostics from
>>> template
>>> +  // instantiation and then simply emit the invalid type  
>>> diagnostic.
>>> +  if (RequireCompleteType(Range.getBegin(), T, 0))
>>> +    return Diag(Range.getBegin(),
>>> diag::err_incomplete_in_exception_spec)
>>> +      << Range << T << /*direct*/0;
>>
>> You should be able to use partial diagnostics to get the diagnostic
>> you want within RequireCompleteType.
> Can partial diagnostics store parameters?

Yep! They're wonderful little things.

>>> +  llvm::SmallPtrSet<const Type*, 8> Types;
>>
>> Should this be a
>>
>>  llvm::SmallPtrSet<CanQualType, 8> Types;
>>
>> ?
> Probably. This code has been lying around on my computer since before
> CanQualType was introduced, and I haven't really looked at this new
> class yet.

CanQualType is an "always-canonical" QualType. It's a nice way to  
document when we know that a type is canonical (statically).

>>> +  // Neither contains everything. Do a proper comparison.
>>> +  for (FunctionProtoType::exception_iterator SubI =
>>> Subset->exception_begin(),
>>> +       SubE = Subset->exception_end(); SubI != SubE; ++SubI) {
>>> +    // Take one type from the subset.
>>> +    QualType CanonicalSubT = Context.getCanonicalType(*SubI);
>>> +    bool SubIsPointer = false;
>>> +    if (const ReferenceType *RefTy =
>>> CanonicalSubT->getAs<ReferenceType>())
>>> +      CanonicalSubT = RefTy->getPointeeType();
>>> +    if (const PointerType *PtrTy =
>>> CanonicalSubT->getAs<PointerType>()) {
>>> +      CanonicalSubT = PtrTy->getPointeeType();
>>> +      SubIsPointer = true;
>>> +    }
>>
>> Are there pointer-to-member cases we need to check here?
> No. Pointers-to-member don't have implicit hierarchy conversions for
> their pointee, so if you decide to throw a pointer-to-member (what a
> thing to do), you can only catch it with an exact type match.


Okay, thanks for the clarification!

	- Doug



More information about the cfe-commits mailing list