This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Remove assert in TreeTransform<Derived>::TransformObjCObjectType
ClosedPublic

Authored by ahatanak on Feb 17 2016, 3:28 PM.

Details

Summary

The assert is triggered when there is a template function whose return type is a protocol without an object type (e.g., "<P1>"). clang treats such a protocol as a synonym for "id<P1>" and sets ObjCObjectTypeLocInfo::HasBaseTypeAsWritten to false in Sema::actOnObjCProtocolQualifierType, which later causes an assert in TreeTransform<Derived>::TransformObjCObjectType.

assert(TL.hasBaseTypeAsWritten() && "Can't be dependent");

I'm not sure what hasBaseTypeAsWritten is used for. But it seemed to me that it doesn't necessarily indicate whether the type is a dependent type, so I've removed the assert.

Diff Detail

Repository
rL LLVM

Event Timeline

ahatanak updated this revision to Diff 48247.Feb 17 2016, 3:28 PM
ahatanak retitled this revision from to [Sema] Remove assert in TreeTransform<Derived>::TransformObjCObjectType.
ahatanak updated this object.
ahatanak added a reviewer: doug.gregor.
ahatanak added a subscriber: cfe-commits.

Note that the test case currently asserts. The patch that is currently under review in http://reviews.llvm.org/D16843 has to be applied first.

Is this OK to commit?

I've committed the patch to fix the TypeLocBuilder bug in r261260.

doug.gregor accepted this revision.Feb 24 2016, 10:13 PM
doug.gregor edited edge metadata.

LGTM, sorry for the delay.

This revision is now accepted and ready to land.Feb 24 2016, 10:13 PM

Thanks, I'll commit this shortly.

This revision was automatically updated to reflect the committed changes.