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

Richard Smith richard at metafoo.co.uk
Mon Mar 30 19:39:51 PDT 2015


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.

> Is it possible to run a clang tool on all files in a directory by using
> FixedCompilationDatabase? (It returns nullptr for getAllFiles())
>
> In Windows, I have to manually write the compile_commands.json file, which
> is an additional task for huge source code.
>
>
>  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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150330/c76e704d/attachment.html>


More information about the cfe-dev mailing list