Help: Clang Rewriter

Hi,

I have created a plugin to do some transformations on c files. My main
class inherits ASTConsumer class. I have 2 questions

1) I want to give multiple files as input. While I am able to do it the
AST Objects(like FunctionDecl, VarDecl and others) of the first file get
deleted when the first processing is done. This I understand is because
AST Objects get destroyed when ASTContext gets destroyed which is single
AST specific. Is there a way to not release these objects. I do need the
first file's objects when working on the second file since these files
belong to a single project and are interrelated.

2) I want to do all the source level transformations and then finally
rewrite the output buffer(RewriteBuffer) to these files at the very end
and not in HandleTranslationUnit function which is AST specific.

Kindly let me know if I am missing something obvious.

Thanks,
Hema

Hello,
I need to link Clang, and a test case (added as the clang lit test) using an external library. I could do it by manually adding the options in the lit test.

For instance:

// RUN: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<PATH_TO_LIB>
// RUN: %clang -o %t %s -L<PATH_TO_LIB> -l<libname> -lstdc++
// RUN: %t > %t.out

<<C++ Source>>

Is there a way to add the library path in the lit test configuration, and use it on my test case? I know that I cannot expect a similar test that links with external libraries in the clang test suite. But it would be helpful if someone can share their experience trying to accomplish something.

Thanks
Sriram

We really don't want executable tests in that test suite. Things that _must_ execute should go in projects/test-suite from the main llvm project. If you think you must have a testcase to test something you should probably think of a different way to test it.

-eric

Thanks for the comments Eric. I noticed that the test-suite works off llvm-gcc. Is there a way to use clang instead?

Thanks for the comments Eric. I noticed that the test-suite works off llvm-gcc. Is there a way to use clang instead?

Try,
make check-gcc CC_UNDER_TEST=$CLANG

- Fariborz

It'll autodetect it if you have clang checked out into your build directory.

-eric