The Function table is filled from information obtained from VisitCXXRecord. In VisitCXXRecord, classes are filtered by the following if statements before being processed by recordParents(std::string, std::string) (signature is specified since there are two recordParents functions):
The way class declarations are being retrieved is by either one of the two ways:
VisitCXXRecord function is being called by RecursiveASTVisitor and hence the decl is provided from that class.
We traverse the bases of a declaration provided by the VisitCXXRecord which we can get in the form of QualType. Try to convert them to CXXRecordDecl. If the last was successful (not null), it means this points to a parent class decl. This method excludes some (but not all) template classes (as described in #18). At this stage, the function declarations are coming from the AST. Hence, in case of template classes, the signature of functions depending on generic types still have generic parameters.
How the FunctionCall Table is Populated
When processing call functions (in processCallExpressions function), the class declaration is coming from the CXXMemberCallExpr which processes all templates. At this stage, generic types of templates are already resolved. Hence, signatures of functions depending on the generic classes will have concrete class types since the receiver is an instance of a template with its generic types already resolved.
In the Function table, we will have the signature of that function as follows: void setValue(T).
However, in the FunctionCall table, we will have the signature as follows: void setValue(int)
Hence, the same function will have different signatures in FuncationCalls based how it is instantiated. Therefore, there are functions in FunctionCall that cannot be linked to FunctionIDs in Function since it is not possible to match their signatures with the Function table data.
How the Function Table is Populated
The
Function
table is filled from information obtained fromVisitCXXRecord
. InVisitCXXRecord
, classes are filtered by the followingif
statements before being processed byrecordParents(std::string, std::string)
(signature is specified since there are tworecordParents
functions):The way class declarations are being retrieved is by either one of the two ways:
VisitCXXRecord
function is being called byRecursiveASTVisitor
and hence thedecl
is provided from that class.VisitCXXRecord
which we can get in the form ofQualType
. Try to convert them toCXXRecordDecl
. If the last was successful (not null), it means this points to a parent class decl. This method excludes some (but not all) template classes (as described in #18). At this stage, the function declarations are coming from the AST. Hence, in case of template classes, the signature of functions depending on generic types still have generic parameters.How the FunctionCall Table is Populated
When processing call functions (in
processCallExpressions
function), the class declaration is coming from theCXXMemberCallExpr
which processes all templates. At this stage, generic types of templates are already resolved. Hence, signatures of functions depending on the generic classes will have concrete class types since the receiver is an instance of a template with its generic types already resolved.The problem
Consider the following hypothetical function:
In the
Function
table, we will have the signature of that function as follows:void setValue(T)
. However, in theFunctionCall
table, we will have the signature as follows:void setValue(int)
Hence, the same function will have different signatures inFuncationCalls
based how it is instantiated. Therefore, there are functions inFunctionCall
that cannot be linked to FunctionIDs inFunction
since it is not possible to match their signatures with theFunction
table data.