r261829 - [Sema] Remove assert in TreeTransform<Derived>::TransformObjCObjectType.
Akira Hatanaka via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 24 23:08:33 PST 2016
Author: ahatanak
Date: Thu Feb 25 01:08:33 2016
New Revision: 261829
URL: http://llvm.org/viewvc/llvm-project?rev=261829&view=rev
Log:
[Sema] Remove assert in TreeTransform<Derived>::TransformObjCObjectType.
The assert isn't correct since TypeLoc::ObjCObjectTypeLoc doesn't
indicate whether the type is a dependent type. The function returns
false for a type like "<SomeProtocol>" which is a synonym for
"id<SomeProtocol>".
rdar://problem/23838912
Differential Revision: http://reviews.llvm.org/D17355
Added:
cfe/trunk/test/SemaObjCXX/base-type-as-written.mm
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=261829&r1=261828&r2=261829&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Thu Feb 25 01:08:33 2016
@@ -5932,7 +5932,6 @@ TreeTransform<Derived>::TransformObjCObj
}
ObjCObjectTypeLoc NewT = TLB.push<ObjCObjectTypeLoc>(Result);
- assert(TL.hasBaseTypeAsWritten() && "Can't be dependent");
NewT.setHasBaseTypeAsWritten(true);
NewT.setTypeArgsLAngleLoc(TL.getTypeArgsLAngleLoc());
for (unsigned i = 0, n = TL.getNumTypeArgs(); i != n; ++i)
Added: cfe/trunk/test/SemaObjCXX/base-type-as-written.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/base-type-as-written.mm?rev=261829&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjCXX/base-type-as-written.mm (added)
+++ cfe/trunk/test/SemaObjCXX/base-type-as-written.mm Thu Feb 25 01:08:33 2016
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// Make sure we don't crash in TreeTransform<Derived>::TransformObjCObjectType.
+
+ at protocol P1
+ at end
+
+template <class T1><P1> foo1(T1) { // expected-warning {{protocol has no object type specified; defaults to qualified 'id'}}
+ foo1(0);
+}
More information about the cfe-commits
mailing list