<div dir="auto"><div dir="auto">> The phrase “clang api” is a bit vague (libclang?)<div dir="auto"><br></div><div dir="auto">If it's possible, then of course LibClang as it's backward compatible, but I know that it's restricted in functionality, so if LibClang don't give such freedom, then LibTooling.</div><div dir="auto"><br></div><div dir="auto">> $ echo 'int main(void) { return 0; }' | clang -x c -</div><div dir="auto"><br></div><div dir="auto">Thanks for the advice! This should work on unix, but what's about other systems? That's why I wanted to go with code, because I target at least Linux, Macos and Windows, and with code solution it'll be no different to support all of them as well as it'll be bit more secure, I think.</div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 18, 2022, 4:07 AM Matthew Fernandez <<a href="mailto:matthew.fernandez@gmail.com" target="_blank" rel="noreferrer">matthew.fernandez@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On Jan 17, 2022, at 14:35, 0dminnimda via cfe-users <<a href="mailto:cfe-users@lists.llvm.org" rel="noreferrer noreferrer" target="_blank">cfe-users@lists.llvm.org</a>> wrote:<br>
> <br>
> 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.<br>
> Googled that, but not really successfully.<br>
> No good source of info about that or code that's outdated.<br>
> Would really appreciate any help.<br>
<br>
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:<br>
<br>
$ echo 'int main(void) { return 0; }' | clang -x c -<br>
<br>
Hope this helps.</blockquote></div></div>