summaryrefslogtreecommitdiffstats
path: root/clang/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
commit4f9543b4d6152a5ee574246a645c7a3ec1db2c4f (patch)
tree30f0dd5daaa87f4663c6637e9b22140357937b59 /clang/lib/Parse/ParseDecl.cpp
parent240a90a57e3f313914dfb08c881fe7b079137c84 (diff)
downloadbcm5719-llvm-4f9543b4d6152a5ee574246a645c7a3ec1db2c4f.tar.gz
bcm5719-llvm-4f9543b4d6152a5ee574246a645c7a3ec1db2c4f.zip
[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 llvm-svn: 352788
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index bbead42f031..a3080e64b00 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/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 '='.
OpenPOWER on IntegriCloud