<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="2"><font face="Arial">Nicolas,<br>
<br>
To answer your question: Yes, you can analyze C programs using the CDT.
You&#8217;ll have lots of quiet time to contemplate such questions, and clear
your head of all the clutter that is probably obfuscating the answers
you seek. However, using the CDT for such a thing can take a while...
maybe up to 5 months to get an answer. And even when you're done, you
might have to use other tools like the AT and PCT to do some comparison
with the CDT results. To answer some other questions you might have&#8230;<br>
<br>
-&nbsp; Water is not as much of a problem as you might think, you just have
to plan&#8230;<br>
-&nbsp; Pick any route you want in southern NM, they&#8217;re all good.<br>
-&nbsp; Most people say the most dramatic scenery is in the Winds<br>
-&nbsp; The Big Sandy situation is a bummer&#8230; but if you make a reservation
to stay there, they&#8217;ll hold a package for you<br>
-&nbsp; You do need permits in Yellowstone &amp; Glacier, but the process
isn&#8217;t so bad&#8230; as long as you can stand watching their &#8220;bear videos&#8221;.<br>
-&nbsp; It depends on the snowpack<br>
-&nbsp; June 15th<br>
<br>
I haven't heard of the AST... where does that go? <br>
<br>
Good luck out there!<br>
<br>
-Jonathan</font></font><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"></span></font><br>
<br>
<br>
Nicolas Anquetil wrote:
<blockquote
 cite="mid:875ea57d0912160456j33f84965r9432b09829bb47fd@mail.gmail.com"
 type="cite">
  <pre wrap="">Hi,

This is certainly a basic question but I cannot seem to find clear
information on the net.

I want to analyse some C program using CDT.

When I find in the AST an IASTExpression that I know is a function
call (instanceof IASTFunctionCallExpression), how can I find where the
function is defined (in what file) ?

I am experimenting with a simple C project that has 2 files and one
function in each file, one of the functions calls the other.

I could access the name of the FunctionCall and from that the IBinding.

What next?

I tried expr.getTranslationUnit().getDefinitionsInAST(name.resolveBinding())
with either file as translationUnit
but that gave me an empty array :-(

May be it comes from how I generate the AST?

ICProject cproj = CoreModel.getDefault().create(proj);
for (ICContainer folder : cproj.getSourceRoots()) {
 for (ITranslationUnit unit : folder.getTranslationUnits()) {
   IASTTranslationUnit unitAST = unit.getAST();
   [...then explore the AST 'unitAST' to find
IASTFunctionCallExpression in it ... ]

Can you help?
Please?

nicolas

  </pre>
</blockquote>
</body>
</html>