diff --git a/lib/Interpreter/DeclUnloader.cpp b/lib/Interpreter/DeclUnloader.cpp index 2d2360d6..1b33bbc6 100644 --- a/lib/Interpreter/DeclUnloader.cpp +++ b/lib/Interpreter/DeclUnloader.cpp @@ -557,8 +557,8 @@ bool DeclUnloader::VisitRedeclarable(clang::Redeclarable* R, DeclContext* DC) // We start with the decl context first, because parameters are part of the // DeclContext and when trying to remove them we need the full redecl chain // still in place. - bool Successful = VisitDeclContext(FD); - Successful &= VisitRedeclarable(FD, FD->getDeclContext()); + bool Successful = VisitRedeclarable(FD, FD->getDeclContext()); + Successful &= VisitDeclContext(FD); Successful &= VisitDeclaratorDecl(FD); // Template instantiation of templated function first creates a canonical @@ -711,8 +711,8 @@ bool DeclUnloader::VisitRedeclarable(clang::Redeclarable* R, DeclContext* DC) bool DeclUnloader::VisitNamespaceDecl(NamespaceDecl* NSD) { // NamespaceDecl: NamedDecl, DeclContext, Redeclarable - bool Successful = VisitDeclContext(NSD); - Successful &= VisitRedeclarable(NSD, NSD->getDeclContext()); + bool Successful = VisitRedeclarable(NSD, NSD->getDeclContext()); + Successful &= VisitDeclContext(NSD); Successful &= VisitNamedDecl(NSD); return Successful; @@ -809,8 +809,8 @@ bool DeclUnloader::VisitRedeclarable(clang::Redeclarable* R, DeclContext* DC) bool DeclUnloader::VisitTagDecl(TagDecl* TD) { // TagDecl: TypeDecl, DeclContext, Redeclarable - bool Successful = VisitDeclContext(TD); - Successful &= VisitRedeclarable(TD, TD->getDeclContext()); + bool Successful = VisitRedeclarable(TD, TD->getDeclContext()); + Successful &= VisitDeclContext(TD); Successful &= VisitTypeDecl(TD); return Successful; } diff --git a/test/CodeUnloading/Friend.C b/test/CodeUnloading/Friend.C index f534be5b..c8d38b31 100644 --- a/test/CodeUnloading/Friend.C +++ b/test/CodeUnloading/Friend.C @@ -22,6 +22,12 @@ void bestFriend(); .compareState "NF" //CHECK-NOT: Differences +#include "FriendRecursive.h" +.undo +.compareState "NF" +//CHECK-NOT: Differences + + // STL has many of these in memory & stdexcept //#include //.undo diff --git a/test/CodeUnloading/FriendRecursive.h b/test/CodeUnloading/FriendRecursive.h new file mode 100644 index 00000000..18e63ec7 --- /dev/null +++ b/test/CodeUnloading/FriendRecursive.h @@ -0,0 +1,9 @@ +class TestA { + friend class TestB; + void empty() {} +}; + +class TestB { + friend class TestA; + void empty() {} +};