summaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2019-01-31 20:20:32 +0000
committerIlya Biryukov <ibiryukov@google.com>2019-01-31 20:20:32 +0000
commitd60b3870985efd980894c42db7a6721c5ef04a07 (patch)
treec0e66ab30277e1559691e2686320a983121a6d14 /lib/Parse/ParseDecl.cpp
parenta87ff88c6466fbedd6281513b9480a2cad6c08c8 (diff)
downloadclang-d60b3870985efd980894c42db7a6721c5ef04a07.tar.gz
[CodeComplete] Propagate preferred types through parser in more cases
Preferred types are used by code completion for ranking. This commit considerably increases the number of points in code where those types are propagated. In order to avoid complicating signatures of Parser's methods, a preferred type is kept as a member variable in the parser and updated during parsing. Differential revision: https://reviews.llvm.org/D56723 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index bbead42f03..a3080e64b0 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -2293,7 +2293,8 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
return nullptr;
}
- ExprResult Init(ParseInitializer());
+ PreferredType.enterVariableInit(Tok.getLocation(), ThisDecl);
+ ExprResult Init = ParseInitializer();
// If this is the only decl in (possibly) range based for statement,
// our best guess is that the user meant ':' instead of '='.