https://github.com/hbatagelo updated 
https://github.com/llvm/llvm-project/pull/203794

>From 2b0992291c76e54a28eefc34c5235f33924f4427 Mon Sep 17 00:00:00 2001
From: Harlen Batagelo <[email protected]>
Date: Sun, 14 Jun 2026 17:47:09 -0300
Subject: [PATCH 1/2] Fix parser crash on code completion in late-parsed
 methods

---
 clang/docs/ReleaseNotes.rst               |  1 +
 clang/lib/Parse/ParseCXXInlineMethods.cpp |  4 ++--
 clang/test/CodeCompletion/GH200879.cpp    | 10 ++++++++++
 3 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 clang/test/CodeCompletion/GH200879.cpp

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 7828135a6edbc..b90b0b24ef5e0 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -706,6 +706,7 @@ Bug Fixes in This Version
 - Clang no longer handles a `" q-char-sequence "` header name as a string 
literal (#GH132643).
 - Fixed an assertion when ``__attribute__((alloc_size))`` is used with an 
argument type wider than the target's pointer width. (#GH190445)
 - Fixed an assertion where we improperly handled implicit conversions to 
integral types from an atomic-type with a conversion function. (#GH201770)
+- Fixed assertion failures involving code completion with delayed default 
arguments and exception specifications. (#GH200879)
 
 Bug Fixes to Compiler Builtins
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp 
b/clang/lib/Parse/ParseCXXInlineMethods.cpp
index 6189c854e5fbf..24b6adc260a56 100644
--- a/clang/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp
@@ -421,7 +421,7 @@ void 
Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
       PP.EnterTokenStream(*Toks, true, /*IsReinject*/ true);
 
       // Consume the previously-pushed token.
-      ConsumeAnyToken();
+      ConsumeAnyToken(/*ConsumeCodeCompletionTok=*/true);
 
       // Consume the '='.
       assert(Tok.is(tok::equal) && "Default argument not starting with '='");
@@ -501,7 +501,7 @@ void 
Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
     PP.EnterTokenStream(*Toks, true, /*IsReinject*/true);
 
     // Consume the previously-pushed token.
-    ConsumeAnyToken();
+    ConsumeAnyToken(/*ConsumeCodeCompletionTok=*/true);
 
     // C++11 [expr.prim.general]p3:
     //   If a declaration declares a member function or member function
diff --git a/clang/test/CodeCompletion/GH200879.cpp 
b/clang/test/CodeCompletion/GH200879.cpp
new file mode 100644
index 0000000000000..62fa7cab03312
--- /dev/null
+++ b/clang/test/CodeCompletion/GH200879.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:2 %s
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:2 %s
+
+struct A {
+  A(int = 0);
+}/*invoke completion here*/;
+
+struct B {
+  B() noexcept(false);
+}/*invoke completion here*/;
\ No newline at end of file

>From b79d284115307a6e74e94d6512046305903c52cc Mon Sep 17 00:00:00 2001
From: Harlen Batagelo <[email protected]>
Date: Mon, 15 Jun 2026 15:52:53 -0300
Subject: [PATCH 2/2] Add newline

---
 clang/test/CodeCompletion/GH200879.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/CodeCompletion/GH200879.cpp 
b/clang/test/CodeCompletion/GH200879.cpp
index 62fa7cab03312..742b02456ede6 100644
--- a/clang/test/CodeCompletion/GH200879.cpp
+++ b/clang/test/CodeCompletion/GH200879.cpp
@@ -7,4 +7,4 @@ struct A {
 
 struct B {
   B() noexcept(false);
-}/*invoke completion here*/;
\ No newline at end of file
+}/*invoke completion here*/;

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to