[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:51 PST 2025


================
@@ -6749,6 +6749,21 @@ void SemaCodeCompletion::CodeCompleteInitializer(Scope *S, Decl *D) {
   CodeCompleteExpression(S, Data);
 }
 
+void SemaCodeCompletion::CodeCompleteIfConstExpr(Scope *S) const {
+  ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
+                        CodeCompleter->getCodeCompletionTUInfo(),
+                        CodeCompletionContext::CCC_SymbolOrNewName);
+  Results.EnterNewScope();
----------------
HighCommander4 wrote:

I agree with @zyn0217. I looked at what `EnterNewScope()` does and it seems to be related to names/declarations, and thus not applicable if all the results we add are keywords or patterns with no associated declarations.

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


More information about the cfe-commits mailing list