forked from OSchip/llvm-project
[SemaObjC] Fix a crash on invalid when 'auto' is used in a @property
rdar://48506879
This commit is contained in:
parent
4fb2116ee7
commit
69d2fa9ed1
|
@ -3301,6 +3301,9 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,
|
|||
D.isFunctionDeclarator())
|
||||
break;
|
||||
bool Cxx = SemaRef.getLangOpts().CPlusPlus;
|
||||
if (isa<ObjCContainerDecl>(SemaRef.CurContext)) {
|
||||
Error = 6; // Interface member.
|
||||
} else {
|
||||
switch (cast<TagDecl>(SemaRef.CurContext)->getTagKind()) {
|
||||
case TTK_Enum: llvm_unreachable("unhandled tag kind");
|
||||
case TTK_Struct: Error = Cxx ? 1 : 2; /* Struct member */ break;
|
||||
|
@ -3308,6 +3311,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,
|
|||
case TTK_Class: Error = 5; /* Class member */ break;
|
||||
case TTK_Interface: Error = 6; /* Interface member */ break;
|
||||
}
|
||||
}
|
||||
if (D.getDeclSpec().isFriendSpecified())
|
||||
Error = 20; // Friend type
|
||||
break;
|
||||
|
@ -7031,15 +7035,15 @@ static bool checkNullabilityTypeSpecifier(TypeProcessingState &state,
|
|||
// attributes, require that the type be a single-level pointer.
|
||||
if (isContextSensitive) {
|
||||
// Make sure that the pointee isn't itself a pointer type.
|
||||
const Type *pointeeType;
|
||||
const Type *pointeeType = nullptr;
|
||||
if (desugared->isArrayType())
|
||||
pointeeType = desugared->getArrayElementTypeNoTypeQual();
|
||||
else
|
||||
else if (desugared->isAnyPointerType())
|
||||
pointeeType = desugared->getPointeeType().getTypePtr();
|
||||
|
||||
if (pointeeType->isAnyPointerType() ||
|
||||
if (pointeeType && (pointeeType->isAnyPointerType() ||
|
||||
pointeeType->isObjCObjectPointerType() ||
|
||||
pointeeType->isMemberPointerType()) {
|
||||
pointeeType->isMemberPointerType())) {
|
||||
S.Diag(nullabilityLoc, diag::err_nullability_cs_multilevel)
|
||||
<< DiagNullabilityKind(nullability, true)
|
||||
<< type;
|
||||
|
|
|
@ -21,3 +21,13 @@ void foo(I *i)
|
|||
{
|
||||
i.helper; // expected-warning{{property access result unused - getters should not be used for side effects}}
|
||||
}
|
||||
|
||||
@interface J
|
||||
@property (nonnull) auto a; // expected-error {{'auto' not allowed in interface member}}
|
||||
@property auto b; // expected-error {{'auto' not allowed in interface member}}
|
||||
@property (nullable) auto c; // expected-error {{'auto' not allowed in interface member}}
|
||||
@end
|
||||
|
||||
@interface J (Cat)
|
||||
@property (nonnull) auto catprop; // expected-error {{'auto' not allowed in interface member}}
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue