diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-12-17 00:49:09 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-12-17 00:49:09 +0000 |
commit | 6dd30fc45af6bdee05a735d9817b6d9c72cdce35 (patch) | |
tree | 4bc8bca8bbf8109c8ad6e906886d5458bade2678 /lib/Sema/SemaDeclObjC.cpp | |
parent | e6ec205d6d0f4aec27bf49ca1e8fbb139acc2f2b (diff) |
Diagnose duplicate declaration of a property. Fixes
PR5809
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index ea7d9a9385..beadb588f3 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -2032,7 +2032,14 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC, FD.D.getIdentifierLoc(), FD.D.getIdentifier(), T); - DC->addDecl(PDecl); + DeclContext::lookup_result Found = DC->lookup(PDecl->getDeclName()); + if (Found.first != Found.second && isa<ObjCPropertyDecl>(*Found.first)) { + Diag(PDecl->getLocation(), diag::err_duplicate_property); + Diag((*Found.first)->getLocation(), diag::note_property_declare); + PDecl->setInvalidDecl(); + } + else + DC->addDecl(PDecl); if (T->isArrayType() || T->isFunctionType()) { Diag(AtLoc, diag::err_property_type) << T; |