[PATCH] D4784: [clang-tidy] Add check for possibly incomplete switch statements

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 16 12:21:21 PDT 2023


PiotrZSL added a comment.

Tests need to be reverted, and template handling corrected (check comments).
After that it looks good to me.



================
Comment at: clang-tools-extra/clang-tidy/bugprone/SwitchMissingDefaultCaseCheck.cpp:29
+  Finder->addMatcher(
+      switchStmt(hasCondition(expr(hasType(qualType(
+                     hasCanonicalType(unless(hasDeclaration(enumDecl()))))))),
----------------



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/switch-missing-default-case.cpp:1
+// RUN: %check_clang_tidy %s bugprone-switch-missing-default-case -- %t
+
----------------



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/switch-missing-default-case.cpp:19
+    int I1 = 0;
+    testTemplate(I1);
+
----------------
wrong, do not change everything to use only testTemplates, leave previous one, template should be additional test, this is why test fail. Previous tests were fine, just some additional should be added.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D4784/new/

https://reviews.llvm.org/D4784



More information about the cfe-commits mailing list