[cfe-commits] PATCH: Add a custom initialization hook for clang tools.

Alexander Kornienko alexfh at google.com
Tue Jul 17 09:06:28 PDT 2012


On Tue, Jul 17, 2012 at 5:18 PM, Daniel Jasper <djasper at google.com> wrote:

> The patch looks good to me aside from the issues below.
>
>   +//  FIXME: The strategy forward is to provide a plugin system that can
> load
>   +//  custom compilation databases and make enabling that a build option.
>
> I think this is either a leftover or needs to be adapted to the init stuff.
>
Yep, seems to be irrelevant.


>   +#ifndef LLVM_TOOLS_CLANG_LIB_TOOLING_CUSTOMTOOLINIT_H_
>
> This should be LLVM_CLANG_TOOLING_CUSTOM_TOOL_INIT_H
> We leave out TOOLS and LIB, don't put "_" at the end and separate
> CamelCase by "_".
>
Done, but I didn't even think that there's a rule for this, and didn't find
it now. Would you be so kind to point me to a relevant document?

  +void customToolInit(int argc, const char **argv);
>
> I think we should put this into the clang::tooling:: namespace, just in
> case. Could you then also put the findCompilationDatabaseForDirectory()
> into that namespace?
>
Makes sense. Done.

  +#ifndef LLVM_TOOLS_CLANG_LIB_TOOLING_CUSTOMCOMPILATIONDATABASE_H_
>
> Thanks for adding this (/me forgot), but it should be:
> LLVM_CLANG_TOOLING_CUSTOM_COMPILATION_DATABASE_H
>
Done.


>   +#ifdef USE_CUSTOM_TOOL_INIT
>   +#include "clang/Tooling/CustomToolInit.h"
>   +#endif
> Have you actually tried compiling with that option? I think it can't find
> the header file like that as there is no such directory. Simply do
> '#include "CustomToolInit.h"'.
>
Yep, my bad. Changed.


>
> On Tue, Jul 17, 2012 at 4:47 PM, Alexander Kornienko <alexfh at google.com>wrote:
>
>> This patch adds a custom initialize hook for clang tools. This is useful
>> for plugging in custom initialization in private code bases and IDEs.
>> Currently it can be used by compiling with a -DUSE_CUSTOM_TOOL_INIT and
>> linking in an implementation for the customToolInit function.
>>
>> --
>> Regards,
>> Alexander
>>
>
>
-- 
Regards,
Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120717/c87c23b8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tool-init-hook.diff
Type: application/octet-stream
Size: 4156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120717/c87c23b8/attachment.obj>


More information about the cfe-commits mailing list