[PATCH] D25321: Fix PR13910: Don't warn that __builtin_unreachable() is unreachable

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 09:50:06 PDT 2016


aprantl added inline comments.


> ReachableCode.cpp:64
> +    const FunctionDecl *FDecl = dyn_cast<FunctionDecl>(DRE->getDecl());
> +    return FDecl && FDecl->getIdentifier() &&
> +           FDecl->getBuiltinID() == Builtin::BI__builtin_unreachable;

Maybe also wrap the inner dyn_cast in an if for symmetry?

  static bool isBuiltinUnreachable(const Stmt *S) {
    if (const auto *DRE = dyn_cast<DeclRefExpr>(S))
      if (const auto *FDecl = dyn_cast<FunctionDecl>(DRE->getDecl()))
        return FDecl->getIdentifier() &&
               FDecl->getBuiltinID() == Builtin::BI__builtin_unreachable;
    return false;
  }

Repository:
  rL LLVM

https://reviews.llvm.org/D25321





More information about the cfe-commits mailing list