[clang] [analyzer] Fix stores through label locations (PR #89265)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 01:56:11 PDT 2024


================
@@ -2358,11 +2358,12 @@ StoreRef RegionStoreManager::killBinding(Store ST, Loc L) {
 
 RegionBindingsRef
 RegionStoreManager::bind(RegionBindingsConstRef B, Loc L, SVal V) {
-  if (L.getAs<loc::ConcreteInt>())
+  // We only care about region locations.
+  auto MemRegVal = L.getAs<loc::MemRegionVal>();
+  if (!MemRegVal.has_value())
----------------
NagyDonat wrote:

Personal style preference: In this context I would omit the `.has_value()` method because it doesn't add meaningful information. (If I wanted to emphasize that this is an `optional` and not a pointer; I would've declared the type explicitly instead of using `auto`. However, here the pointer/`optional` difference is irrelevant for this short-lived temporary variable.)

Of course this is just subjective bikeshedding, no action required.

https://github.com/llvm/llvm-project/pull/89265


More information about the cfe-commits mailing list