Skip to content

[Sema][clangd] add noexcept to override functions during code completion #75937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2025

Conversation

Lancern
Copy link
Member

@Lancern Lancern commented Dec 19, 2023

If a virtual function is declared with noexcept, functions that override this function in the derived classes must be declared with noexcept as well. This PR updates code completion in clang Sema. It adds noexcept specifier to override functions in the code completion result if the functions override a noexcept virtual function.

@llvmbot llvmbot added clang Clang issues not falling into any other category clangd clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Dec 19, 2023
@llvmbot
Copy link
Member

llvmbot commented Dec 19, 2023

@llvm/pr-subscribers-clangd

Author: Sirui Mu (Lancern)

Changes

If a virtual function is declared with noexcept, functions that override this function in the derived classes must be declared with noexcept as well. This PR updates code completion in clang Sema. It adds noexcept specifier to override functions in the code completion result if the functions override a noexcept virtual function.


Full diff: https://github.com/llvm/llvm-project/pull/75937.diff

2 Files Affected:

  • (added) clang-tools-extra/clangd/test/completion-override-except-spec.test (+69)
  • (modified) clang/lib/Sema/SemaCodeComplete.cpp (+22)
diff --git a/clang-tools-extra/clangd/test/completion-override-except-spec.test b/clang-tools-extra/clangd/test/completion-override-except-spec.test
new file mode 100644
index 00000000000000..19c7f84bc679d8
--- /dev/null
+++ b/clang-tools-extra/clangd/test/completion-override-except-spec.test
@@ -0,0 +1,69 @@
+# RUN: clangd -lit-test < %s | FileCheck %s
+# RUN: clangd -lit-test -pch-storage=memory < %s | FileCheck %s
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
+---
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"struct Base {\n  virtual void virt_method() noexcept = 0;\n};\n\nstruct Derived : Base {\n  virt_\n};"}}}
+---
+{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":5,"character":6}}}
+#      CHECK:  "id": 1,
+# CHECK-NEXT:  "jsonrpc": "2.0",
+# CHECK-NEXT:  "result": {
+# CHECK-NEXT:    "isIncomplete": false,
+# CHECK-NEXT:    "items": [
+# CHECK-NEXT:      {
+# CHECK-NEXT:        "filterText": "virt_method() noexcept override",
+# CHECK-NEXT:        "insertText": "void virt_method() noexcept override",
+# CHECK-NEXT:        "insertTextFormat": 1,
+# CHECK-NEXT:        "kind": 2,
+# CHECK-NEXT:        "label": " void virt_method() noexcept override",
+# CHECK-NEXT:        "score": {{[0-9]+.[0-9]+}},
+# CHECK-NEXT:        "sortText": "{{.*}}virt_method() noexcept override",
+# CHECK-NEXT:        "textEdit": {
+# CHECK-NEXT:          "newText": "void virt_method() noexcept override",
+# CHECK-NEXT:          "range": {
+# CHECK-NEXT:            "end": {
+# CHECK-NEXT:              "character": 6,
+# CHECK-NEXT:              "line": 5
+# CHECK-NEXT:            },
+# CHECK-NEXT:            "start": {
+# CHECK-NEXT:              "character": 2,
+# CHECK-NEXT:              "line": 5
+# CHECK-NEXT:            }
+# CHECK-NEXT:          }
+# CHECK-NEXT:        }
+# CHECK-NEXT:      },
+---
+{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"test:///main.cpp","version":2},"contentChanges":[{"text":"struct Base {\n  virtual void virt_method() = 0;\n};\n\nstruct Derived : Base {\n  virt_\n};"}]}}
+---
+{"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":5,"character":6}}}
+#      CHECK:  "id": 3,
+# CHECK-NEXT:  "jsonrpc": "2.0",
+# CHECK-NEXT:  "result": {
+# CHECK-NEXT:    "isIncomplete": false,
+# CHECK-NEXT:    "items": [
+# CHECK-NEXT:      {
+# CHECK-NEXT:        "filterText": "virt_method() override",
+# CHECK-NEXT:        "insertText": "void virt_method() override",
+# CHECK-NEXT:        "insertTextFormat": 1,
+# CHECK-NEXT:        "kind": 2,
+# CHECK-NEXT:        "label": " void virt_method() override",
+# CHECK-NEXT:        "score": {{[0-9]+.[0-9]+}},
+# CHECK-NEXT:        "sortText": "{{.*}}virt_method() override",
+# CHECK-NEXT:        "textEdit": {
+# CHECK-NEXT:          "newText": "void virt_method() override",
+# CHECK-NEXT:          "range": {
+# CHECK-NEXT:            "end": {
+# CHECK-NEXT:              "character": 6,
+# CHECK-NEXT:              "line": 5
+# CHECK-NEXT:            },
+# CHECK-NEXT:            "start": {
+# CHECK-NEXT:              "character": 2,
+# CHECK-NEXT:              "line": 5
+# CHECK-NEXT:            }
+# CHECK-NEXT:          }
+# CHECK-NEXT:        }
+# CHECK-NEXT:      },
+---
+{"jsonrpc":"2.0","id":4,"method":"shutdown"}
+---
+{"jsonrpc":"2.0","method":"exit"}
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index c44be0df9b0a85..516936311a278d 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -25,6 +25,7 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/AttributeCommonInfo.h"
 #include "clang/Basic/CharInfo.h"
