[cfe-dev] Missing edges in analysis call graph
Daniel DeFreez
dcdefreez at ucdavis.edu
Fri Nov 21 04:24:18 PST 2014
I'm thinking something along the lines of:
+ // If this is a function declaration without a body,
+ // then substitute the declaration that does have a body.
+ // (unchanged if no such definition exists)
+ FunctionDecl *SwapForDefinition(FunctionDecl *FD) {
+ FunctionDecl *Definition = FD;
+ if (! FD->doesThisDeclarationHaveABody())
+ for (auto I : FD->redecls())
+ if (I->doesThisDeclarationHaveABody())
+ Definition = I;
+
+ return Definition;
+ }
+
void addCalledDecl(Decl *D) {
+ if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
+ D = SwapForDefinition(FD);
+
if (G->includeInGraph(D)) {
CallGraphNode *CalleeNode = G->getOrInsertNode(D);
CallerNode->addCallee(CalleeNode, G);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141121/d085d18b/attachment.html>
More information about the cfe-dev
mailing list