[PATCH] D59977: [Lexer] Fix an off-by-one bug in Lexer::getAsCharRange() - NFC.

Artem Dergachev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 15:55:27 PDT 2019


NoQ added a comment.

Namely, http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/46376 :

  Running ['clang-tidy', '/home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp', '-fix', '--checks=-*,google-readability-namespace-comments', '--', '--std=c++11', '-nostdinc++']...
  ------------------------ clang-tidy output -----------------------
  3 warnings generated.
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp:14:2: warning: namespace 'n3' not terminated with a closing comment [google-readability-namespace-comments]
  }}
   ^
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp:14:2: note: FIX-IT applied suggested code changes
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp:4:11: note: namespace 'n3' starts here
  namespace n3 {
            ^
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp:14:3: warning: namespace 'n1::n2 {' not terminated with a closing comment [google-readability-namespace-comments]
  }}
    ^
      // namespace n1::n2 {
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp:14:3: note: FIX-IT applied suggested code changes
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp:3:11: note: namespace 'n1::n2 {' starts here
  namespace n1::n2 {
            ^
  clang-tidy applied 2 of 2 suggested fixes.
  Suppressed 1 warnings (1 with check filters).
  
  ------------------------------------------------------------------
  ------------------------------ Fixes -----------------------------
  --- /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp.orig	2019-04-05 15:03:02.741836756 -0700
  +++ /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp	2019-04-05 15:03:02.753836825 -0700
  @@ -11,7 +11,8 @@
   //
   //
   //
  -}}
  +}  // namespace n3
  +}  // namespace n1::n2 {
   //
   //
   
  
  ------------------------------------------------------------------
  FileCheck failed:
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/test/clang-tidy/google-readability-nested-namespace-comments.cpp:12:20: error: CHECK-MESSAGES: expected string not found in input
  // CHECK-MESSAGES: :[[@LINE+2]]:3: warning: namespace 'n1::n2' not terminated with a closing comment [google-readability-namespace-comments]
                     ^
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp.msg:7:1: note: scanning from here
  namespace n3 {
  ^
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp.msg:7:1: note: with expression "@LINE+2" equal to "14"
  namespace n3 {
  ^
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp.msg:9:191: note: possible intended match here
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.obj/tools/clang/tools/extra/test/clang-tidy/Output/google-readability-nested-namespace-comments.cpp.tmp.cpp:14:3: warning: namespace 'n1::n2 {' not terminated with a closing comment [google-readability-namespace-comments]



  FAIL: Extra Tools Unit Tests :: clangd/./ClangdTests/SelectionTest.CommonAncestor (19592 of 48320)
  ******************** TEST 'Extra Tools Unit Tests :: clangd/./ClangdTests/SelectionTest.CommonAncestor' FAILED ********************
  Note: Google Test filter = SelectionTest.CommonAncestor
  [==========] Running 1 test from 1 test case.
  [----------] Global test environment set-up.
  [----------] 1 test from SelectionTest
  [ RUN      ] SelectionTest.CommonAncestor
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 2:25-2:29
  To be equal to: Test.range()
        Which is: 2:25-2:28
  
              struct AAA { struct BBB { static int ccc(); };};
              int x = AAA::[[B^B^B]]::ccc();
            
  TranslationUnitDecl 
    VarDecl int x = AAA::BBB::ccc()
      CallExpr AAA::BBB::ccc()
        ImplicitCastExpr AAA::BBB::ccc
          DeclRefExpr AAA::BBB::ccc
           .TypeLoc AAA::BBB
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 2:25-2:29
  To be equal to: Test.range()
        Which is: 2:25-2:28
  
              struct AAA { struct BBB { static int ccc(); };};
              int x = AAA::[[B^BB^]]::ccc();
            
  TranslationUnitDecl 
    VarDecl int x = AAA::BBB::ccc()
      CallExpr AAA::BBB::ccc()
        ImplicitCastExpr AAA::BBB::ccc
          DeclRefExpr AAA::BBB::ccc
           .TypeLoc AAA::BBB
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 2:20-2:34
  To be equal to: Test.range()
        Which is: 2:20-2:33
  
              struct AAA { struct BBB { static int ccc(); };};
              int x = [[AAA::BBB::c^c^c]]();
            
  TranslationUnitDecl 
    VarDecl int x = AAA::BBB::ccc()
      CallExpr AAA::BBB::ccc()
        ImplicitCastExpr AAA::BBB::ccc
         .DeclRefExpr AAA::BBB::ccc
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 2:20-2:36
  To be equal to: Test.range()
        Which is: 2:20-2:35
  
              struct AAA { struct BBB { static int ccc(); };};
              int x = [[AAA::BBB::cc^c(^)]];
            
  TranslationUnitDecl 
    VarDecl int x = AAA::BBB::ccc()
     .CallExpr AAA::BBB::ccc()
        ImplicitCastExpr AAA::BBB::ccc
         .DeclRefExpr AAA::BBB::ccc
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 1:25-1:55
  To be equal to: Test.range()
        Which is: 1:25-1:54
  
              void foo() { [[if (1^11) { return; } else {^ }]] }
            
  TranslationUnitDecl 
    FunctionDecl void foo()
      CompoundStmt {
      if (111) {
          return;
      } else {
      }
  }
  
       .IfStmt if (111) {
      return;
  } else {
  }
  
          ImplicitCastExpr 111
           .IntegerLiteral 111
         *CompoundStmt {
      return;
  }
  
           *ReturnStmt return;
  
         .CompoundStmt {
  }
  
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 3:39-3:43
  To be equal to: Test.range()
        Which is: 3:39-3:42
  
              void foo();
              #define CALL_FUNCTION(X) X()
              void bar() { CALL_FUNCTION([[f^o^o]]); }
            
  TranslationUnitDecl 
    FunctionDecl void bar()
      CompoundStmt {
      foo();
  }
  
        CallExpr foo()
          ImplicitCastExpr foo
           .DeclRefExpr foo
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 3:39-3:43
  To be equal to: Test.range()
        Which is: 3:39-3:42
  
              void foo();
              #define CALL_FUNCTION(X) X()
              void bar() { CALL_FUNC^TION([[fo^o]]); }
            
  TranslationUnitDecl 
    FunctionDecl void bar()
      CompoundStmt {
      foo();
  }
  
        CallExpr foo()
          ImplicitCastExpr foo
           .DeclRefExpr foo
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 3:23-4:0
  To be equal to: Test.range()
        Which is: 3:23-3:46
  
              void foo();
              #define CALL_FUNCTION(X) X()
              void bar() [[{ C^ALL_FUNC^TION(foo); }]]
            
  TranslationUnitDecl 
    FunctionDecl void bar()
     .CompoundStmt {
      foo();
  }
  
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 0:13-0:17
  To be equal to: Test.range()
        Which is: 0:13-0:16
  void foo() { [[^foo]](); }
  TranslationUnitDecl 
    FunctionDecl void foo()
      CompoundStmt {
      foo();
  }
  
        CallExpr foo()
          ImplicitCastExpr foo
           .DeclRefExpr foo
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 0:13-0:17
  To be equal to: Test.range()
        Which is: 0:13-0:16
  void foo() { [[f^oo]](); }
  TranslationUnitDecl 
    FunctionDecl void foo()
      CompoundStmt {
      foo();
  }
  
        CallExpr foo()
          ImplicitCastExpr foo
           .DeclRefExpr foo
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 0:13-0:17
  To be equal to: Test.range()
        Which is: 0:13-0:16
  void foo() { [[fo^o]](); }
  TranslationUnitDecl 
    FunctionDecl void foo()
      CompoundStmt {
      foo();
  }
  
        CallExpr foo()
          ImplicitCastExpr foo
           .DeclRefExpr foo
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 0:13-0:19
  To be equal to: Test.range()
        Which is: 0:13-0:18
  void foo() { [[foo^()]]; }
  TranslationUnitDecl 
    FunctionDecl void foo()
      CompoundStmt {
      foo();
  }
  
       .CallExpr foo()
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 0:13-0:17
  To be equal to: Test.range()
        Which is: 0:13-0:16
  void foo() { [[foo^]] (); }
  TranslationUnitDecl 
    FunctionDecl void foo()
      CompoundStmt {
      foo();
  }
  
        CallExpr foo()
          ImplicitCastExpr foo
           .DeclRefExpr foo
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 0:0-0:5
  To be equal to: Test.range()
        Which is: 0:0-0:4
  [[^void]] foo();
  TranslationUnitDecl 
    FunctionDecl void foo()
      TypeLoc void ()
       .TypeLoc void
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 0:13-0:17
  To be equal to: Test.range()
        Which is: 0:13-0:16
  void foo() { [[foo^^]] (); }
  TranslationUnitDecl 
    FunctionDecl void foo()
      CompoundStmt {
      foo();
  }
  
        CallExpr foo()
          ImplicitCastExpr foo
           .DeclRefExpr foo
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 0:35-0:37
  To be equal to: Test.range()
        Which is: 0:35-0:36
  template <typename T> void foo() { [[^T]] t; }
  TranslationUnitDecl 
    FunctionTemplateDecl template <typename T> void foo()
      FunctionDecl void foo()
        CompoundStmt {
      T t;
  }
  
          DeclStmt T t;
  
            VarDecl T t
             *TypeLoc T
  
  /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/tools/clang/tools/extra/unittests/clangd/SelectionTests.cpp:207: Failure
        Expected: nodeRange(T.commonAncestor(), AST)
        Which is: 2:22-2:61
  To be equal to: Test.range()
        Which is: 2:22-2:60
  
              template <class T> struct Foo {};
              template <[[template<class> class /*cursor here*/^U]]>
               struct Foo<U<int>*> {};
            
  TranslationUnitDecl 
    ClassTemplatePartialSpecializationDecl template <template <class > class U> struct Foo<<int> *> {}
     .TemplateTemplateParmDecl template <class > class U
  
  [  FAILED  ] SelectionTest.CommonAncestor (258 ms)
  [----------] 1 test from SelectionTest (258 ms total)
  
  [----------] Global test environment tear-down
  [==========] 1 test from 1 test case ran. (258 ms total)
  [  PASSED  ] 0 tests.
  [  FAILED  ] 1 test, listed below:
  [  FAILED  ] SelectionTest.CommonAncestor
  
   1 FAILED TEST
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209728 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209728 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209728 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209728 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209728 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209728 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209728 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209728 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209728 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209712 for file /clangd-test/TestTU.cpp
  Preamble for file /clangd-test/TestTU.cpp cannot be reused. Attempting to rebuild it.
  Built preamble of size 209728 for file /clangd-test/TestTU.cpp
  
  ********************



  Failing Tests (3):
      Clang Tools :: clang-tidy/google-readability-nested-namespace-comments.cpp
      Extra Tools Unit Tests :: clangd/./ClangdTests/SelectionTest.CommonAncestor
      Extra Tools Unit Tests :: clangd/./ClangdTests/SelectionTest.Selected

(also clangd tests; and they seem to be manually adding +1 as a workaround)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D59977





More information about the llvm-commits mailing list