diff options
author | Reid Kleckner <rnk@google.com> | 2018-11-01 19:54:45 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-11-01 19:54:45 +0000 |
commit | 2bf1f271bb33b9b798ff82df7e78c21d36dfb6f8 (patch) | |
tree | 8ec92e48ce1c250d759721a017ccf78a7acaa79f /polly | |
parent | ed5382d9bed77bd07b3fd07e7dff5d48ef5555c1 (diff) |
Fix clang -Wimplicit-fallthrough warnings across llvm, NFC
This patch should not introduce any behavior changes. It consists of
mostly one of two changes:
1. Replacing fall through comments with the LLVM_FALLTHROUGH macro
2. Inserting 'break' before falling through into a case block consisting
of only 'break'.
We were already using this warning with GCC, but its warning behaves
slightly differently. In this patch, the following differences are
relevant:
1. GCC recognizes comments that say "fall through" as annotations, clang
doesn't
2. GCC doesn't warn on "case N: foo(); default: break;", clang does
3. GCC doesn't warn when the case contains a switch, but falls through
the outer case.
I will enable the warning separately in a follow-up patch so that it can
be cleanly reverted if necessary.
Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu
Differential Revision: https://reviews.llvm.org/D53950
Diffstat (limited to 'polly')
-rw-r--r-- | polly/lib/Analysis/ScopBuilder.cpp | 6 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp index fe55c596058..7d1e781ab34 100644 --- a/polly/lib/Analysis/ScopBuilder.cpp +++ b/polly/lib/Analysis/ScopBuilder.cpp @@ -579,7 +579,7 @@ bool ScopBuilder::buildAccessCallInst(MemAccInst Inst, ScopStmt *Stmt) { return true; case FMRB_OnlyReadsArgumentPointees: ReadOnly = true; - // Fall through + LLVM_FALLTHROUGH; case FMRB_OnlyAccessesArgumentPointees: { auto AccType = ReadOnly ? MemoryAccess::READ : MemoryAccess::MAY_WRITE; Loop *L = LI.getLoopFor(Inst->getParent()); @@ -1216,7 +1216,7 @@ static MemoryAccess::ReductionType getReductionType(const BinaryOperator *BinOp, case Instruction::FAdd: if (!BinOp->isFast()) return MemoryAccess::RT_NONE; - // Fall through + LLVM_FALLTHROUGH; case Instruction::Add: return MemoryAccess::RT_ADD; case Instruction::Or: @@ -1228,7 +1228,7 @@ static MemoryAccess::ReductionType getReductionType(const BinaryOperator *BinOp, case Instruction::FMul: if (!BinOp->isFast()) return MemoryAccess::RT_NONE; - // Fall through + LLVM_FALLTHROUGH; case Instruction::Mul: if (DisableMultiplicativeReductions) return MemoryAccess::RT_NONE; diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 9502f324fc9..23b714dc098 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -779,7 +779,7 @@ bool ScopDetection::isValidIntrinsicInst(IntrinsicInst &II, if (!isValidAccess(&II, AF, BP, Context)) return false; } - // Fall through + LLVM_FALLTHROUGH; case Intrinsic::memset: AF = SE.getSCEVAtScope(cast<MemIntrinsic>(II).getDest(), L); if (!AF->isZero()) { |