[clang] [clang-tools-extra] Add code completion for C++20 keywords. (PR #107982)
    via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Fri Oct 11 06:32:44 PDT 2024
    
    
  
================
@@ -2186,6 +2197,45 @@ AddOrdinaryNameResults(SemaCodeCompletion::ParserCompletionContext CCC,
       } else {
         Results.AddResult(Result("template", CodeCompletionResult::RK_Keyword));
       }
+
+      if (SemaRef.getLangOpts().CPlusPlus20 &&
+          SemaRef.getLangOpts().CPlusPlusModules) {
+        // export
+        Results.AddResult(Result("export", CodeCompletionResult::RK_Keyword));
+
+        if (SemaRef.CurContext->isTranslationUnit()) {
----------------
16bit-ykiko wrote:
I push a new commit and try to make completion for module related keywords more context-sensitive. 
And found something strange: https://godbolt.org/z/YM9dhEKKe
```cpp
module;
export module M;
                ^
``` 
If I try to run code completion at `^`, only get a compiler error.
```
<source>:3:1: error: export declaration can only be used within a module purview
    3 | export mo<U+0000>dule M;
```
The error shouldn't occur, right?
https://github.com/llvm/llvm-project/pull/107982
    
    
More information about the cfe-commits
mailing list