[clang] [ASTImporter] Fix infinite recurse on return type declared inside body (#68775) (PR #89096)
Ding Fei via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 18 18:54:17 PDT 2024
================
@@ -3647,15 +3647,28 @@ class IsTypeDeclaredInsideVisitor
};
} // namespace
-/// This function checks if the function has 'auto' return type that contains
+/// This function checks if the given function has a return type that contains
/// a reference (in any way) to a declaration inside the same function.
-bool ASTNodeImporter::hasAutoReturnTypeDeclaredInside(FunctionDecl *D) {
+bool ASTNodeImporter::hasReturnTypeDeclaredInside(FunctionDecl *D) {
QualType FromTy = D->getType();
const auto *FromFPT = FromTy->getAs<FunctionProtoType>();
assert(FromFPT && "Must be called on FunctionProtoType");
+ auto IsCXX11LambdaWithouTrailingReturn = [&]() {
+ if (!Importer.FromContext.getLangOpts().CPlusPlus11)
----------------
danix800 wrote:
These `CPlusPlus` / `CPlusPlus11` / `CPlusPlus14` options are really misleading if no comments explaining how they works. Thanks for pointing this out!
https://github.com/llvm/llvm-project/pull/89096
More information about the cfe-commits
mailing list