[PATCH] D55331: [CodeComplete] Fix assertion failure

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 7 05:20:56 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL348590: [CodeComplete] Fix assertion failure (authored by ibiryukov, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55331?vs=176836&id=177187#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D55331

Files:
  cfe/trunk/lib/Sema/SemaOverload.cpp
  cfe/trunk/test/CodeCompletion/signatures-crash.cpp


Index: cfe/trunk/lib/Sema/SemaOverload.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp
+++ cfe/trunk/lib/Sema/SemaOverload.cpp
@@ -6429,7 +6429,12 @@
         if (Expr *E = Args[0]) {
           // Use the explicit base to restrict the lookup:
           ObjectType = E->getType();
-          ObjectClassification = E->Classify(Context);
+          // Pointers in the object arguments are implicitly dereferenced, so we
+          // always classify them as l-values.
+          if (!ObjectType.isNull() && ObjectType->isPointerType())
+            ObjectClassification = Expr::Classification::makeSimpleLValue();
+          else
+            ObjectClassification = E->Classify(Context);
         } // .. else there is an implicit base.
         FunctionArgs = Args.slice(1);
       }
Index: cfe/trunk/test/CodeCompletion/signatures-crash.cpp
===================================================================
--- cfe/trunk/test/CodeCompletion/signatures-crash.cpp
+++ cfe/trunk/test/CodeCompletion/signatures-crash.cpp
@@ -0,0 +1,15 @@
+struct map {
+  void find(int);
+  void find();
+};
+
+int main() {
+  map *m;
+  m->find(10);
+  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:8:11 %s -o - | FileCheck %s
+  // CHECK: OVERLOAD: [#void#]find(<#int#>)
+
+  // Also check when the lhs is an explicit pr-value.
+  (m+0)->find(10);
+  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:15 %s -o - | FileCheck %s
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55331.177187.patch
Type: text/x-patch
Size: 1498 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181207/44fefc58/attachment.bin>


More information about the llvm-commits mailing list