[PATCH] D133262: [clang] Fixes how we represent / emulate builtin templates

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 7 12:52:07 PDT 2022


mizvekov added inline comments.


================
Comment at: clang/lib/AST/DeclTemplate.cpp:262
+  }
+  default:;
+  };
----------------
erichkeane wrote:
> The semicolon after default is bizarre/unnecessary.  That said, I'd suggest just making the 'default' case be 'return false'.
This is just a workaround for some versions of GCC and/or MSVC which warn on control flow reaching the end of the function, even in cases such as a switch which returns in all paths.
Also we prefer to emit a warning on unhandled cases when omitting the default case.

So this is a compact way of avoiding those issues without having to add a `llvm_unreachable("control flow should never get here");` at the end.

Have we gotten rid of the old versions of those toolchains which had this problem?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133262



More information about the cfe-commits mailing list