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

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


Back to the top