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 | 1168491f34093ed5a1d571449675ddc29d832206 (patch) | |
tree | d47e77223e80fb4fd363902299074e4351452f1b /lib/Index | |
parent | 96cb1f83062da466e605acdc276673a5959c1579 (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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345882 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Index')
-rw-r--r-- | lib/Index/CommentToXML.cpp | 1 | ||||
-rw-r--r-- | lib/Index/USRGeneration.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/Index/CommentToXML.cpp b/lib/Index/CommentToXML.cpp index 918068a240..a2659119a2 100644 --- a/lib/Index/CommentToXML.cpp +++ b/lib/Index/CommentToXML.cpp @@ -720,6 +720,7 @@ void CommentASTToXMLConverter::visitBlockCommandComment( case CommandTraits::KCI_version: case CommandTraits::KCI_warning: ParagraphKind = C->getCommandName(Traits); + break; default: break; } diff --git a/lib/Index/USRGeneration.cpp b/lib/Index/USRGeneration.cpp index f7be0a90b0..ae1fa1fbc8 100644 --- a/lib/Index/USRGeneration.cpp +++ b/lib/Index/USRGeneration.cpp @@ -942,7 +942,7 @@ void USRGenerator::VisitTemplateArgument(const TemplateArgument &Arg) { case TemplateArgument::TemplateExpansion: Out << 'P'; // pack expansion of... - // Fall through + LLVM_FALLTHROUGH; case TemplateArgument::Template: VisitTemplateName(Arg.getAsTemplateOrTemplatePattern()); break; |