/// Apply the annotation of {@code pd} in function {@code FD}
/// to the resulting summary stored in out-parameter {@code Template}.
/// \return whether an annotation was applied.
- bool applyFunctionParamAnnotationEffect(const ParmVarDecl *pd,
- unsigned parm_idx,
- const FunctionDecl *FD,
- RetainSummaryTemplate &Template);
+ bool applyParamAnnotationEffect(const ParmVarDecl *pd, unsigned parm_idx,
+ const NamedDecl *FD,
+ RetainSummaryTemplate &Template);
public:
RetainSummaryManager(ASTContext &ctx,
return None;
}
-bool RetainSummaryManager::applyFunctionParamAnnotationEffect(
- const ParmVarDecl *pd, unsigned parm_idx, const FunctionDecl *FD,
+bool RetainSummaryManager::applyParamAnnotationEffect(
+ const ParmVarDecl *pd, unsigned parm_idx, const NamedDecl *FD,
RetainSummaryTemplate &Template) {
QualType QT = pd->getType();
if (auto K =
if (const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
for (const auto *OD : MD->overridden_methods()) {
const ParmVarDecl *OP = OD->parameters()[parm_idx];
- if (applyFunctionParamAnnotationEffect(OP, parm_idx, OD, Template))
+ if (applyParamAnnotationEffect(OP, parm_idx, OD, Template))
return true;
}
}
// Effects on the parameters.
unsigned parm_idx = 0;
for (auto pi = FD->param_begin(),
- pe = FD->param_end(); pi != pe; ++pi, ++parm_idx) {
- const ParmVarDecl *pd = *pi;
- applyFunctionParamAnnotationEffect(pd, parm_idx, FD, Template);
- }
+ pe = FD->param_end(); pi != pe; ++pi, ++parm_idx)
+ applyParamAnnotationEffect(*pi, parm_idx, FD, Template);
QualType RetTy = FD->getReturnType();
if (Optional<RetEffect> RetE = getRetEffectFromAnnotations(RetTy, FD))
// Effects on the parameters.
unsigned parm_idx = 0;
for (auto pi = MD->param_begin(), pe = MD->param_end(); pi != pe;
- ++pi, ++parm_idx) {
- const ParmVarDecl *pd = *pi;
- QualType QT = pd->getType();
- if (auto K =
- hasAnyEnabledAttrOf<NSConsumedAttr, CFConsumedAttr, OSConsumedAttr>(
- pd, QT)) {
- Template->addArg(AF, parm_idx, ArgEffect(DecRef, *K));
- } else if (auto K = hasAnyEnabledAttrOf<CFReturnsRetainedAttr>(pd, QT)) {
- Template->addArg(AF, parm_idx, ArgEffect(RetainedOutParameter, *K));
- } else if (auto K = hasAnyEnabledAttrOf<CFReturnsNotRetainedAttr>(pd, QT)) {
- Template->addArg(AF, parm_idx, ArgEffect(UnretainedOutParameter, *K));
- }
- }
+ ++pi, ++parm_idx)
+ applyParamAnnotationEffect(*pi, parm_idx, MD, Template);
+
QualType RetTy = MD->getReturnType();
if (Optional<RetEffect> RetE = getRetEffectFromAnnotations(RetTy, MD))
Template->setRetEffect(*RetE);