summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-14 08:02:31 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-14 08:02:31 +0000
commitdcaaa21fbe2a30fc3adeb91c1a38fa36b7ab74a3 (patch)
tree4b0a9357301271d81ab016dcdb79991d83046910 /clang/lib/AST/DeclObjC.cpp
parente35b3aae52503c84756492d65c1a329690ffc78a (diff)
downloadbcm5719-llvm-dcaaa21fbe2a30fc3adeb91c1a38fa36b7ab74a3.tar.gz
bcm5719-llvm-dcaaa21fbe2a30fc3adeb91c1a38fa36b7ab74a3.zip
Really protect from infinite loop when there are objc method redeclarations.
Serialization part will come later. llvm-svn: 141950
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 7c1332ab103..170cdf43fc4 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -351,6 +351,12 @@ ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C,
HasRelatedResultType);
}
+void ObjCMethodDecl::setAsRedeclaration(const ObjCMethodDecl *PrevMethod) {
+ assert(PrevMethod);
+ getASTContext().setObjCMethodRedeclaration(PrevMethod, this);
+ IsRedeclaration = true;
+}
+
void ObjCMethodDecl::setParamsAndSelLocs(ASTContext &C,
ArrayRef<ParmVarDecl*> Params,
ArrayRef<SourceLocation> SelLocs) {
@@ -418,6 +424,12 @@ ObjCMethodDecl *ObjCMethodDecl::getNextRedeclaration() {
Redecl = CatD->getMethod(getSelector(), isInstanceMethod());
}
+ if (!Redecl && isRedeclaration()) {
+ // This is the last redeclaration, go back to the first method.
+ return cast<ObjCContainerDecl>(CtxD)->getMethod(getSelector(),
+ isInstanceMethod());
+ }
+
return Redecl ? Redecl : this;
}
OpenPOWER on IntegriCloud