+#include "clang/Basic/ExceptionSpecificationType.h"
 #include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Lex/HeaderSearch.h"
@@ -3292,6 +3293,25 @@ AddFunctionTypeQualsToCompletionString(CodeCompletionBuilder &Result,
   Result.AddInformativeChunk(Result.getAllocator().CopyString(QualsStr));
 }
 
+static void
+AddFunctionExceptSpecToCompletionString(CodeCompletionBuilder &Result,
+                                        const FunctionDecl *Function) {
+  const auto *Proto = Function->getType()->getAs<FunctionProtoType>();
+  if (!Proto)
+    return;
+
+  auto ExceptInfo = Proto->getExceptionSpecInfo();
+  switch (ExceptInfo.Type) {
+  case EST_BasicNoexcept:
+  case EST_NoexceptTrue:
+    Result.AddInformativeChunk(" noexcept");
+    break;
+
+  default:
+    break;
+  }
+}
+
 /// Add the name of the given declaration
 static void AddTypedNameChunk(ASTContext &Context, const PrintingPolicy &Policy,
                               const NamedDecl *ND,
@@ -3560,6 +3580,7 @@ CodeCompletionString *CodeCompletionResult::createCodeCompletionStringForDecl(
     AddFunctionParameterChunks(PP, Policy, Function, Result);
     Result.AddChunk(CodeCompletionString::CK_RightParen);
     AddFunctionTypeQualsToCompletionString(Result, Function);
+    AddFunctionExceptSpecToCompletionString(Result, Function);
   };
 
   if (const auto *Function = dyn_cast<FunctionDecl>(ND)) {
@@ -3642,6 +3663,7 @@ CodeCompletionString *CodeCompletionResult::createCodeCompletionStringForDecl(
     AddFunctionParameterChunks(PP, Policy, Function, Result);
     Result.AddChunk(CodeCompletionString::CK_RightParen);
     AddFunctionTypeQualsToCompletionString(Result, Function);
+    AddFunctionExceptSpecToCompletionString(Result, Function);
     return Result.TakeString();
   }
 

@llvmbot
Copy link
Member

llvmbot commented Dec 19, 2023

@llvm/pr-subscribers-clang

Author: Sirui Mu (Lancern)

Changes

If a virtual function is declared with noexcept, functions that override this function in the derived classes must be declared with noexcept as well. This PR updates code completion in clang Sema. It adds noexcept specifier to override functions in the code completion result if the functions override a noexcept virtual function.


Full diff: https://github.com/llvm/llvm-project/pull/75937.diff

2 Files Affected:

  • (added) clang-tools-extra/clangd/test/completion-override-except-spec.test (+69)
  • (modified) clang/lib/Sema/SemaCodeComplete.cpp (+22)
diff --git a/clang-tools-extra/clangd/test/completion-override-except-spec.test b/clang-tools-extra/clangd/test/completion-override-except-spec.test
new file mode 100644
index 00000000000000..19c7f84bc679d8
--- /dev/null
+++ b/clang-tools-extra/clangd/test/completion-override-except-spec.test
@@ -0,0 +1,69 @@
+# RUN: clangd -lit-test < %s | FileCheck %s
+# RUN: clangd -lit-test -pch-storage=memory < %s | FileCheck %s
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
+---
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"struct Base {\n  virtual void virt_method() noexcept = 0;\n};\n\nstruct Derived : Base {\n  virt_\n};"}}}
+---
+{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":5,"character":6}}}
+#      CHECK:  "id": 1,
+# CHECK-NEXT:  "jsonrpc": "2.0",
+# CHECK-NEXT:  "result": {
+# CHECK-NEXT:    "isIncomplete": false,
+# CHECK-NEXT:    "items": [
+# CHECK-NEXT:      {
+# CHECK-NEXT:        "filterText": "virt_method() noexcept override",
+# CHECK-NEXT:        "insertText": "void virt_method() noexcept override",
+# CHECK-NEXT:        "insertTextFormat": 1,
+# CHECK-NEXT:        "kind": 2,
+# CHECK-NEXT:        "label": " void virt_method() noexcept override",
+# CHECK-NEXT:        "score": {{[0-9]+.[0-9]+}},
+# CHECK-NEXT:        "sortText": "{{.*}}virt_method() noexcept override",
+# CHECK-NEXT:        "textEdit": {
+# CHECK-NEXT:          "newText": "void virt_method() noexcept override",
+# CHECK-NEXT:          "range": {
+# CHECK-NEXT:            "end": {
+# CHECK-NEXT:              "character": 6,
+# CHECK-NEXT:              "line": 5
+# CHECK-NEXT:            },
+# CHECK-NEXT:            "start": {
+# CHECK-NEXT:              "character": 2,
+# CHECK-NEXT:              "line": 5
+# CHECK-NEXT:            }
+# CHECK-NEXT:          }
+# CHECK-NEXT:        }
+# CHECK-NEXT:      },
+---
+{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"test:///main.cpp","version":2},"contentChanges":[{"text":"struct Base {\n  virtual void virt_method() = 0;\n};\n\nstruct Derived : Base {\n  virt_\n};"}]}}
+---
+{"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":5,"character":6}}}
+#      CHECK:  "id": 3,
+# CHECK-NEXT:  "jsonrpc": "2.0",
+# CHECK-NEXT:  "result": {
+# CHECK-NEXT:    "isIncomplete": false,
+# CHECK-NEXT:    "items": [
+# CHECK-NEXT:      {
+# CHECK-NEXT:        "filterText": "virt_method() override",
+# CHECK-NEXT:        "insertText": "void virt_method() override",
+# CHECK-NEXT:        "insertTextFormat": 1,
+# CHECK-NEXT:        "kind": 2,
+# CHECK-NEXT:        "label": " void virt_method() override",
+# CHECK-NEXT:        "score": {{[0-9]+.[0-9]+}},
+# CHECK-NEXT:        "sortText": "{{.*}}virt_method() override",
+# CHECK-NEXT:        "textEdit": {
+# CHECK-NEXT:          "newText": "void virt_method() override",
+# CHECK-NEXT:          "range": {
+# CHECK-NEXT:            "end": {
+# CHECK-NEXT:              "character": 6,
+# CHECK-NEXT:              "line": 5
+# CHECK-NEXT:            },
+# CHECK-NEXT:            "start": {
+# CHECK-NEXT:              "character": 2,
+# CHECK-NEXT:              "line": 5
+# CHECK-NEXT:            }
+# CHECK-NEXT:          }
+# CHECK-NEXT:        }
+# CHECK-NEXT:      },
+---
+{"jsonrpc":"2.0","id":4,"method":"shutdown"}
+---
+{"jsonrpc":"2.0","method":"exit"}
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index c44be0df9b0a85..516936311a278d 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -25,6 +25,7 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/AttributeCommonInfo.h"
 #include "clang/Basic/CharInfo.h"
