[PATCH] D116294: [CodeCompletion] (mostly) fix completion in incomplete C++ ctor initializers.
    Kadir Cetinkaya via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Mon Jan 10 02:08:00 PST 2022
    
    
  
kadircet added inline comments.
================
Comment at: clang/lib/Parse/ParseCXXInlineMethods.cpp:153
+      // probably truncated, so don't eat more tokens.
+      if (!Toks.back().is(tok::code_completion))
+        SkipMalformedDecl();
----------------
i don't follow the logic here. maybe i am reading the comment wrong, but we are actually going to eat **more** tokens by calling `SkipMalformedDecl`, possibly the following one, right? for example in a scenario like:
```
struct Foo {
  Foo : ^b
  int bar;
}
```
`ConsumeAndStoreFunctionPrologue` will actually put `b` following the code completion token (`^`) into `Toks` as well, hence when we skip, we actually skip until the next semicolon and throw away bar. But when the code completion token is after `b`, `ConsumeAndStoreFunctionPrologue` we'll have code completion token at the end of the `Toks` and won't skip anything
 Do we have cases that break miserably when we don't perform an extra skip here for the (possible) reminder of current initalizer?
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116294/new/
https://reviews.llvm.org/D116294
    
    
More information about the cfe-commits
mailing list