================ @@ -5052,6 +5052,21 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, Function->setInnerLocStart(PatternDecl->getInnerLocStart()); Function->setRangeEnd(PatternDecl->getEndLoc()); + // Propagate '__restrict' properly. + if (auto MD = dyn_cast<CXXMethodDecl>(Function)) { + bool Restrict = cast<CXXMethodDecl>(PatternDecl)->isEffectivelyRestrict(); + if (Restrict != MD->getMethodQualifiers().hasRestrict()) { + const auto *FPT = MD->getType()->getAs<FunctionProtoType>(); + FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); + if (Restrict) + EPI.TypeQuals.addRestrict(); + else + EPI.TypeQuals.removeRestrict(); + MD->setType(Context.getFunctionType(FPT->getReturnType(), + FPT->getParamTypes(), EPI)); + } + } + ---------------- Sirraide wrote:
If there is a better place to put this, please let me know. This *works*, but I at least feel like we should be doing this somewhere earlier... https://github.com/llvm/llvm-project/pull/83855 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits