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

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 10 03:56:29 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: lib/Parse/ParseExpr.cpp:1663
         if (Tok.isNot(tok::r_paren)) {
-          if (ParseExpressionList(ArgExprs, CommaLocs, [&] {
-                QualType PreferredType = Actions.ProduceCallSignatureHelp(
-                    getCurScope(), LHS.get(), ArgExprs, PT.getOpenLocation());
-                Actions.CodeCompleteExpression(getCurScope(), PreferredType);
-              })) {
+          auto Completer = [&]() {
+            QualType PreferredType = Actions.ProduceCallSignatureHelp(
----------------
NIT: inline completer.


================
Comment at: lib/Parse/ParseExpr.cpp:1663
         if (Tok.isNot(tok::r_paren)) {
-          if (ParseExpressionList(ArgExprs, CommaLocs, [&] {
-                QualType PreferredType = Actions.ProduceCallSignatureHelp(
-                    getCurScope(), LHS.get(), ArgExprs, PT.getOpenLocation());
-                Actions.CodeCompleteExpression(getCurScope(), PreferredType);
-              })) {
+          auto Completer = [&]() {
+            QualType PreferredType = Actions.ProduceCallSignatureHelp(
----------------
ilya-biryukov wrote:
> NIT: inline completer.
Maybe inline this into lambda body again?
Now that it's not called outside it, we don't need a variable anymore.


================
Comment at: lib/Parse/ParseExprCXX.cpp:2827
     if (Tok.isNot(tok::r_paren)) {
+      ParsedType TypeRep =
+          Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
----------------
ActOnTypeName is called at a different point now, please move it back into the lambda.


================
Comment at: lib/Parse/ParseExprCXX.cpp:2830
       CommaLocsTy CommaLocs;
-      if (ParseExpressionList(ConstructorArgs, CommaLocs, [&] {
-            ParsedType TypeRep = Actions.ActOnTypeName(getCurScope(),
-                                                       DeclaratorInfo).get();
-            QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
-                getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
-                DeclaratorInfo.getEndLoc(), ConstructorArgs, ConstructorLParen);
-            Actions.CodeCompleteExpression(getCurScope(), PreferredType);
-      })) {
+      auto Completer = [&]() {
+        QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
----------------
Same here: maybe inline the lambda into the call to keep the changes minimal?


================
Comment at: lib/Parse/ParseOpenMP.cpp:419
     SourceLocation LParLoc = T.getOpenLocation();
-    if (ParseExpressionList(
-            Exprs, CommaLocs, [this, OmpPrivParm, LParLoc, &Exprs] {
-              QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
-                  getCurScope(),
-                  OmpPrivParm->getType()->getCanonicalTypeInternal(),
-                  OmpPrivParm->getLocation(), Exprs, LParLoc);
-              Actions.CodeCompleteExpression(getCurScope(), PreferredType);
-            })) {
+    auto Completer = [this, OmpPrivParm, LParLoc, &Exprs]() {
+      QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
----------------
Same here: maybe inline the lambda?


Repository:
  rC Clang

https://reviews.llvm.org/D51038





More information about the cfe-commits mailing list