[PATCH] D126802: [analyzer][NFC] Uplift checkers after D126801

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 2 02:55:21 PDT 2022


martong added a comment.

I think we should avoid `auto` when using `State->get<>` because the type is not immediate for the reader. (Unlike in a `cast<T>`.)



================
Comment at: clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.cpp:198
   // The special errno region should never garbage collected.
-  if (const auto *ErrnoR = getErrnoRegion(State))
+  if (const auto *ErrnoR = State->get<ErrnoRegion>())
     SR.markLive(ErrnoR);
----------------



================
Comment at: clang/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp:108
   if (SymbolRef sym = val.getAsSymbol())
-    if (const unsigned *attachedFlags = state->get<SelfFlag>(sym))
+    if (const auto *attachedFlags = state->get<SelfFlag>(sym))
       return (SelfFlagEnum)*attachedFlags;
----------------
I'd rather keep the type here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126802



More information about the cfe-commits mailing list