aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Module.cpp
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2021-12-27 04:08:01 +0100
committerSam McCall <sam.mccall@gmail.com>2022-01-13 08:06:35 +0100
commitd8716cd7d31c64a6aaa25d43569f1c00e553ab43 (patch)
treef0fdf24262070e3329ff53b3c1aa4806501f7c0a /llvm/lib/IR/Module.cpp
parentcb7f806a3a74578afbb808aa71a19ec66d687c9f (diff)
downloadllvm-d8716cd7d31c64a6aaa25d43569f1c00e553ab43.zip
llvm-d8716cd7d31c64a6aaa25d43569f1c00e553ab43.tar.gz
llvm-d8716cd7d31c64a6aaa25d43569f1c00e553ab43.tar.bz2
[CodeCompletion] (mostly) fix completion in incomplete C++ ctor initializers.
C++ member function bodies (including ctor initializers) are first captured into a buffer and then parsed after the class is complete. (This allows members to be referenced even if declared later). When the boundary of the function body cannot be established, its buffer is discarded and late-parsing never happens (it would surely fail). For code completion this is the wrong tradeoff: the point of the parse is to generate completions as a side-effect. Today, when the ctor body wasn't typed yet there are no init list completions. With this patch we parse such an init-list if it contains the completion point. There's one caveat: the parser has to decide where to resume parsing members after a broken init list. Often the first clear recovery point is *after* the next member, so that member is missing from completion/signature help etc. e.g. struct S { S() m //<- completion here int maaa; int mbbb; } Here "int maaa;" is treated as part of the init list, so "maaa" is not available as a completion. Maybe in future indentation can be used to recognize that this is a separate member, not part of the init list. Differential Revision: https://reviews.llvm.org/D116294
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
0 files changed, 0 insertions, 0 deletions