[cfe-commits] r108707 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaObjC/synth-provisional-ivars.m
Fariborz Jahanian
fjahanian at apple.com
Mon Jul 19 09:14:33 PDT 2010
Author: fjahanian
Date: Mon Jul 19 11:14:33 2010
New Revision: 108707
URL: http://llvm.org/viewvc/llvm-project?rev=108707&view=rev
Log:
Categories cannot synthesize property ivars,
and a minor cleanup.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaObjC/synth-provisional-ivars.m
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=108707&r1=108706&r2=108707&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Jul 19 11:14:33 2010
@@ -1006,7 +1006,6 @@
}
static ObjCIvarDecl *SynthesizeProvisionalIvar(Sema &SemaRef,
- ASTContext &Context,
IdentifierInfo *II,
SourceLocation NameLoc) {
ObjCMethodDecl *CurMeth = SemaRef.getCurMethodDecl();
@@ -1014,7 +1013,8 @@
if (!IDecl)
return 0;
ObjCImplementationDecl *ClassImpDecl = IDecl->getImplementation();
- assert(ClassImpDecl && "Method not inside @implementation");
+ if (!ClassImpDecl)
+ return 0;
bool DynamicImplSeen = false;
ObjCPropertyDecl *property = SemaRef.LookupPropertyDecl(IDecl, II);
if (!property)
@@ -1023,8 +1023,8 @@
DynamicImplSeen =
(PIDecl->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic);
if (!DynamicImplSeen) {
- QualType PropType = Context.getCanonicalType(property->getType());
- ObjCIvarDecl *Ivar = ObjCIvarDecl::Create(Context, ClassImpDecl,
+ QualType PropType = SemaRef.Context.getCanonicalType(property->getType());
+ ObjCIvarDecl *Ivar = ObjCIvarDecl::Create(SemaRef.Context, ClassImpDecl,
NameLoc,
II, PropType, /*Dinfo=*/0,
ObjCIvarDecl::Protected,
@@ -1104,7 +1104,7 @@
if (Ex) return Owned(Ex);
// Synthesize ivars lazily
if (getLangOptions().ObjCNonFragileABI2) {
- if (SynthesizeProvisionalIvar(*this, Context, II, NameLoc))
+ if (SynthesizeProvisionalIvar(*this, II, NameLoc))
return ActOnIdExpression(S, SS, Id, HasTrailingLParen,
isAddressOfOperand);
}
Modified: cfe/trunk/test/SemaObjC/synth-provisional-ivars.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/synth-provisional-ivars.m?rev=108707&r1=108706&r2=108707&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/synth-provisional-ivars.m (original)
+++ cfe/trunk/test/SemaObjC/synth-provisional-ivars.m Mon Jul 19 11:14:33 2010
@@ -38,3 +38,8 @@
- (int) Meth6 { return bar1; }
@end
+
+ at implementation I(CAT)
+- (int) Meth { return PROP1; } // expected-error {{use of undeclared identifier 'PROP1'}}
+ at end
+
More information about the cfe-commits
mailing list