[clang-tools-extra] r349750 - [clangd] Don't miss the expected type in merge.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 20 05:05:46 PST 2018


Author: hokein
Date: Thu Dec 20 05:05:46 2018
New Revision: 349750

URL: http://llvm.org/viewvc/llvm-project?rev=349750&view=rev
Log:
[clangd] Don't miss the expected type in merge.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D55918

Modified:
    clang-tools-extra/trunk/clangd/index/Merge.cpp
    clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp

Modified: clang-tools-extra/trunk/clangd/index/Merge.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Merge.cpp?rev=349750&r1=349749&r2=349750&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/Merge.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/Merge.cpp Thu Dec 20 05:05:46 2018
@@ -134,6 +134,8 @@ Symbol mergeSymbol(const Symbol &L, cons
     S.Documentation = O.Documentation;
   if (S.ReturnType == "")
     S.ReturnType = O.ReturnType;
+  if (S.Type == "")
+    S.Type = O.Type;
   for (const auto &OI : O.IncludeHeaders) {
     bool Found = false;
     for (auto &SI : S.IncludeHeaders) {

Modified: clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp?rev=349750&r1=349749&r2=349750&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp Thu Dec 20 05:05:46 2018
@@ -219,6 +219,7 @@ TEST(MergeTest, Merge) {
   R.Documentation = "--doc--";
   L.Origin = SymbolOrigin::Dynamic;
   R.Origin = SymbolOrigin::Static;
+  R.Type = "expectedType";
 
   Symbol M = mergeSymbol(L, R);
   EXPECT_EQ(M.Name, "Foo");
@@ -227,6 +228,7 @@ TEST(MergeTest, Merge) {
   EXPECT_EQ(M.Signature, "()");
   EXPECT_EQ(M.CompletionSnippetSuffix, "{$1:0}");
   EXPECT_EQ(M.Documentation, "--doc--");
+  EXPECT_EQ(M.Type, "expectedType");
   EXPECT_EQ(M.Origin,
             SymbolOrigin::Dynamic | SymbolOrigin::Static | SymbolOrigin::Merge);
 }




More information about the cfe-commits mailing list