[clang] [analyzer] Modernize FuchsiaHandleChecker (PR #111588)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 03:54:23 PDT 2024


================
@@ -336,141 +592,55 @@ void FuchsiaHandleChecker::checkPreCall(const CallEvent &Call,
     SmallVector<SymbolRef, 1024> Handles =
         getFuchsiaHandleSymbols(PVD->getType(), Call.getArgSVal(Arg), State);
 
-    // Handled in checkPostCall.
-    if (hasFuchsiaAttr<ReleaseHandleAttr>(PVD) ||
-        hasFuchsiaAttr<AcquireHandleAttr>(PVD))
-      continue;
-
     for (SymbolRef Handle : Handles) {
       const HandleState *HState = State->get<HStateMap>(Handle);
-      if (!HState || HState->isEscaped())
----------------
NagyDonat wrote:

Why did you change this? In the case of `!HState` you will still skip all "action" in the loop because you added `HState &&` to each inner `if` -- so it would be clearer to keep the "`!HState` $\Rightarrow$ immediately `continue`" logic. (Obviously if you didn't intend to add `HState &&` everywhere in the loop, then fix that instead.)

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


More information about the cfe-commits mailing list