[PATCH] D55648: [CodeComplete] Fill preferred type on binary expressions

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 13 05:54:07 PST 2018


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

It seems like we have some assumptions about what people might be trying to do in most of the cases, but i think it is OK since this never performs worse than the older version.



================
Comment at: lib/Parse/ParseExpr.cpp:396
 
     // Code completion for the right-hand side of an assignment expression
     // goes through a special hook that takes the left-hand side into account.
----------------
maybe update the comment as well to reflect it is not only for assignments.


================
Comment at: lib/Sema/SemaCodeComplete.cpp:4928
+    if (LHSType->isIntegralOrEnumerationType())
+      return S.getASTContext().IntTy;
+    return QualType();
----------------
why not LHSType ?


================
Comment at: lib/Sema/SemaCodeComplete.cpp:4935
+    return S.getASTContext().BoolTy;
+  case tok::pipe:
+  case tok::pipeequal:
----------------
maybe also state the assumption for bitwise operators, or maybe just move to right after shift operators


================
Comment at: unittests/Sema/CodeCompleteTest.cpp:295
+    void test(Cls c) {
+      // we assume arithmetic and comparions ops take the same time.
+      c + ^c; c - ^c; c * ^c; c / ^c; c % ^c;
----------------
s/time/type/ ?


Repository:
  rC Clang

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

https://reviews.llvm.org/D55648





More information about the cfe-commits mailing list