[PATCH] D51038: [clangd] Make sure codecompletion is called for calls even when inside a token.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 21 07:57:51 PDT 2018


kadircet created this revision.
kadircet added reviewers: ilya-biryukov, ioeric, hokein.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay.

Currently CodeCompleteCall only gets called after a comma or parantheses. This
patch makes sure it is called even at the cases like:

  foo(1^);


Repository:
  rC Clang

https://reviews.llvm.org/D51038

Files:
  include/clang/Parse/Parser.h
  lib/Parse/ParseExpr.cpp


Index: lib/Parse/ParseExpr.cpp
===================================================================
--- lib/Parse/ParseExpr.cpp
+++ lib/Parse/ParseExpr.cpp
@@ -1648,6 +1648,10 @@
                 Actions.CodeCompleteCall(getCurScope(), LHS.get(), ArgExprs);
              })) {
             (void)Actions.CorrectDelayedTyposInExpr(LHS);
+            if (PP.isCodeCompletionReached() && !CalledOverloadCompletion) {
+              Actions.CodeCompleteCall(getCurScope(), LHS.get(), ArgExprs);
+              CalledOverloadCompletion = true;
+            }
             LHS = ExprError();
           } else if (LHS.isInvalid()) {
             for (auto &E : ArgExprs)
@@ -2813,6 +2817,7 @@
         Completer();
       else
         Actions.CodeCompleteOrdinaryName(getCurScope(), Sema::PCC_Expression);
+      CalledOverloadCompletion = true;
       cutOffParsing();
       return true;
     }
Index: include/clang/Parse/Parser.h
===================================================================
--- include/clang/Parse/Parser.h
+++ include/clang/Parse/Parser.h
@@ -2965,6 +2965,10 @@
   void CodeCompleteMacroArgument(IdentifierInfo *Macro, MacroInfo *MacroInfo,
                                  unsigned ArgumentIndex) override;
   void CodeCompleteNaturalLanguage() override;
+
+  /// Gets set to true after calling CodeCompleteCall, it is for a hack to make
+  /// signature help working even when it is triggered inside a token.
+  bool CalledOverloadCompletion = false;
 };
 
 }  // end namespace clang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51038.161724.patch
Type: text/x-patch
Size: 1510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180821/f6dc9544/attachment.bin>


More information about the cfe-commits mailing list