Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Where is the definition?


Attached is the small C project that I'm trying to parse with
AST/index. The .project and .cproject were created programmatically in
CDT. All other files (*.c, *.h) are imported or edited manually.

I'm facing a problem that I cannot find a definition of 'printSimpleP'
function (see Test.c).
1. I'm creating an IASTTranslationUnit for the Test.c
2. For each function body I'm assigning a visitor that process IASTExpression.
3. In the visit() method, I'm evalating all IASTFunctionCallExpression
(i.e. calls made from the function body) and retrieve the name
3. For each referenced function name I'm getting the IASTName (astName
= ((IASTIdExpression)nameExpression).getName();)
4. For the IASTName I'm getting the binding, definitions and declarations:

  IBinding nameBinding = astName.resolveBinding();
  IName[] astDeclarations =
  IName[] astDefinitions =

For some reason definition array always has 0 elements for this
'printSimpleP' function. At the same time, for all other functions
(like 'printSimple' when parsing 'main') it contains 1 definition.
Declaration array contains 1 declaration that points to Test.h:28 for

I cannot figure out why it behaves so differently. Do you have any ideas?

I'm using CDT 5.0.1


Description: Zip archive

Back to the top