[clang] Add code completion for C++20 keywords. (PR #107982)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 10 01:21:27 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 1c334debecd70bd28e61a36c40c3f96cf5467331 9a1a85c1c98a7e1826a3836028ddf7d37fdecd90 --extensions cpp -- clang/lib/Sema/SemaCodeComplete.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 4647d65430..3477604619 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -1838,7 +1838,7 @@ static void AddTypeSpecifierResults(const LangOptions &LangOpts,
       Results.AddResult(Result(Builder.TakeString()));
     }
 
-    if(LangOpts.CPlusPlus20){
+    if (LangOpts.CPlusPlus20) {
       Results.AddResult(Result("char8_t", CCP_Type));
     }
   } else
@@ -2265,8 +2265,9 @@ AddOrdinaryNameResults(SemaCodeCompletion::ParserCompletionContext CCC,
     [[fallthrough]];
 
   case SemaCodeCompletion::PCC_Template:
-    if (SemaRef.getLangOpts().CPlusPlus20 && CCC == SemaCodeCompletion::PCC_Template)
-        Results.AddResult(Result("concept", CCP_Keyword));
+    if (SemaRef.getLangOpts().CPlusPlus20 &&
+        CCC == SemaCodeCompletion::PCC_Template)
+      Results.AddResult(Result("concept", CCP_Keyword));
     [[fallthrough]];
 
   case SemaCodeCompletion::PCC_MemberTemplate:
@@ -2281,8 +2282,9 @@ AddOrdinaryNameResults(SemaCodeCompletion::ParserCompletionContext CCC,
       Results.AddResult(Result("template", CodeCompletionResult::RK_Keyword));
     }
 
-    if(SemaRef.getLangOpts().CPlusPlus20 && 
-      (CCC == SemaCodeCompletion::PCC_Template || CCC == SemaCodeCompletion::PCC_MemberTemplate)) {
+    if (SemaRef.getLangOpts().CPlusPlus20 &&
+        (CCC == SemaCodeCompletion::PCC_Template ||
+         CCC == SemaCodeCompletion::PCC_MemberTemplate)) {
       Results.AddResult(Result("requires", CCP_Keyword));
     }
 
@@ -2766,7 +2768,7 @@ AddOrdinaryNameResults(SemaCodeCompletion::ParserCompletionContext CCC,
         Builder.AddChunk(CodeCompletionString::CK_RightBrace);
         Results.AddResult(Result(Builder.TakeString()));
 
-        if(llvm::isa<clang::RequiresExprBodyDecl>(SemaRef.CurContext)){
+        if (llvm::isa<clang::RequiresExprBodyDecl>(SemaRef.CurContext)) {
           // requires expression ;
           Builder.AddResultTypeChunk("");
           Builder.AddTypedTextChunk("requires");

``````````

</details>


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


More information about the cfe-commits mailing list