summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2013-07-09 01:38:07 +0000
committerEli Friedman <eli.friedman@gmail.com>2013-07-09 01:38:07 +0000
commit999af7bf6e933700ee7e06d047490e050d283cea (patch)
tree6f57b6e8083970af49ed7ce9fa1f59659a4c9fed /clang/lib
parent701a3523bad654ce274345452c48ca977662b031 (diff)
downloadbcm5719-llvm-999af7bf6e933700ee7e06d047490e050d283cea.tar.gz
bcm5719-llvm-999af7bf6e933700ee7e06d047490e050d283cea.zip
Fix recovery for missing * in objc property.
<rdar://problem/14354144> llvm-svn: 185897
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaObjCProperty.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index ff5f7a58927..803bd7de881 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -529,8 +529,16 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,
if (IDecl->ClassImplementsProtocol(PNSCopying, true))
Diag(AtLoc, diag::warn_implements_nscopying) << PropertyId;
}
- if (T->isObjCObjectType())
- Diag(FD.D.getIdentifierLoc(), diag::err_statically_allocated_object);
+
+ if (T->isObjCObjectType()) {
+ SourceLocation StarLoc = TInfo->getTypeLoc().getLocEnd();
+ StarLoc = PP.getLocForEndOfToken(StarLoc);
+ Diag(FD.D.getIdentifierLoc(), diag::err_statically_allocated_object)
+ << FixItHint::CreateInsertion(StarLoc, "*");
+ T = Context.getObjCObjectPointerType(T);
+ SourceLocation TLoc = TInfo->getTypeLoc().getLocStart();
+ TInfo = Context.getTrivialTypeSourceInfo(T, TLoc);
+ }
DeclContext *DC = cast<DeclContext>(CDecl);
ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC,
OpenPOWER on IntegriCloud