[LLVMbugs] [Bug 12747] New: CallGraph Fails to List Prototype only functions
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun May 6 12:08:05 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12747
Bug #: 12747
Summary: CallGraph Fails to List Prototype only functions
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: mark.d.mccurry at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Currently the callgraph class defined at clang/lib/Analysis/CallGraph.cpp fails
to list the full callgraph when calls are made to functions without
definitions.
This problem occurs in today's version of the svn head.
To Replicate:
Use clang::CallGraph to generate a callgraph from:
---------------------------------------
//Function prototype (eg from a header)
void prototype_only(void);
void trivial_function(void)
{}
void calling_function(void)
{
prototype_only();
trivial_function();
}
---------------------------------------
Actual Output: [from CallGraph::dump()]
--- Call graph Dump ---
Function: < root > calls: trivial_function calling_function
Function: trivial_function calls:
Function: calling_function calls: trivial_function
Expected Output:
--- Call graph Dump ---
Function: < root > calls: trivial_function calling_function
Function: trivial_function calls:
Function: calling_function calls: prototype_only trivial_function
Source of the issue:
This behavior occurs due to CallGraph::includeInGraph().
It eliminates any Declarations that are not definitions, which makes sense for
top level elements, but IMO it seems like a bug for function calls themselves.
72 if (!FD->isThisDeclarationADefinition() ||
73 FD->isDependentContext())
74 return false;
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list