[clang-tools-extra] r295482 - [clang-tidy] Add -path option to clang-tidy-diff.py

Ehsan Akhgari via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 17 17:21:01 PST 2017


What's strange is that I copied this pattern from
clang-tidy-run-with-database.cpp, and I'm not sure why it would work there
and not here..

On Fri, Feb 17, 2017 at 8:16 PM, Ehsan Akhgari <ehsan.akhgari at gmail.com>
wrote:

> Hi Douglas,
>
> Sorry about this.  It seems to me that the reason for this test failure is
> the slashes that appear in the -path argument in the log:
>
> "-path" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.obj\tools\clang\tools\extra\test\clang-tidy\Output/compilation-database-test"
> $ "FileCheck" "-check-prefix=CHECK" "C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\test\clang-tidy\clang-tidy-diff.cpp"
>
> However I'm not sure how to fix this.  I'm using slashes as the path separator in the test RUN command.  Is there a safer platform independent token I should use instead?
>
>
> On Fri, Feb 17, 2017 at 3:57 PM, Yung, Douglas <douglas.yung at sony.com>
> wrote:
>
>> Hi Ehsan,
>>
>> Your commit has caused the PS4 Windows bot to go red. Can you take a look?
>>
>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-
>> scei-ps4-windows10pro-fast/builds/5661
>>
>> $ "FileCheck" "-check-prefix=CHECK" "C:\Buildbot\Slave\llvm-clang-
>> lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\
>> tools\extra\test\clang-tidy\clang-tidy-diff.cpp"
>> # command stderr:
>> C:\Buildbot\Slave\llvm-clang-lld-x86_64-scei-ps4-windows10pr
>> o-fast\llvm.src\tools\clang\tools\extra\test\clang-tidy\clang-tidy-diff.cpp:17:11:
>> error: expected string not found in input
>>
>> // CHECK: [[@LINE-2]]:8: warning: annotate this
>>
>>           ^
>>
>> <stdin>:1:1: note: scanning from here
>>
>> YAML:1:1: error: Unrecognized escape code!
>>
>> ^
>>
>> <stdin>:1:1: note: with expression "@LINE-2" equal to "15"
>>
>> YAML:1:1: error: Unrecognized escape code!
>>
>> ^
>>
>> <stdin>:1:7: note: possible intended match here
>>
>> YAML:1:1: error: Unrecognized escape code!
>>
>>       ^
>>
>>
>> error: command failed with exit status: 1
>>
>> Douglas Yung
>>
>> > -----Original Message-----
>> > From: cfe-commits [mailto:cfe-commits-bounces at lists.llvm.org] On
>> Behalf Of
>> > Ehsan Akhgari via cfe-commits
>> > Sent: Friday, February 17, 2017 11:32
>> > To: cfe-commits at lists.llvm.org
>> > Subject: [clang-tools-extra] r295482 - [clang-tidy] Add -path option to
>> clang-
>> > tidy-diff.py
>> >
>> > Author: ehsan
>> > Date: Fri Feb 17 13:31:43 2017
>> > New Revision: 295482
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=295482&view=rev
>> > Log:
>> > [clang-tidy] Add -path option to clang-tidy-diff.py
>> >
>> > Summary:
>> > This flag allows specifying a custom path for the compilation database.
>> > Unfortunately we can't use the -p flag like other clang-tidy tools
>> because
>> > it's already taken.
>> >
>> > Reviewers: alexfh
>> >
>> > Subscribers: JDevlieghere, cfe-commits
>> >
>> > Differential Revision: https://reviews.llvm.org/D29806
>> >
>> > Modified:
>> >     clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
>> >     clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
>> >
>> > Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
>> > URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-
>> > tidy/tool/clang-tidy-diff.py?rev=295482&r1=295481&r2=295482&view=diff
>> > ============================================================
>> ==================
>> > --- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
>> (original)
>> > +++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Fri Feb
>> > +++ 17 13:31:43 2017
>> > @@ -55,6 +55,8 @@ def main():
>> >                        help='checks filter, when not specified, use
>> clang-tidy
>> > '
>> >                        'default',
>> >                        default='')
>> > +  parser.add_argument('-path', dest='build_path',
>> > +                      help='Path used to read a compile command
>> > + database.')
>> >    parser.add_argument('-extra-arg', dest='extra_arg',
>> >                        action='append', default=[],
>> >                        help='Additional argument to append to the
>> compiler '
>> > @@ -124,6 +126,8 @@ def main():
>> >      command.append('-checks=' + quote + args.checks + quote)
>> >    if args.quiet:
>> >      command.append('-quiet')
>> > +  if args.build_path is not None:
>> > +    command.append('-p=%s' % args.build_path)
>> >    command.extend(lines_by_file.keys())
>> >    for arg in args.extra_arg:
>> >        command.append('-extra-arg=%s' % arg)
>> >
>> > Modified: clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
>> > URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/
>> test/clang-
>> > tidy/clang-tidy-diff.cpp?rev=295482&r1=295481&r2=295482&view=diff
>> > ============================================================
>> ==================
>> > --- clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp
>> (original)
>> > +++ clang-tools-extra/trunk/test/clang-tidy/clang-tidy-diff.cpp Fri Feb
>> > +++ 17 13:31:43 2017
>> > @@ -2,6 +2,9 @@
>> >  // RUN: clang-tidy -checks=-*,modernize-use-override %t.cpp --
>> -std=c++11 |
>> > FileCheck -check-prefix=CHECK-SANITY %s  // RUN: not diff -U0 %s %t.cpp
>> |
>> > %clang_tidy_diff -checks=-*,modernize-use-override -- -std=c++11 2>&1 |
>> > FileCheck %s  // RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff
>> -checks=-
>> > *,modernize-use-override -quiet -- -std=c++11 2>&1 | FileCheck -check-
>> > prefix=CHECK-QUIET %s
>> > +// RUN: mkdir -p %T/compilation-database-test/ // RUN: echo
>> > +'[{"directory": "%T", "command": "clang++ -o test.o -std=c++11 %t.cpp",
>> > +"file": "%t.cpp"}]' >
>> > +%T/compilation-database-test/compile_commands.json
>> > +// RUN: not diff -U0 %s %t.cpp | %clang_tidy_diff
>> > +-checks=-*,modernize-use-override -path %T/compilation-database-test
>> > +2>&1 | FileCheck -check-prefix=CHECK %s
>> >  struct A {
>> >    virtual void f() {}
>> >    virtual void g() {}
>> >
>> >
>> > _______________________________________________
>> > cfe-commits mailing list
>> > cfe-commits at lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
>
> --
> Ehsan
>



-- 
Ehsan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170217/3fc98da4/attachment-0001.html>


More information about the cfe-commits mailing list