From 6b4fdc25d3b1c9d6cb3a1594589a4db12c0361a9 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 27 Jul 2012 12:56:09 +0000 Subject: [PATCH] Fix an assertion failure when code completing an auto variable's initialiser. llvm-svn: 160857 --- clang/lib/Parse/ParseDecl.cpp | 1 + clang/test/CodeCompletion/auto.cpp | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 clang/test/CodeCompletion/auto.cpp diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index b2a6b4bb41ff..ea514d382682 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -1580,6 +1580,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, if (Tok.is(tok::code_completion)) { Actions.CodeCompleteInitializer(getCurScope(), ThisDecl); + Actions.FinalizeDeclaration(ThisDecl); cutOffParsing(); return 0; } diff --git a/clang/test/CodeCompletion/auto.cpp b/clang/test/CodeCompletion/auto.cpp new file mode 100644 index 000000000000..1fc9fb035d47 --- /dev/null +++ b/clang/test/CodeCompletion/auto.cpp @@ -0,0 +1,2 @@ +// RUN: %clang_cc1 -std=c++11 -code-completion-at=%s:2:9 %s +auto i =