Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question regarding preprocessor directives #17

Open
JakeSays opened this issue Jun 6, 2021 · 5 comments
Open

Question regarding preprocessor directives #17

JakeSays opened this issue Jun 6, 2021 · 5 comments

Comments

@JakeSays
Copy link

JakeSays commented Jun 6, 2021

Hello,

I am thinking about using cplusplus to write some personal source analysis and transformation tools. The first one i want to implement is a simple file dependency analyzer.

Is this possible? At first glance it doesn't appear that the include directives are preserved. Am i missing something?

For me the value of your project is in a lighter libclang (like about 50 tones lighter) for analysis purposes.

@robertoraggi
Copy link
Owner

Hi @JakeSays,

Thanks for showing interest in this project.

I'm afraid the C++20 frontend is not ready for writing such tools. I recently started to work on the type checker and the semantic passes required to correctly parse modern C++ code. As soon as I'm done with the type checker I will try to expose a set of APIs to use the preprocessor, the parser and the code model in C++ and JS apps.

@JakeSays
Copy link
Author

JakeSays commented Jun 6, 2021

Ah ok. I thought this was a continuation of the one that was used in qt creator. Is that version available somewhere? I looked for it in the creator repo but I couldn't find it.

Also I would be interested in writing a c# binding for this project when you get to that point.

@robertoraggi
Copy link
Owner

Yeah, modern C++ is considerably different than the versions of C++ I implemented in the past so I thought it was easier to start from scratch.

You can find the Qt Creator C++ parser in these two directories but I don't know if you can still compile it as a standalone library.

https://github.com/qt-creator/qt-creator/tree/master/src/libs/3rdparty/cplusplus
https://github.com/qt-creator/qt-creator/tree/master/src/libs/cplusplus

@asmwarrior
Copy link

I see there is a file named:

https://github.com/robertoraggi/cplusplus/blob/main/src/cxx/preprocessor.cc

which I see is a preprocessor.

Good work!

@robertoraggi
Copy link
Owner

@asmwarrior yes, the preprocessor is almost complete but I still need to add APIs to abstract the file system access and configure the predefined macros and the system include paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants