summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-05-27 05:07:37 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-05-27 05:07:37 +0000
commitaee9e54dcad765d9085604c4eca40797e95c0124 (patch)
treedd7e0cdd262f341509eb8e81283009460247164a /clang/lib/Sema/SemaDecl.cpp
parent078c963a310048f84d1d74d7ed09fd610238d87a (diff)
downloadbcm5719-llvm-aee9e54dcad765d9085604c4eca40797e95c0124.tar.gz
bcm5719-llvm-aee9e54dcad765d9085604c4eca40797e95c0124.zip
Don't swap function decls, and add them to the scope as they are
encountered. Mixing up the decls is unintuitive, and confuses the AST destruction code. Fixes PR2360. Note that there is a need to look up the characteristics and declarations of a function associated with a particular name or decl, but the original swapping code doesn't solve it properly. http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-May/001644.html is one suggestion for how to fix that. llvm-svn: 51584
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 8b89045a717..2856403ccf9 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -910,13 +910,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
NewFD = MergeFunctionDecl(NewFD, PrevDecl, Redeclaration);
if (NewFD == 0) return 0;
if (Redeclaration) {
- // Note that the new declaration is a redeclaration of the
- // older declaration. Then return the older declaration: the
- // new one is only kept within the set of previous
- // declarations for this function.
- FunctionDecl *OldFD = (FunctionDecl *)PrevDecl;
- OldFD->AddRedeclaration(NewFD);
- return OldFD;
+ NewFD->setPreviousDeclaration(cast<FunctionDecl>(PrevDecl));
}
}
New = NewFD;
OpenPOWER on IntegriCloud