[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] AST for a C++ project
|
Yes, in this case you need to parse all translation units of the CPP files in the project. I first had the impression you wanted to have all occurrences of one specific function. But if you are interested in all function calls you will need parse all sources.
-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of sim0s
Sent: Freitag, 2. Dezember 2016 01:03
To: cdt-dev@xxxxxxxxxxx
Subject: 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.
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/cdt-dev