diff options
| author | 2018-04-06 14:26:03 +0000 | |
|---|---|---|
| committer | 2018-04-06 14:26:03 +0000 | |
| commit | bdabc2f19ffb9e20600dad6e8a300842a7bda50e (patch) | |
| tree | c50e7b2e5449b074651bb82a58517a8ebc4a8cf7 /gnu/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp | |
| parent | Print a 'p' flag for file descriptors that were opened after pledge(2). (diff) | |
| download | wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.tar.xz wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.zip | |
Import LLVM 6.0.1 release including clang, lld and lldb.
"where is the kaboom?" deraadt@
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gnu/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp b/gnu/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp index bfb0071a54f..ea5b1da46f3 100644 --- a/gnu/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp +++ b/gnu/llvm/tools/clang/lib/Sema/SemaObjCProperty.cpp @@ -1290,6 +1290,14 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, // An abstract type is as bad as an incomplete type. CompleteTypeErr = true; } + if (!CompleteTypeErr) { + const RecordType *RecordTy = PropertyIvarType->getAs<RecordType>(); + if (RecordTy && RecordTy->getDecl()->hasFlexibleArrayMember()) { + Diag(PropertyIvarLoc, diag::err_synthesize_variable_sized_ivar) + << PropertyIvarType; + CompleteTypeErr = true; // suppress later diagnostics about the ivar + } + } if (CompleteTypeErr) Ivar->setInvalidDecl(); ClassImpDecl->addDecl(Ivar); @@ -1599,7 +1607,11 @@ Sema::DiagnosePropertyMismatch(ObjCPropertyDecl *Property, // meaningless for readonly properties, so don't diagnose if the // atomic property is 'readonly'. checkAtomicPropertyMismatch(*this, SuperProperty, Property, false); - if (Property->getSetterName() != SuperProperty->getSetterName()) { + // Readonly properties from protocols can be implemented as "readwrite" + // with a custom setter name. + if (Property->getSetterName() != SuperProperty->getSetterName() && + !(SuperProperty->isReadOnly() && + isa<ObjCProtocolDecl>(SuperProperty->getDeclContext()))) { Diag(Property->getLocation(), diag::warn_property_attribute) << Property->getDeclName() << "setter" << inheritedName; Diag(SuperProperty->getLocation(), diag::note_property_declare); @@ -1895,7 +1907,7 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, /* property = */ Prop->getIdentifier(), /* ivar = */ Prop->getDefaultSynthIvarName(Context), Prop->getLocation(), Prop->getQueryKind())); - if (PIDecl) { + if (PIDecl && !Prop->isUnavailable()) { Diag(Prop->getLocation(), diag::warn_missing_explicit_synthesis); Diag(IMPDecl->getLocation(), diag::note_while_in_implementation); } |
