How to write tests for ASTImporter?

Hello,

I have some patches for ASTImporter I wish to contribute. However, I didn't find much tests for it in clang test suite and I wonder if there is a way to write tests for ASTImporter? The only tests I found were dedicated to conflicting declarations.

Hi Alexei,

ASTImporter seems to be unfinished yet, it even didn’t handled StringLiteral. Nevertheless it is a useful tool and if handling some nodes is implemented, it works. I put the implementation of nodes interesting to me into review request (http://reviews.llvm.org/D14224). Probably we intersect in simple nodes but there are many nodes unimplemented yet.

If you are going to develop ASTImporter, it is great, as import facility is a powerful technique for syntax tools.

Existing test do not test import facility thoroughly. Some test may use static_assert, it is convenient for compile only tests. If the imported handled all nodes, it could be tested by compiling a source file into ast and then compiling an empty file with merging the compiled ast file. Now this way to test is not available though.

Hello Serge,

thank you for your reply.
I'll definitely take a look at your patch. My patch seems to cover most of your work and even more: it seems to be powerful enough for implementation of inter-unit analysis for Static Analyzer. If I'll submit a review, could I add you as a reviewer? I'll split it into multiple patches since it is more than 3k SLoc.

02.11.2015 14:23, Serge Pavlov пишет:

Great!

Looking forward your patch set.