[PATCH] D63889: Check possible warnings on global initializers for reachability

Nathan Huckleberry via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 3 16:10:52 PDT 2019


Nathan-Huckleberry added inline comments.


================
Comment at: clang/lib/Analysis/AnalysisDeclContext.cpp:124
+    if(VD->hasGlobalStorage()) {
+      return const_cast<Stmt*>(dyn_cast<Stmt>(VD->getInit()));
+    }
----------------
nickdesaulniers wrote:
> The `const_cast` doesn't look necessary here.  Is it?
`VD->getInit` returns a `const Expr *`. In order to remove the `const_cast` I would need to make `getBody()` `const` and every call to `getBody()`. The change required to add `const` seemed too large to be included in this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63889





More information about the cfe-commits mailing list