]> granicus.if.org Git - clang/commitdiff
Fix an assertion failure when code completing an auto variable's initialiser.
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 27 Jul 2012 12:56:09 +0000 (12:56 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Fri, 27 Jul 2012 12:56:09 +0000 (12:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160857 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/CodeCompletion/auto.cpp [new file with mode: 0644]

index b2a6b4bb41ffa86e45e5aee905d98bbe7bd395e3..ea514d3826821feac7c8762c111f5965cee8ce5f 100644 (file)
@@ -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/test/CodeCompletion/auto.cpp b/test/CodeCompletion/auto.cpp
new file mode 100644 (file)
index 0000000..1fc9fb0
--- /dev/null
@@ -0,0 +1,2 @@
+// RUN: %clang_cc1 -std=c++11 -code-completion-at=%s:2:9 %s
+auto i =