[cfe-dev] How do clang tools handle input like '/path/to/files/*.c'?

Manuel Klimek klimek at google.com
Mon Mar 30 20:11:00 PDT 2015


Answering multiple people inline :)

On Mon, Mar 30, 2015 at 7:45 PM Richard Smith <richard at metafoo.co.uk> wrote:

> On Mon, Mar 30, 2015 at 7:17 PM, Pradnya Laxman Khalate <plkhalat at syr.edu>
> wrote:
>
>>  Hi,
>>
>>
>>  I am studying Clang for an academic project. I am using Clang from
>> Windows. I was able to build it with MSVS 2013. I am using MinGW and msys
>> shell to run the Clang tools from the command line.
>>
>>
>>  As a trial, I gave a path input to clang-tidy tool -
>>
>>  clang-tidy ../<path>/*.cpp
>> -checks="readability-braces-around-statements" --
>>
>>
>>  It is interesting that the tool was able to handle this without
>> compilation database (Note --).
>>
>> To see how this input is handled by 'CommonOptionsParser', I gave the
>> same input through Visual Studio debugger in my clang build. However, the
>> tool throws an error for the argument '/path/*.cpp'.
>>
>> In general, how do clang tools handle such 'SourcePath' input?
>>
> The difference between the above two scenarios is probably the msys shell
> -- when a unix-like shell processes a command with wildcards in an
> argument, it performs path expansion on that argument (looking up files
> matching the pattern and converting the argument into a sequence of
> filenames). When you give the same wildcard pattern directly to the tool's
> argv, this will not typically happen.
>

Yep.

> Is it possible to run a clang tool on all files in a directory by using
>> FixedCompilationDatabase? (It returns nullptr for getAllFiles())
>>
> No.

>  In Windows, I have to manually write the compile_commands.json file,
>> which is an additional task for huge source code.
>>
> Which build system are you using? The Visual Studio one? I think it has
xml files, which you could parse with python to generate the
compile_commands.json?

>
>>  Any suggestions / guidance is appreciated.
>>
>>
>>  Thanks,
>>
>> Pradnya
>>
>>
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150331/934bd7ad/attachment.html>


More information about the cfe-dev mailing list