Merge "Silence a use-after-free warning from the analyzer" am: 8c853c43cc am: 584853bdb0 am: 84b998f437
am: 402c9dc99f
Change-Id: If18e360e8ae3f4794722496aefe1e56d3eeedc97
diff --git a/libutils/RefBase.cpp b/libutils/RefBase.cpp
index 24737b9..f5f881f 100644
--- a/libutils/RefBase.cpp
+++ b/libutils/RefBase.cpp
@@ -442,6 +442,11 @@
// and all accesses to refs happen before its deletion in the final decWeak.
// The destructor can safely access mRefs because either it's deleting
// mRefs itself, or it's running entirely before the final mWeak decrement.
+ //
+ // Since we're doing atomic loads of `flags`, the static analyzer assumes
+ // they can change between `delete this;` and `refs->decWeak(id);`. This is
+ // not the case. The analyzer may become more okay with this patten when
+ // https://bugs.llvm.org/show_bug.cgi?id=34365 gets resolved. NOLINTNEXTLINE
refs->decWeak(id);
}