summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-14 04:52:29 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-14 04:52:29 +0000
commit846e61a3636fe8f22f86fcab92bc19f8234ed421 (patch)
tree9ded872d8a98b89a1c89ca7f08a26b8f1ad2f428 /clang/lib
parent09c1b3d8585337c75d0a84176d0ab6f4c26a64e0 (diff)
downloadbcm5719-llvm-846e61a3636fe8f22f86fcab92bc19f8234ed421.tar.gz
bcm5719-llvm-846e61a3636fe8f22f86fcab92bc19f8234ed421.zip
[PCH] Do not crash if a class extension in a chained PCH introduces/redeclares a property.
llvm-svn: 144520
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaObjCProperty.cpp5
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp14
2 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index 4933f001c4e..90d2d934315 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -17,6 +17,7 @@
#include "clang/AST/DeclObjC.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/ExprCXX.h"
+#include "clang/AST/ASTMutationListener.h"
#include "llvm/ADT/DenseSet.h"
using namespace clang;
@@ -271,6 +272,8 @@ Sema::HandlePropertyInClassExtension(Scope *S,
// Make sure setter/getters are declared here.
ProcessPropertyDecl(PDecl, CCPrimary, /* redeclaredProperty = */ 0,
/* lexicalDC = */ CDecl);
+ if (ASTMutationListener *L = Context.getASTMutationListener())
+ L->AddedObjCPropertyInClassExtension(PDecl, /*OrigProp=*/0, CDecl);
return PDecl;
}
if (PIDecl->getType().getCanonicalType()
@@ -343,6 +346,8 @@ Sema::HandlePropertyInClassExtension(Scope *S,
*isOverridingProperty = true;
// Make sure setter decl is synthesized, and added to primary class's list.
ProcessPropertyDecl(PIDecl, CCPrimary, PDecl, CDecl);
+ if (ASTMutationListener *L = Context.getASTMutationListener())
+ L->AddedObjCPropertyInClassExtension(PDecl, PIDecl, CDecl);
return 0;
}
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 8f79fa4c492..4fa3cf87564 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -4130,6 +4130,20 @@ void ASTWriter::CompletedObjCForwardRef(const ObjCContainerDecl *D) {
RewriteDecl(D);
}
+void ASTWriter::AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop,
+ const ObjCPropertyDecl *OrigProp,
+ const ObjCCategoryDecl *ClassExt) {
+ const ObjCInterfaceDecl *D = ClassExt->getClassInterface();
+ if (!D)
+ return;
+
+ assert(!WritingAST && "Already writing the AST!");
+ if (!D->isFromASTFile())
+ return; // Declaration not imported from PCH.
+
+ RewriteDecl(D);
+}
+
void ASTWriter::UpdatedAttributeList(const Decl *D) {
assert(!WritingAST && "Already writing the AST!");
if (!D->isFromASTFile())
OpenPOWER on IntegriCloud