Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] CDT as a Standalone API

This is exciting.

Unfortunately, I will be busy till November 13 because of a publication deadline.

But after that, I will be more than willing to take this up. Since, it will greatly impact my upcoming project which involves API migration on large codebases 

Any pointers welcome. Because I currently have little idea how the ASTRewrite performs the modifications internally and where and how the intermediate transformed ASTs are stored. 



On Thu, Oct 30, 2014 at 1:59 AM, Alena Laskavaia <elaskavaia.cdt@xxxxxxxxx> wrote:
Along same lines as Dmitry mentioned, it is theoretically possible to use headless CDT for code transformations. You do have to use workspace concept, but I don't think it is big deal, because nobody has to know
how you doing it internally. I.e. you can import code in temp workspace as project, configure scanner discovery, run indexer, do code transformations, rewrite code, exit and delete workspace afterwards.
Location of the code does not have to be physically inside workspace, it is eclipse place to store writeable stuff. And if you do all of this and it works, would be nice if you contribute this framework/example back :)

On Wed, Oct 29, 2014 at 12:02 PM, Dmitry Petrov <dmitrynpetrov@xxxxxxxxx> wrote:
You can implement a stand-alone application based on CDT.
org.eclipse.cdt.codan.internal.core.CodanApplication might be a good example if you want to do something with source code.

Let me share some of my experience as a person who uses both Clang and CDT for tool development.

Unfortunately, neither Clang nor CDT solves C/C++ source-to-source transformation issues related to the preprocessor quite well. That's a very difficult area, though.

ClangTooling doesn't add anything special to Clang ASTs model.

Clang doesn't represent preprocessor statements in AST. There are some mechanisms to match comments to declarations, but nothing more. You'll have to hack things on top of preprocessor callbacks and AST traversal yourself.




On Wed, Oct 29, 2014 at 6:49 PM, Krishna Narasimhan <krishna.nm86@xxxxxxxxx> wrote:
I tried clang. Not the ClangTooling. The core Clang seemed to have issues like not preserving comments after rewrites etc. Do the Tooling handle Preprocessor statements too?

I thought clang was primarily an optimmization framework and not a source code transformation tool. 

On Wed, Oct 29, 2014 at 4:40 PM, Nathan Ridge <zeratul976@xxxxxxxxxxx> wrote:
> Basically I would like to perform write test codes that work on ASTs
> not obtained from any project from the IDE. Basically Parsed from
> Strings or other text files. Perform modifications to that AST and be
> able to use the rewritten AST , all this possibly without a code from
> the IDE

If you're writing a standalone tool for creating, analyzing, and rewriting
ASTs, you might want to consider the clang infrastructure [1].

Regards,
Nate

[1] http://clang.llvm.org/docs/Tooling.html

_______________________________________________
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



--
-----------------------------------------------------
I dare do all that may become a man; Who dares do more, is none - Macbeth, twelfh night!
Regards
       Krishna

_______________________________________________
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


_______________________________________________
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


_______________________________________________
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



--
-----------------------------------------------------
I dare do all that may become a man; Who dares do more, is none - Macbeth, twelfh night!
Regards
       Krishna

Back to the top