On Fri, Jun 6, 2014 at 8:01 AM, Aaron Ballman <[email protected]> wrote: > Author: aaronballman > Date: Fri Jun 6 10:01:47 2014 > New Revision: 210338 > > URL: http://llvm.org/viewvc/llvm-project?rev=210338&view=rev > Log: > Replacing r210333 with an improved solution; we should never reach this code > with any other loop hint options. > > Modified: > cfe/trunk/lib/Sema/SemaStmtAttr.cpp > > Modified: cfe/trunk/lib/Sema/SemaStmtAttr.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAttr.cpp?rev=210338&r1=210337&r2=210338&view=diff > ============================================================================== > --- cfe/trunk/lib/Sema/SemaStmtAttr.cpp (original) > +++ cfe/trunk/lib/Sema/SemaStmtAttr.cpp Fri Jun 6 10:01:47 2014 > @@ -69,7 +69,7 @@ static Attr *handleLoopHintAttr(Sema &S, > .Case("interleave_count", LoopHintAttr::InterleaveCount) > .Default(LoopHintAttr::Vectorize); > > - int ValueInt = 0; > + int ValueInt; > if (Option == LoopHintAttr::Vectorize || Option == > LoopHintAttr::Interleave) { > if (!ValueInfo) { > S.Diag(ValueLoc->Loc, diag::err_pragma_loop_invalid_keyword) > @@ -102,7 +102,8 @@ static Attr *handleLoopHintAttr(Sema &S, > << /*MissingValue=*/false << ValueInt; > return nullptr; > } > - } > + } else > + llvm_unreachable("Unknown loop hint option");
Alternatively you could just make the previous "else if" an "else" and assert the condition inside it? Not a big deal either way, though - Clang should compile it to basically the same thing (a check at -O0, optimized away above that) > > return LoopHintAttr::CreateImplicit(S.Context, Option, ValueInt, > A.getRange()); > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
