[PATCH] D98341: [analyzer][solver] Prevent infeasible states (PR49490)

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 11 03:14:11 PST 2021


vsavchenko marked an inline comment as done.
vsavchenko added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1400-1406
+  LLVM_ATTRIBUTE_UNUSED inline bool areFeasible(ConstraintRangeTy Constraints) {
+    return llvm::none_of(
+        Constraints,
+        [](const std::pair<EquivalenceClass, RangeSet> ClassConstraint) {
+          return ClassConstraint.second.isEmpty();
+        });
+  }
----------------
steakhal wrote:
> `inline` is unnecessary. All member functions are inline by default.
> I would take the parameter by `const ref` in the lambda.
> Why did you mark it `LLVM_ATTRIBUTE_UNUSED `? `LLVM_NODISCARD` would be probably a better choice.
Fair point about `inline`.
`LLVM_NODISCARD` doesn't exclude `LLVM_ATTRIBUTE_UNUSED`.
It should be marked that way for Release builds when compiler might figure out that this class is local to only this TU, and this function is not used here anywhere.  You can see in the comment for this macro that this is actually the main motivation for this macro to be used.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98341



More information about the cfe-commits mailing list