This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by NoQ on Mar 28 2019, 7:09 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

NoQ created this revision.Mar 28 2019, 7:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2019, 7:09 PM
NoQ added a comment.Apr 4 2019, 12:51 PM

I guess i'll commit, given that i don't know anybody else who uses these functions anyway.

This revision was not accepted when it landed; it landed in state Needs Review.Apr 5 2019, 2:47 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2019, 2:47 PM
NoQ reopened this revision.Apr 5 2019, 3:47 PM
NoQ added a reviewer: alexfh.

Reverted in rC357827 because clang-tidy was using this function in some of its checks. I'll have a look at if it is also affected by the bug or was already using a workaround.

NoQ added a comment.Apr 5 2019, 3:54 PM

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)

alexfh added a comment.Apr 8 2019, 1:23 AM

It looks like there's a number of users of this function beyond what you've mentioned:
clang-tidy/readability/IsolateDeclarationCheck.cpp:210
clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp:43
clang-tidy/readability/NamespaceCommentCheck.cpp:106
clang/lib/ARCMigrate/PlistReporter.cpp:110
clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:192

Could you take a brief look at those as well?

cfe/trunk/include/clang/Basic/PlistSupport.h
134

What kind of backwards compatibility are you trying to achieve? Where would the version skew come from?

NoQ updated this revision to Diff 196145.EditedApr 22 2019, 3:53 PM

It looks like there's a number of users of this function beyond what you've mentioned:
clang-tidy/readability/IsolateDeclarationCheck.cpp:210

This one uses only char-ranges, not token-ranges, so it's unaffected by the change.

clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp:43

They're using this function for counting the number of ::s in a::b::c::...::l, and for them an off-by-one doesn't affect the answer.

clang-tidy/readability/NamespaceCommentCheck.cpp:106

Yup, that's one of the failing tests. They were expecting their CharSourceRange for x::y { (which starts with token x and ends with token {) to not include token {. I had to manually rtrim() it from the string. It sounds as if CharSourceRange is indeed supposed to be "inclusive" (include its last token), so the new behavior is correct:

229 /// The underlying SourceRange can either specify the starting/ending character
230 /// of the range, or it can specify the start of the range and the start of the
231 /// last token of the range (a "token range").  In the token range case, the
232 /// size of the last token must be measured to determine the actual end of the
233 /// range.
234 class CharSourceRange {

clang/lib/ARCMigrate/PlistReporter.cpp:110
clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:192

These are addressed all together by the hack in PlistSupport.h.


Also fixed SelectionTests; they were artificially adding 1 to the resulting range and i removed it.

I believe it should all work now.

alexfh accepted this revision.Apr 23 2019, 3:29 AM

LG with a comment.

clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp
110–111 ↗(On Diff #196145)

This all seems rather hacky. I believe, this will fail miserably when there are comments before the {. Can you leave a FIXME to rewrite this logic in terms of tokens instead?

This revision is now accepted and ready to land.Apr 23 2019, 3:29 AM
NoQ updated this revision to Diff 196310.Apr 23 2019, 1:14 PM
NoQ marked an inline comment as done.

Add comments that getAsCharRange() is in fact used often misused.

NoQ marked an inline comment as done.Apr 23 2019, 1:14 PM
NoQ added inline comments.
clang-tools-extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp
42 ↗(On Diff #196310)

Added a similar comment here because this also seems flaky.

NoQ marked an inline comment as done.Apr 23 2019, 1:16 PM
NoQ added inline comments.
clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp
110–111 ↗(On Diff #196145)

I wonder why did people have to do this in the first place. Like, isn't such information supposed to be available in the AST?

This revision was automatically updated to reflect the committed changes.