[PATCH] D77022: Use IgnoreImpCasts() instead of reimplementing it.

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 29 11:13:14 PDT 2020


thakis created this revision.
thakis added a reviewer: dcoughlin.
Herald added subscribers: martong, Charusso.

No intended behavior change.


https://reviews.llvm.org/D77022

Files:
  clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp


Index: clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -508,13 +508,7 @@
 /// return expressions of ObjC types when the return type of the function or
 /// method is non-null but the express is not.
 static const Expr *lookThroughImplicitCasts(const Expr *E) {
-  assert(E);
-
-  while (auto *ICE = dyn_cast<ImplicitCastExpr>(E)) {
-    E = ICE->getSubExpr();
-  }
-
-  return E;
+  return E->IgnoreImpCasts();
 }
 
 /// This method check when nullable pointer or null value is returned from a


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77022.253439.patch
Type: text/x-patch
Size: 696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200329/cbe70afe/attachment-0001.bin>


More information about the cfe-commits mailing list