Commit 1f645f83 authored by Hans Wennborg's avatar Hans Wennborg
Browse files

Merging r292052:

------------------------------------------------------------------------
r292052 | akirtzidis | 2017-01-14 22:11:04 -0800 (Sat, 14 Jan 2017) | 1 line

[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/branches/release_40@292313 91177308-0d34-0410-b5e6-96231b3b80d8
parent 8396c5b8
......@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment