clang/test/CodeCompletion
Olivier Goffart 7eeb47943e Fix heuristics skipping invalid ctor-initializers with C++11
Use better heuristics to detect if a '{' might be the start of the constructor body
or not. Especially when there is a completion token.

Fix the test 'test/CodeCompletion/ctor-initializer.cpp ' when clang defaults to c++11

The problem was is how we recover invalid code in the ctor-init part as we skip the
function body. In particular, we want to know if a '{' is the begining of the body.
In C++03, we always consider it as the beginng of the body. The problem was that in
C++11, it may be the start of an initializer, so we skip over it, causing further
parse errors later. (It is important that we are able to parse correctly the rest
of the class definition, to know what are the class member, for example)

This commit is improving the heuristics to decide if the '{' is starting a function
body. The rules are the following: If we are not in a template argument, and that the
previous tokens are not an identifier, or a >, then it is much more likely to be the
function body. We verify that further by checking the token after the matching '}'

The commit also fix the behavior when there is a code_completion token in the
ctor-initializers.

Differential Revision: https://reviews.llvm.org/D21502

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285883 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-03 07:36:17 +00:00
..
Inputs [CodeCompletion] Allow system headers providing private symbols with a single underscore. 2016-07-01 01:17:02 +00:00
PR9728.cpp Fix an assertion when code-completing, rdar://9288730 & http://llvm.org/PR9728. 2011-04-23 01:04:12 +00:00
auto.cpp Fix an assertion failure when code completing an auto variable's initialiser. 2012-07-27 12:56:09 +00:00
bracket-decl.c [Parse] Code complete expressions in bracket declarators. 2016-02-18 15:30:24 +00:00
call.c Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
call.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
constexpr.cpp PR14381: Never skip constexpr function bodies when code-completing. We may need 2012-11-19 21:13:18 +00:00
ctor-initializer.cpp Fix heuristics skipping invalid ctor-initializers with C++11 2016-11-03 07:36:17 +00:00
documentation.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
documentation.m Fix ObjCMethodDecl::findPropertyDecl for class properties. 2016-03-11 21:14:40 +00:00
enum-switch-case-qualified.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
enum-switch-case.c Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
enum-switch-case.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
function-templates.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
functions.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
macros-in-modules.c Fix code completion tests to use an explicit modules cache path 2015-07-20 21:22:46 +00:00
macros-in-modules.m Fix code completion tests to use an explicit modules cache path 2015-07-20 21:22:46 +00:00
macros.c Macro history (de-)serialization. Deserialization currently reads only the latest macro definition. Needs more work. 2012-09-25 17:18:14 +00:00
member-access.c Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
member-access.cpp Improve the sorting of code-completion results. We now always sort by 2010-01-13 23:24:38 +00:00
namespace-alias.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
namespace.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
nested-name-specifier.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
objc-expr.m Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
objc-message.m Improve the sorting of code-completion results. We now always sort by 2010-01-13 23:24:38 +00:00
objc-message.mm Implement filtering for code completion of identifiers. 2016-07-27 14:56:59 +00:00
objc-protocol-member-access.m [CodeCompletion] Show protocol properties that are accessed through qualified id 2016-10-12 11:40:15 +00:00
operator.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
ordinary-name-cxx11.cpp [Tests] Modified Lit Tests to be C++11 compatibile 2015-08-27 18:49:15 +00:00
ordinary-name.c [CodeCompletion] Allow system headers providing private symbols with a single underscore. 2016-07-01 01:17:02 +00:00
ordinary-name.cpp [Tests] Modified Lit Tests to be C++11 compatibile 2015-08-27 18:49:15 +00:00
pch-and-module.m Fix CodeCompletion & TypoCorrection when combining a PCH with Modules 2016-05-04 00:53:13 +00:00
preamble.c [libclang] Remove the ParentKind cursor kind from code-completion results. 2012-09-26 16:39:56 +00:00
some_struct.h Implement the all_lookups_iterator for PCH as a follow-up to r153970. This 2012-04-16 02:51:46 +00:00
stdin.c Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
tag.c Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
tag.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
templates.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
truncation.c Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
truncation.c.h Replace the -code-completion-dump option with 2009-09-22 21:11:38 +00:00
using-namespace.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00
using.cpp Fix FileCheck --check-prefix lines. 2013-08-12 12:51:05 +00:00