[cfe-dev] Automating Clang Tool (with CommonOptionsParser)

Sunny Billava via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 7 05:52:58 PST 2016


Hello All,
We want to create a tool (in C# .NET, EXE) which invokes the clang tool (C++, DLL). While implementing we realized that the CommonOptionsParser only expects the call to the Clang tool to be in the form of command line options. Is there a way around this issue that someone has encountered earlier?

On the other hand, if I pass the c code as a string buffer to the tooling, the included .h files are not recognized by clang tooling. So somehow Common Options Parser was the choice.

int main(int argc, const char **argv) {

CommonOptionsParser OptionsParser(argc, argv, MyToolCategory);
       ClangTool Tool(OptionsParser.getCompilations(),OptionsParser.getSourcePathList());

       int result = Tool.run(newFrontendActionFactory<DFAMainClassAction>().get());
return result;
}

Any help would be greatly appreciated :)

Regards,
Sunny. R. Billava

This message contains information that may be privileged or confidential and is the property of the KPIT Technologies Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Technologies Ltd. does not accept any liability for virus infected mails.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161207/57e38d8d/attachment.html>


More information about the cfe-dev mailing list