@@ -689,28 +689,13 @@ static Attr *handleLoopUnrollHint(Sema &S, Stmt *St, const ParsedAttr &A,
689
689
// determines unrolling factor) or 1 argument (the unroll factor provided
690
690
// by the user).
691
691
692
- if (!isa<ForStmt, CXXForRangeStmt, DoStmt, WhileStmt>(St)) {
693
- S.Diag (A.getLoc (), diag::err_attribute_wrong_decl_type_str)
694
- << A << " 'for', 'while', and 'do' statements" ;
695
- return nullptr ;
696
- }
697
-
698
692
Expr *E = A.getNumArgs () ? A.getArgAsExpr (0 ) : nullptr ;
699
693
if (A.getParsedKind () == ParsedAttr::AT_OpenCLUnrollHint)
700
694
return S.BuildOpenCLLoopUnrollHintAttr (A, E);
701
- else if (A.getParsedKind () == ParsedAttr::AT_LoopUnrollHint) {
702
- // FIXME: this should be hoisted up to the top level, but can't be placed
703
- // there until the opencl attribute has its parsing error converted into a
704
- // semantic error. See: Parser::ParseOpenCLUnrollHintAttribute().
705
- if (!isa<ForStmt, CXXForRangeStmt, DoStmt, WhileStmt>(St)) {
706
- S.Diag (A.getLoc (), diag::err_attribute_wrong_decl_type_str)
707
- << A << " 'for', 'while', and 'do' statements" ;
708
- return nullptr ;
709
- }
695
+ if (A.getParsedKind () == ParsedAttr::AT_LoopUnrollHint)
710
696
return S.BuildLoopUnrollHintAttr (A, E);
711
- }
712
697
713
- return nullptr ;
698
+ llvm_unreachable ( " Unknown loop unroll hint " ) ;
714
699
}
715
700
716
701
static Attr *ProcessStmtAttribute (Sema &S, Stmt *St, const ParsedAttr &A,
0 commit comments