Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] AST for a C++ project

Thanks Thomas.

"Yes exactly. If you don't specify the flags the whole compilation unit
should be parsed. "

I agree with this. However, consider the following simple (& "silly")
scenario: 

=================
//File: myMathFunctions.h
-----------------------------
double perimeter(...);
double area(...);
void printAll(...);

and in myMathFunctions.cpp

//File: myMathFunctions.cpp
-----------------------------
void printAll(...){
   cout << perimeter(...) << endl;
   cout << area(...) << endl;
}


and in myMain.cpp

//File: myMain.cpp
-----------------------------
#include "myMathFunctions.h"
printAll(....);
========================


Then, 

IASTTranslationUnit ast = tu.gesAST();

will give me the AST for myMain.cpp

If I have a visitor that collects all IASTFunctionCallExpressions, I will
get only one (ie., printAll), right? 

This make sense since the TranslationUnit corresponds only to a single cpp
file. 

Thus, if I want to collect all the function call expressions from all my
input files (ie, myMathFunctions.cpp & myMain.cpp), I need to produce ast
and assign the visitor to each of these, right?




--
View this message in context: http://eclipse.1072660.n5.nabble.com/AST-for-a-C-project-tp186484p186502.html
Sent from the Eclipse CDT - Development mailing list archive at Nabble.com.


Back to the top