> On Jan 17, 2022, at 14:35, 0dminnimda via cfe-users 
> <cfe-users@lists.llvm.org> wrote:
> 
> I wanna use regular functionality of clang but instead of passing path to the 
> source I want to pass string as source code. Yes, it's preferably a code that 
> uses clang api and not just call to clang with source that was put into 
> input, as source files are usually big.
> Googled that, but not really successfully.
> No good source of info about that or code that's outdated.
> Would really appreciate any help.

The phrase “clang api” is a bit vague (libclang?), but it is possible to feed 
the compiler strings on the command line if you teach it the input language:

    $ echo 'int main(void) { return 0; }' | clang -x c -

Hope this helps.
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to