More semantics checks of properties. Property implementation can implicitly use
ivar of same name.
Better diagnostics to bring home this point.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50065 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 45d8777..234bead 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -998,14 +998,13 @@
// Check that we have a valid, previously declared ivar for @synthesize
if (Synthesize) {
// @synthesize
- if (!PropertyIvar) {
- Diag(PropertyLoc, diag::error_property_ivar_decl);
- return 0;
- }
+ if (!PropertyIvar)
+ PropertyIvar = PropertyId;
// Check that this is a previously declared 'ivar' in 'IDecl' interface
ObjCIvarDecl *Ivar = IDecl->FindIvarDeclaration(PropertyIvar);
if (!Ivar) {
- Diag(PropertyLoc, diag::error_missing_property_ivar_decl);
+ Diag(PropertyLoc, diag::error_missing_property_ivar_decl,
+ PropertyId->getName());
return 0;
}
// Check that type of property and its ivar match.