[clang] 7ea64ae - [analyzer] Use IgnoreImpCasts() instead of reimplementing it.

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 16:33:10 PDT 2020


Author: Nico Weber
Date: 2020-03-31T19:32:55-04:00
New Revision: 7ea64ae3afe4ad98e6753b9f74b30019113f719c

URL: https://github.com/llvm/llvm-project/commit/7ea64ae3afe4ad98e6753b9f74b30019113f719c
DIFF: https://github.com/llvm/llvm-project/commit/7ea64ae3afe4ad98e6753b9f74b30019113f719c.diff

LOG: [analyzer] Use IgnoreImpCasts() instead of reimplementing it.

No intended behavior change.

Differential Revision: https://reviews.llvm.org/D77022

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
index e4b720df6b11..0b8d100992a2 100644
--- a/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -508,13 +508,7 @@ void NullabilityChecker::checkEvent(ImplicitNullDerefEvent Event) const {
 /// 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


        


More information about the cfe-commits mailing list