Generate a header file from a source file with clang

Hi,
   Maybe a silly question but I'd like your opinion on it:
   How difficult would be (if possible) to implement a clang plugin which can generate a header file from a source file with implementation. The idea is to ask clang to build a library from a 'single' source file to generate a header file for it.
Many thanks,
Vassil

I hacked together a tool which did this a while back. If you don't care about is handling the full power of C++, it's not that difficult.

Basically, run it through the parser, then perform walks over the AST.

Note: This assumes that the original code compiles cleanly _without_ including your newly generated header.

Note: I didn't use the 'plugin' mechanism. So no comment on that part of the question.

Philip

I hacked together a tool which did this a while back. If you don't care about is handling the full power of C++, it's not that difficult.

Basically, run it through the parser, then perform walks over the AST.

Can I see the tool. Is it open source?