=?utf-8?q?Gábor_Horváth?= <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
================
@@ -196,6 +196,19 @@ void CallGraph::addNodeForDecl(Decl* D, bool IsGlobal) {
}
}
+void CallGraph::addNodesForVarInit(VarDecl *VD) {
+ // Only variables with static or thread storage duration need this: their
+ // initializers run with no function caller and are not reached by any body
+ // walk, so a lambda or block defined in one would be missed. Local variables
+ // are covered by the enclosing body walk, and parameter default arguments by
+ // CGBuilder at call sites. Attach discovered calls to the root.
+ if (!VD->hasGlobalStorage())
+ return;
+ if (Expr *Init = VD->getInit()) {
+ CGBuilder{this, Root}.Visit(Init);
+ }
----------------
usx95 wrote:
nit: You can remove the braces for the `if` body.
https://github.com/llvm/llvm-project/pull/206458
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits