[PATCH] D108560: [clang-tidy] Add support for `NOLINTBEGIN` ... `NOLINTEND` comments

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 28 11:51:07 PDT 2021


aaron.ballman added a comment.

I had to revert in 9b944c184396ce55a3ad608779cc326ba12c9ee3 <https://reviews.llvm.org/rG9b944c184396ce55a3ad608779cc326ba12c9ee3> because there are testing failures.

  FAIL: Clang Tools :: clang-tidy/infrastructure/nolintbeginend.cpp (1 of 1)
  ******************** TEST 'Clang Tools :: clang-tidy/infrastructure/nolintbeginend.cpp' FAILED ********************
  Script:
  --
  : 'RUN: at line 1';   'C:/Program Files/Python39/python.exe' F:/source/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py F:\source\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure\nolintbeginend.cpp google-explicit-constructor F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp -- --header-filter=.* -system-headers -- -isystem F:\source\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/Inputs/nolintbeginend
  --
  Exit Code: 1
  
  Command Output (stdout):
  --
  $ ":" "RUN: at line 1"
  $ "C:/Program Files/Python39/python.exe" "F:/source/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py" "F:\source\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure\nolintbeginend.cpp" "google-explicit-constructor" "F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp" "--" "--header-filter=.*" "-system-headers" "--" "-isystem" "F:\source\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/Inputs/nolintbeginend"
  # command output:
  Running ['clang-tidy', 'F:\\source\\llvm-project\\llvm\\out\\build\\x64-Debug\\tools\\clang\\tools\\extra\\test\\clang-tidy\\infrastructure\\Output\\nolintbeginend.cpp.tmp.cpp', '-fix', '--checks=-*,google-explicit-constructor', '--header-filter=.*', '-system-headers', '-config={}', '--', '-isystem', 'F:\\source\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\infrastructure/Inputs/nolintbeginend', '-std=c++11', '-nostdinc++']...
  ------------------------ clang-tidy output -----------------------
  6 warnings generated.
  F:\source\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/Inputs/nolintbeginend\error_in_include.inc:1:11: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
  class G { G(int i); };
            ^
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:3:11: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
  class A { A(int i); };
            ^
            explicit
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:3:11: note: FIX-IT applied suggested code changes
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:30:12: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
  class B5 { B5(int i); };
             ^
             explicit
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:30:12: note: FIX-IT applied suggested code changes
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:42:12: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
  class C3 { C3(int i); };
             ^
             explicit
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:42:12: note: FIX-IT applied suggested code changes
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:57:12: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
  class C6 { C6(int i); };
             ^
             explicit
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:57:12: note: FIX-IT applied suggested code changes
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:95:7: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
  MACRO(D1)
        ^
        explicit
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:95:7: note: FIX-IT applied suggested code changes
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:93:28: note: expanded from macro 'MACRO'
  #define MACRO(X) class X { X(int i); };
                             ^
  clang-tidy applied 5 of 5 suggested fixes.
  Suppressed 19 warnings (19 NOLINT).
  
  ------------------------------------------------------------------
  ------------------------------ Fixes -----------------------------
  --- F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp.orig       2021-09-28 14:35:01.893193700 -0400
  +++ F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp    2021-09-28 14:35:02.802959500 -0400
  @@ -1,6 +1,6 @@
   // RUN: %check_clang_tidy %s google-explicit-constructor %t -- --header-filter=.* -system-headers -- -isystem %S/Inputs/nolintbeginend
  
  -class A { A(int i); };
  +class A { explicit A(int i); };
   //
  
   // NOLINTBEGIN
  @@ -27,7 +27,7 @@
  
   // NOLINTBEGIN
   // NOLINTEND
  -class B5 { B5(int i); };
  +class B5 { explicit B5(int i); };
   //
  
   // NOLINTBEGIN(google-explicit-constructor)
  @@ -39,7 +39,7 @@
   // NOLINTEND(*)
  
   // NOLINTBEGIN(some-other-check)
  -class C3 { C3(int i); };
  +class C3 { explicit C3(int i); };
   //
   // NOLINTEND(some-other-check)
  
  @@ -54,7 +54,7 @@
  
   // NOLINTBEGIN(some-other-check, google-explicit-constructor)
   // NOLINTEND(google-explicit-constructor)
  -class C6 { C6(int i); };
  +class C6 { explicit C6(int i); };
   //
   // NOLINTEND(some-other-check)
  
  @@ -92,7 +92,7 @@
  
   #define MACRO(X) class X { X(int i); };
  
  -MACRO(D1)
  +MACRO(explicit D1)
   //
   //
  
  
  ------------------------------------------------------------------
  FileCheck failed:
  command line:1:22: error: CHECK-MESSAGES-NOT: excluded string found in input
  -implicit-check-not='{{warning|error}}:'
                       ^
  F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp.msg:2:122: note: found here
  F:\source\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/Inputs/nolintbeginend\error_in_include.inc:1:11: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
                                                                                                                           ^~~~~~~~
  
  Input file: F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp.msg
  Check file: F:\source\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure\nolintbeginend.cpp
  
  -dump-input=help explains the following input dump.
  
  Input was:
  <<<<<<
            1: 6 warnings generated.
            2: F:\source\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/Inputs/nolintbeginend\error_in_include.inc:1:11: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
  not:imp1                                                                                                                              !~~~~~~~                                                                                                                                 error: no match expected
            3: class G { G(int i); };
            4:  ^
            5: F:\source\llvm-project\llvm\out\build\x64-Debug\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\nolintbeginend.cpp.tmp.cpp:3:11: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
            6: class A { A(int i); };
            7:  ^
            .
            .
            .
  >>>>>>
  
  
  # command stderr:
  Traceback (most recent call last):
    File "F:\source\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 252, in <module>
      main()
    File "F:\source\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 248, in main
      run_test_once(args, extra_args)
    File "F:\source\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 183, in run_test_once
      subprocess.check_output(
    File "c:\program files\python39\lib\subprocess.py", line 424, in check_output
      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File "c:\program files\python39\lib\subprocess.py", line 528, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['FileCheck', '-input-file=F:\\source\\llvm-project\\llvm\\out\\build\\x64-Debug\\tools\\clang\\tools\\extra\\test\\clang-tidy\\infrastructure\\Output\\nolintbeginend.cpp.tmp.cpp.msg', 'F:\\source\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\infrastructure\\nolintbeginend.cpp', '-check-prefixes=CHECK-MESSAGES', '-implicit-check-not={{warning|error}}:']' returned non-zero exit status 1.
  
  error: command failed with exit status: 1
  
  --


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108560/new/

https://reviews.llvm.org/D108560



More information about the cfe-commits mailing list