From 650c6056cc3d3fb569cdd34d6c527ee15e05dc8a Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 31 Jul 2013 18:39:08 +0000 Subject: [PATCH] ObjectiveC arc: minor refactoring in my last patch to avoid future false positives. // rdar://14569171 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187509 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaExpr.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 2fbda8e052..b321ad1172 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -4061,10 +4061,14 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, Param = FDecl->getParamDecl(i); // Strip the unbridged-cast placeholder expression off, if applicable. + bool CFAudited = false; if (Arg->getType() == Context.ARCUnbridgedCastTy && FDecl && FDecl->hasAttr() && (!Param || !Param->hasAttr())) Arg = stripARCUnbridgedCast(Arg); + else if (FDecl && FDecl->hasAttr() && + (!Param || !Param->hasAttr())) + CFAudited = true; InitializedEntity Entity = Param ? InitializedEntity::InitializeParameter(Context, Param, ProtoArgType) @@ -4072,8 +4076,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, Proto->isArgConsumed(i)); // Remember that parameter belongs to a CF audited API. - if (FDecl && FDecl->hasAttr() && - (!Param || !Param->hasAttr())) + if (CFAudited) Entity.setParameterCFAudited(); ExprResult ArgE = PerformCopyInitialization(Entity, -- 2.40.0