Skip to content
Snippets Groups Projects
Commit 16ba0232 authored by Argyrios Kyrtzidis's avatar Argyrios Kyrtzidis
Browse files

[code-completion] Fix crash when trying to do postfix completion of instance...

[code-completion] Fix crash when trying to do postfix completion of instance member inside a static function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292052 91177308-0d34-0410-b5e6-96231b3b80d8
parent 67796b30
No related branches found
No related tags found
No related merge requests found
......@@ -1652,9 +1652,10 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
if (Tok.is(tok::code_completion)) {
// Code completion for a member access expression.
Actions.CodeCompleteMemberReferenceExpr(
getCurScope(), LHS.get(), OpLoc, OpKind == tok::arrow,
ExprStatementTokLoc == LHS.get()->getLocStart());
if (Expr *Base = LHS.get())
Actions.CodeCompleteMemberReferenceExpr(
getCurScope(), Base, OpLoc, OpKind == tok::arrow,
ExprStatementTokLoc == Base->getLocStart());
cutOffParsing();
return ExprError();
......
......@@ -27,6 +27,16 @@ public:
void test(const Proxy &p) {
p->
}
struct Test1 {
Base1 b;
static void sfunc() {
b. // expected-error {{invalid use of member 'b' in static member function}}
}
};
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: Base1 : Base1::
// CHECK-CC1: member1 : [#int#][#Base1::#]member1
......@@ -39,4 +49,6 @@ void test(const Proxy &p) {
// CHECK-CC1: memfun1 (Hidden) : [#void#]Base2::memfun1(<#int#>)
// CHECK-CC1: memfun2 : [#void#][#Base3::#]memfun2(<#int#>)
// CHECK-CC1: memfun3 : [#int#]memfun3(<#int#>)
// Make sure this doesn't crash
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:36:7 %s -verify
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment