steakhal added inline comments.

================
Comment at: 
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:219-226
       if (V.isUndef())
-        return State;
+        return {State, State};
 
       DefinedOrUnknownSVal L = V.castAs<DefinedOrUnknownSVal>();
       if (!L.getAs<Loc>())
-        return State;
-
-      return State->assume(L, CannotBeNull);
-    }
+        return {State, State};
 
----------------
I suggest the same //simpler// version for the similar code segments as well.

By the same token, why do you return `{State, State}`?
Shouldn't you return `{State, nullptr}` there?
In general, one would not expect the **same** State being returned, IMO it's 
advised to avoid doing that.
Same applies for the other cases.


================
Comment at: 
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:299-300
                                             SvalBuilder.getContext().BoolTy);
       if (auto F = Feasible.getAs<DefinedOrUnknownSVal>())
-        return State->assume(*F, true);
+        return State->assume(*F);
 
----------------
Why don't you `castAs`? That also has the corresponding assert inside.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87785/new/

https://reviews.llvm.org/D87785

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to