diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 8a28b29a1cab..0c2d9e3e7a07 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -2756,10 +2756,10 @@ bool LocalTypedefNameReferencer::VisitRecordType(const RecordType *RT) { } TypeLoc Sema::getReturnTypeLoc(FunctionDecl *FD) const { - TypeLoc TL = FD->getTypeSourceInfo()->getTypeLoc(); + TypeLoc TL = FD->getTypeSourceInfo()->getTypeLoc().IgnoreParens(); while (auto ATL = TL.getAs()) TL = ATL.getModifiedLoc().IgnoreParens(); - return TL.IgnoreParens().castAs().getReturnLoc(); + return TL.castAs().getReturnLoc(); } /// Deduce the return type for a function from a returned expression, per