Commit 4fe1712e 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.
------------------------------------------------------------------------

llvm-svn: 292313
parent 481bb249
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1652,9 +1652,10 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {

      if (Tok.is(tok::code_completion)) {
        // Code completion for a member access expression.
        if (Expr *Base = LHS.get())
          Actions.CodeCompleteMemberReferenceExpr(
            getCurScope(), LHS.get(), OpLoc, OpKind == tok::arrow,
            ExprStatementTokLoc == LHS.get()->getLocStart());
              getCurScope(), Base, OpLoc, OpKind == tok::arrow,
              ExprStatementTokLoc == Base->getLocStart());

        cutOffParsing();
        return ExprError();
+13 −1
Original line number Diff line number Diff line
@@ -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
@@ -40,3 +50,5 @@ void test(const Proxy &p) {
  // 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