@@ -744,13 +744,8 @@ namespace clang {
744744 Error ImportOverriddenMethods (CXXMethodDecl *ToMethod,
745745 CXXMethodDecl *FromMethod);
746746
747- Expected<FunctionDecl *> FindFunctionTemplateSpecialization (
748- FunctionDecl *FromFD);
749-
750- // Returns true if the given function has a placeholder return type and
751- // that type is declared inside the body of the function.
752- // E.g. auto f() { struct X{}; return X(); }
753- bool hasReturnTypeDeclaredInside (FunctionDecl *D);
747+ Expected<FunctionDecl *>
748+ FindFunctionTemplateSpecialization (FunctionDecl *FromFD);
754749 };
755750
756751template <typename InContainerTy>
@@ -3902,30 +3897,6 @@ class IsTypeDeclaredInsideVisitor
39023897};
39033898} // namespace
39043899
3905- // / This function checks if the given function has a return type that contains
3906- // / a reference (in any way) to a declaration inside the same function.
3907- bool ASTNodeImporter::hasReturnTypeDeclaredInside (FunctionDecl *D) {
3908- QualType FromTy = D->getType ();
3909- const auto *FromFPT = FromTy->getAs <FunctionProtoType>();
3910- assert (FromFPT && " Must be called on FunctionProtoType" );
3911-
3912- auto IsCXX11Lambda = [&]() {
3913- if (Importer.FromContext .getLangOpts ().CPlusPlus14 ) // C++14 or later
3914- return false ;
3915-
3916- return isLambdaMethod (D);
3917- };
3918-
3919- QualType RetT = FromFPT->getReturnType ();
3920- if (isa<AutoType>(RetT.getTypePtr ()) || IsCXX11Lambda ()) {
3921- FunctionDecl *Def = D->getDefinition ();
3922- IsTypeDeclaredInsideVisitor Visitor (Def ? Def : D);
3923- return Visitor.CheckType (RetT);
3924- }
3925-
3926- return false ;
3927- }
3928-
39293900ExplicitSpecifier
39303901ASTNodeImporter::importExplicitSpecifier (Error &Err, ExplicitSpecifier ESpec) {
39313902 Expr *ExplicitExpr = ESpec.getExpr ();
@@ -4074,9 +4045,8 @@ ExpectedDecl ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) {
40744045 // To avoid an infinite recursion when importing, create the FunctionDecl
40754046 // with a simplified return type.
40764047 // Reuse this approach for auto return types declared as typenames from
4077- // template pamams, tracked in FunctionReturnTypeCycleDetector.
4078- if (hasReturnTypeDeclaredInside (D) ||
4079- Importer.FunctionReturnTypeCycleDetector ->isCycle (D)) {
4048+ // template params, tracked in FunctionReturnTypeCycleDetector.
4049+ if (Importer.FunctionReturnTypeCycleDetector ->isCycle (D)) {
40804050 FromReturnTy = Importer.getFromContext ().VoidTy ;
40814051 UsedDifferentProtoType = true ;
40824052 }
0 commit comments