[clang] [clang][CodeComplete] Add code completion for if constexpr and consteval (PR #124315)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 8 21:26:50 PST 2025


================
@@ -1553,6 +1553,13 @@ StmtResult Parser::ParseIfStatement(SourceLocation *TrailingElseLoc) {
       IsConsteval = true;
       ConstevalLoc = ConsumeToken();
     }
+
+    if (Tok.is(tok::code_completion)) {
----------------
HighCommander4 wrote:

This needs to go in an `else` after the `Tok.is(tok::kw_consteval)`. Otherwise, if you invoke completion **after** `consteval`, e.g.:

`if consteval ^` <-- here

then you incorrectly get `constexpr` and `consteval` suggested.

https://github.com/llvm/llvm-project/pull/124315


More information about the cfe-commits mailing list