[cfe-dev] How to build clang plugin

Kai Wang via cfe-dev cfe-dev at lists.llvm.org
Fri Feb 12 10:22:39 PST 2016


Hi Eli,

I figure out how to build clang plugin and run it now.
Thank you.

On Fri, Feb 12, 2016 at 8:42 AM, Eli Bendersky <eliben at google.com> wrote:

>
>
> On Tue, Feb 9, 2016 at 10:00 PM, Kai Wang via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Hi all,
>>
>> I'm a beginner to clang. I want to write clang plugin to do some static
>> analysis.
>> I did "mkdir llvm-build" and built clang following these steps
>> http://clang.llvm.org/get_started.html
>>
>> As a starting point, I'm trying clang/examples/PrintFunctionNames from
>> clang plugins tutorial http://clang.llvm.org/docs/ClangPlugins.html
>> I did "cd llvm-build & make PrintFunctionNames ", but it didn't work.
>> I also tried "cd llvm-build/tools/clang", and "make BUILD_EXAMPLES=1".
>> However, in either case I can not get "PrintFunctionNames.so"
>>
>> Is there any guidance? Thank you.
>>
>
> Hi Kai,
>
> If you want to build a plugin outside the Clang tree, see this sample:
> https://github.com/eliben/llvm-clang-samples/blob/master/src_clang/plugin_print_funcnames.cpp
> and the Makefile that builds it (in the same repo). It works both with
> close-to-trunk Clang and the latest release binaries. The C++ file has a
> comment at the top explaining how to run it once built
>
> Eli
>
>
>



-- 
Regards,
Kai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160212/8248e44c/attachment.html>


More information about the cfe-dev mailing list