+#include "clang/Basic/ExceptionSpecificationType.h"
 #include "clang/Basic/OperatorKinds.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Lex/HeaderSearch.h"
@@ -3292,6 +3293,25 @@ AddFunctionTypeQualsToCompletionString(CodeCompletionBuilder &Result,
   Result.AddInformativeChunk(Result.getAllocator().CopyString(QualsStr));
 }
 
+static void
+AddFunctionExceptSpecToCompletionString(CodeCompletionBuilder &Result,
+                                        const FunctionDecl *Function) {
+  const auto *Proto = Function->getType()->getAs<FunctionProtoType>();
+  if (!Proto)
+    return;
+
+  auto ExceptInfo = Proto->getExceptionSpecInfo();
+  switch (ExceptInfo.Type) {
+  case EST_BasicNoexcept:
+  case EST_NoexceptTrue:
+    Result.AddInformativeChunk(" noexcept");
+    break;
+
+  default:
+    break;
+  }
+}
+
 /// Add the name of the given declaration
 static void AddTypedNameChunk(ASTContext &Context, const PrintingPolicy &Policy,
                               const NamedDecl *ND,
@@ -3560,6 +3580,7 @@ CodeCompletionString *CodeCompletionResult::createCodeCompletionStringForDecl(
     AddFunctionParameterChunks(PP, Policy, Function, Result);
     Result.AddChunk(CodeCompletionString::CK_RightParen);
     AddFunctionTypeQualsToCompletionString(Result, Function);
+    AddFunctionExceptSpecToCompletionString(Result, Function);
   };
 
   if (const auto *Function = dyn_cast<FunctionDecl>(ND)) {
@@ -3642,6 +3663,7 @@ CodeCompletionString *CodeCompletionResult::createCodeCompletionStringForDecl(
     AddFunctionParameterChunks(PP, Policy, Function, Result);
     Result.AddChunk(CodeCompletionString::CK_RightParen);
     AddFunctionTypeQualsToCompletionString(Result, Function);
+    AddFunctionExceptSpecToCompletionString(Result, Function);
     return Result.TakeString();
   }
 

@HighCommander4
Copy link
Collaborator

Thanks for the patch.

For the test, it would be better to write it in this format rather than using clangd.

@zyn0217
Copy link
Contributor

zyn0217 commented Dec 20, 2023

In addition to Nathan’s advice, I have a question about the commit message

if the functions override a noexcept virtual function.

I didn't see anything reflecting this condition; are you still working on this patch? Would you mind adding a WIP prefix to the title before everything is ready? Thank you!

@Lancern
Copy link
Member Author

Lancern commented Dec 20, 2023

I didn't see anything reflecting this condition; are you still working on this patch?

No, this is not a WIP. I primarily changed the CodeCompletionResult::createCodeCompletionStringForDecl function, which is called during code completion to generate the override function declarator based on the FunctionDecl of the virtual function in the base. I added 2 calls in that function to a new function AddFunctionExceptSpecToCompletionString which appends the noexcept specifier to the generating string if the FunctionDecl has noexcept specifier.

Yes, I'm not explicitly testing if we're overriding a virtual function in the base. I understand the CodeCompletionResult::createCodeCompletionStringForDecl function already covers that. Am I patching the wrong place?

@Lancern
Copy link
Member Author

Lancern commented Dec 20, 2023

For the test, it would be better to write it in this format rather than using clangd.

Thanks for your helpful review. I'll move the test to clang/test/CodeCompletion/overrides.cpp.

@zyn0217
Copy link
Contributor

zyn0217 commented Dec 20, 2023

...which is called during code completion to generate the override function declarator based on the FunctionDecl of the virtual function in the base.

The place you're patching is not only specific to "completing override functions", but handles all completion strings involving function declarations.

@zyn0217
Copy link
Contributor

zyn0217 commented Dec 20, 2023

Bonus: It appears that neither gcc nor clang implements a provision change from CWG1351,

[except.spec]p4
..., unless the overriding function is defined as deleted.

giving errors on the following code.

struct B {
  virtual void h() noexcept = delete;
};

struct D: B {
  void h() = delete;            // Should be OK
};

int main() {
  D();
}

https://cpp2.godbolt.org/z/zvY17G6jr

@Lancern
Copy link
Member Author

Lancern commented Dec 20, 2023

The place you're patching is not only specific to "completing override functions", but handles all completion strings involving function declarations.

OK. I'll move the changes to the CodeCompletionResult::createCodeCompletionStringForOverride function which seems like a more appropriate place for this patch to me.

Bonus: It appears that neither gcc nor clang implements a provision change from CWG1351,

Good catch. Maybe this deserves a new issue for clang Sema?

@zyn0217
Copy link
Contributor

zyn0217 commented Dec 20, 2023

Maybe this deserves a new issue for clang Sema?

Sounds reasonable to me. Feel free to put up a PR / issue for this if you are interested.

@Lancern
Copy link
Member Author

Lancern commented Dec 22, 2023

Feel free to put up a PR / issue for this if you are interested.

Hi Younan. FYI, I have opened a new PR that addresses this problem. See #76248.

Copy link
Collaborator

@shafik shafik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit

@Lancern Lancern force-pushed the clangd-virtual-noexcept-completion branch from c40dbbb to 8924617 Compare June 12, 2025 14:44
@Lancern
Copy link
Member Author

Lancern commented Jun 12, 2025

Ping. Does this PR still get a chance to be merged?

Copy link
Collaborator

@HighCommander4 HighCommander4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Lancern, thanks for the reminder and sorry for the long delay here.

The patch looks good to me, thanks! The only thing I notice is that there area number of unrelated formatting changes; if it's not too much trouble, it would be nice to remove those.

@Lancern Lancern force-pushed the clangd-virtual-noexcept-completion branch from 8924617 to 36f970d Compare June 27, 2025 17:46
@Lancern
Copy link
Member Author

Lancern commented Jun 27, 2025

I have removed the unrelated formatting changes. Will land later if the CI is green.

@Lancern Lancern merged commit 3c4e730 into llvm:main Jun 28, 2025
7 checks passed
@Lancern Lancern deleted the clangd-virtual-noexcept-completion branch June 28, 2025 06:37
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 28, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building clang at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/20116

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/8/12 (2270 of 2279)
PASS: lldb-unit :: ValueObject/./LLDBValueObjectTests/9/12 (2271 of 2279)
PASS: lldb-unit :: Utility/./UtilityTests/4/9 (2272 of 2279)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/0/2 (2273 of 2279)
PASS: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/1/2 (2274 of 2279)
PASS: lldb-unit :: Target/./TargetTests/11/14 (2275 of 2279)
PASS: lldb-unit :: Host/./HostTests/6/8 (2276 of 2279)
PASS: lldb-unit :: Host/./HostTests/4/8 (2277 of 2279)
PASS: lldb-unit :: Process/gdb-remote/./ProcessGdbRemoteTests/8/9 (2278 of 2279)
UNRESOLVED: lldb-api :: tools/lldb-server/TestLldbGdbServer.py (2279 of 2279)
******************** TEST 'lldb-api :: tools/lldb-server/TestLldbGdbServer.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --cmake-build-type Release /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-server -p TestLldbGdbServer.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 3c4e7308028e31aef21e50730145ba7f9b439363)
  clang revision 3c4e7308028e31aef21e50730145ba7f9b439363
  llvm revision 3c4e7308028e31aef21e50730145ba7f9b439363
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hc_then_Csignal_signals_correct_thread_launch_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hc_then_Csignal_signals_correct_thread_launch_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_another_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_minus_one_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_fails_on_zero_pid_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_switches_to_3_threads_launch_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_Hg_switches_to_3_threads_launch_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_and_p_thread_suffix_work_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_and_p_thread_suffix_work_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_writes_all_gpr_registers_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_P_writes_all_gpr_registers_llgs (TestLldbGdbServer.LldbGdbServerTestCase)
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_attach_commandline_continue_app_exits_debugserver (TestLldbGdbServer.LldbGdbServerTestCase) (test case does not fall in any category of interest for this run) 
Program aborted due to an unhandled Error:
Operation not permitted
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb-server gdbserver --attach=398430 --reverse-connect [127.0.0.1]:48975
 #0 0x0000aaaabc969678 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb-server+0x4d9678)
 #1 0x0000aaaabc9676b0 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb-server+0x4d76b0)
 #2 0x0000aaaabc969da8 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x0000ffff90edf7dc (linux-vdso.so.1+0x7dc)
 #4 0x0000ffff906ef1f0 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 28, 2025

LLVM Buildbot has detected a new failure on builder lldb-remote-linux-ubuntu running on as-builder-9 while building clang at step 16 "test-check-lldb-api".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/195/builds/11073

Here is the relevant piece of the build log for the reference
Step 16 (test-check-lldb-api) failure: Test just built components: check-lldb-api completed (failure)
...
PASS: lldb-api :: types/TestIntegerType.py (1282 of 1291)
PASS: lldb-api :: python_api/watchpoint/watchlocation/TestTargetWatchAddress.py (1283 of 1291)
PASS: lldb-api :: types/TestRecursiveTypes.py (1284 of 1291)
PASS: lldb-api :: types/TestIntegerTypeExpr.py (1285 of 1291)
UNSUPPORTED: lldb-api :: windows/launch/missing-dll/TestMissingDll.py (1286 of 1291)
PASS: lldb-api :: types/TestShortType.py (1287 of 1291)
PASS: lldb-api :: types/TestLongTypes.py (1288 of 1291)
PASS: lldb-api :: types/TestShortTypeExpr.py (1289 of 1291)
PASS: lldb-api :: types/TestLongTypesExpr.py (1290 of 1291)
TIMEOUT: lldb-api :: python_api/process/cancel_attach/TestCancelAttach.py (1291 of 1291)
******************** TEST 'lldb-api :: python_api/process/cancel_attach/TestCancelAttach.py' FAILED ********************
Script:
--
/usr/bin/python3.12 /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin --libcxx-include-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/c++/v1 --libcxx-include-target-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/aarch64-unknown-linux-gnu/c++/v1 --libcxx-library-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib/aarch64-unknown-linux-gnu --arch aarch64 --build-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/lldb --compiler /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang --dsymutil /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin --lldb-obj-root /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb --lldb-libs-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib --cmake-build-type Release --platform-url connect://jetson-agx-2198.lab.llvm.org:1234 --platform-working-dir /home/ubuntu/lldb-tests --sysroot /mnt/fs/jetson-agx-ubuntu --env ARCH_CFLAGS=-mcpu=cortex-a78 --platform-name remote-linux --skip-category=lldb-server /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/python_api/process/cancel_attach -p TestCancelAttach.py
--
Exit Code: -9
Timeout: Reached timeout of 600 seconds

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 3c4e7308028e31aef21e50730145ba7f9b439363)
  clang revision 3c4e7308028e31aef21e50730145ba7f9b439363
  llvm revision 3c4e7308028e31aef21e50730145ba7f9b439363

--
Command Output (stderr):
--
WARNING:root:Custom libc++ is not supported for remote runs: ignoring --libcxx arguments
FAIL: LLDB (/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64) :: test_scripted_implementation (TestCancelAttach.AttachCancelTestCase.test_scripted_implementation)

--

********************
Slowest Tests:
--------------------------------------------------------------------------
600.04s: lldb-api :: python_api/process/cancel_attach/TestCancelAttach.py
123.33s: lldb-api :: functionalities/progress_reporting/TestProgressReporting.py
70.58s: lldb-api :: commands/process/attach/TestProcessAttach.py
60.85s: lldb-api :: commands/command/script_alias/TestCommandScriptAlias.py
39.35s: lldb-api :: functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py
36.23s: lldb-api :: functionalities/single-thread-step/TestSingleThreadStepTimeout.py
35.21s: lldb-api :: functionalities/completion/TestCompletion.py
25.78s: lldb-api :: python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
25.13s: lldb-api :: commands/statistics/basic/TestStats.py
21.41s: lldb-api :: functionalities/gdb_remote_client/TestGDBRemoteClient.py
20.67s: lldb-api :: functionalities/gdb_remote_client/TestPlatformClient.py
18.81s: lldb-api :: functionalities/thread/state/TestThreadStates.py
17.70s: lldb-api :: commands/dwim-print/TestDWIMPrint.py
17.29s: lldb-api :: python_api/find_in_memory/TestFindRangesInMemory.py

rlavaee pushed a commit to rlavaee/llvm-project that referenced this pull request Jul 1, 2025
…ion (llvm#75937)

If a virtual function is declared with `noexcept`, functions that
override this function in the derived classes must be declared with
`noexcept` as well. This PR updates code completion in clang Sema. It
adds `noexcept` specifier to override functions in the code completion
result if the functions override a `noexcept` virtual function.
rlavaee pushed a commit to rlavaee/llvm-project that referenced this pull request Jul 1, 2025
…ion (llvm#75937)

If a virtual function is declared with `noexcept`, functions that
override this function in the derived classes must be declared with
`noexcept` as well. This PR updates code completion in clang Sema. It
adds `noexcept` specifier to override functions in the code completion
result if the functions override a `noexcept` virtual function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants