This is an archive of the discontinued LLVM Phabricator instance.

Replace assert(0) with llvm_unreachable.
AcceptedPublic

Authored by v.g.vassilev on Jun 30 2017, 9:17 AM.

Details

Reviewers
rsmith

Diff Detail

Repository
rL LLVM

Event Timeline

v.g.vassilev created this revision.Jun 30 2017, 9:17 AM
rsmith accepted this revision.Jun 30 2017, 3:25 PM

LGTM, post-commit review is fine for changes like this.

This revision is now accepted and ready to land.Jun 30 2017, 3:25 PM

Ok, thanks! I was hesitant for the changes in libclang, because of the return statements.

You should remove the code after the assert(0), or you'll trigger "unreachable code" warnings.

Sure, I can do this, as long as this semantic change is ok.

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)

include/clang/AST/Redeclarable.h
257–261

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