[PATCH] D68020: [clangd] Fix parseNamespaceEvents to parse the last token

Kadir Cetinkaya via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 07:10:23 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372875: [clangd] Fix parseNamespaceEvents to parse the last token (authored by kadircet, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D68020?vs=221759&id=221760#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D68020

Files:
  clang-tools-extra/trunk/clangd/SourceCode.cpp
  clang-tools-extra/trunk/clangd/unittests/SourceCodeTests.cpp


Index: clang-tools-extra/trunk/clangd/SourceCode.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/SourceCode.cpp
+++ clang-tools-extra/trunk/clangd/SourceCode.cpp
@@ -659,6 +659,9 @@
 
   while (!Lex.LexFromRawLexer(Tok))
     A(Tok);
+  // LexFromRawLexer returns true after it lexes last token, so we still have
+  // one more token to report.
+  A(Tok);
 }
 
 llvm::StringMap<unsigned> collectIdentifiers(llvm::StringRef Content,
Index: clang-tools-extra/trunk/clangd/unittests/SourceCodeTests.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/unittests/SourceCodeTests.cpp
+++ clang-tools-extra/trunk/clangd/unittests/SourceCodeTests.cpp
@@ -441,6 +441,16 @@
               "c::d",
           },
       },
+      {
+          "",
+          {""},
+      },
+      {
+          R"cpp(
+            // Parse until EOF
+            namespace bar{})cpp",
+          {""},
+      },
   };
   for (const auto& Case : Cases) {
     EXPECT_EQ(Case.second,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68020.221760.patch
Type: text/x-patch
Size: 1067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190925/0dd3fb6c/attachment.bin>


More information about the llvm-commits mailing list