[PATCH] D34891: Replace assert(0) with llvm_unreachable.

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 10 09:48:07 PDT 2017


dblaikie added a comment.

If possible, please upload patches with full context - makes it easier to check around nearby code when reviewing. (the 'arc' tool for phab helps with this)



================
Comment at: include/clang/AST/Redeclarable.h:257-261
         if (PassedFirst) {
-          assert(0 && "Passed first decl twice, invalid redecl chain!");
+          llvm_unreachable("Passed first decl twice, invalid redecl chain!");
           Current = nullptr;
           return *this;
         }
----------------
Branch-to-unreachable is generally to be avoided.

Looks like this code should actually change to:

  if (Current->isFirstDecl()) {
    assert(PassedFirst);

Similar comments on many of the other changes here


Repository:
  rL LLVM

https://reviews.llvm.org/D34891





More information about the cfe-commits mailing list