Skip to content

Commit e5e6004

Browse files
committed
Don't set HasPotentialFeatureAvailabilityViolations in ActOnLabelStmt
Set it in ActOnObjCAvailabilityCheckExpr instead. Without this change, DiagnoseUnguardedFeatureAvailability scans the whole function when there is a label in it even when there are no Decls annotated with feature availability that are referenced in the function and there are no ObjCAvailabilityCheckExprs. rdar://146139827
1 parent b03fbba commit e5e6004

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

clang/lib/Sema/SemaExprObjC.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5154,6 +5154,8 @@ ExprResult SemaObjC::ActOnObjCAvailabilityCheckExpr(
51545154
ASTContext &Context = getASTContext();
51555155

51565156
if (AvailSpecs.front().isDomainName()) {
5157+
if (FunctionScopeInfo *Info = SemaRef.getCurFunctionAvailabilityContext())
5158+
Info->HasPotentialFeatureAvailabilityViolations = true;
51575159
auto Spec = AvailSpecs.front();
51585160
return ObjCAvailabilityCheckExpr::CreateAvailabilityFeatureCheck(
51595161
AtLoc, RParen, Context.BoolTy, Spec.getDomainName(), Context);

clang/lib/Sema/SemaStmt.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,6 @@ Sema::ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl,
602602
}
603603
}
604604

605-
if (FunctionScopeInfo *Info = getCurFunctionAvailabilityContext())
606-
Info->HasPotentialFeatureAvailabilityViolations = true;
607-
608605
return LS;
609606
}
610607

0 commit comments

Comments
 (0)