[PATCH] D120149: [clang][dataflow] Add support for global storage values
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 18 11:50:10 PST 2022
ymandel accepted this revision.
ymandel added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp:74-77
+ auto *V = dyn_cast<VarDecl>(&D);
+ if (V == nullptr)
+ return;
+ initGlobalVar(*V, Env);
----------------
================
Comment at: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp:80
+
+/// Initializes global storage values in sub-expressions of `S`.
+static void initGlobalVars(const Stmt &S, Environment &Env) {
----------------
maybe clarify that it intializes both declarations that are present *in* the substatements and those referenced *from* the sub statements?
================
Comment at: clang/lib/Analysis/FlowSensitive/Transfer.cpp:140
+
+ // Global vars are initialized in `Environment`.
+ if (D.hasGlobalStorage())
----------------
================
Comment at: clang/lib/Analysis/FlowSensitive/Transfer.cpp:305
+
+ auto &Loc = Env.createStorageLocation(*S);
+ if (VarDeclLoc->getType()->isReferenceType()) {
----------------
should this be in the `else` branch? As is, `Loc` looks unused if the condition is true.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120149/new/
https://reviews.llvm.org/D120149
More information about the cfe-commits
mailing list