[PATCH] D59529: Refactor cast<>'s in if conditionals, which can only assert on failure.

Don Hinton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 18 18:36:30 PDT 2019


hintonda created this revision.
hintonda added a reviewer: rjmccall.
Herald added a reviewer: martong.
Herald added a reviewer: shafik.
Herald added a project: clang.

This patch refactors several instances of cast<> used in if
conditionals.  Since cast<> asserts on failure, the else branch can
never be taken.

In some cases, the fix is to replace cast<> with dyn_cast<>.  While
others required the removal of the conditional and some minor
refactoring.

A discussion can be seen here: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20190318/265044.html


Repository:
  rC Clang

https://reviews.llvm.org/D59529

Files:
  lib/AST/ASTImporter.cpp
  lib/AST/DeclBase.cpp
  lib/CodeGen/CGExprConstant.cpp
  lib/CodeGen/MicrosoftCXXABI.cpp
  lib/Sema/SemaOpenMP.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59529.191228.patch
Type: text/x-patch
Size: 6314 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190319/f572494e/attachment.bin>


More information about the cfe-commits mailing list