Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Clang] Do not emit -Wmissing-noreturn when [[noreturn]] is present#148552

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
cor3ntin merged 1 commit intollvm:mainfromcor3ntin:corentin/no_return_throw
Jul 14, 2025

Conversation

cor3ntin
Copy link
Contributor

Fix a false positve warning which was introduced by#146234.

@llvmbotllvmbot added clangClang issues not falling into any other category clang:frontendLanguage frontend issues, e.g. anything involving "Sema" labelsJul 13, 2025
@llvmbot
Copy link
Member

@llvm/pr-subscribers-clang

Author: Corentin Jabot (cor3ntin)

Changes

Fix a false positve warning which was introduced by #146234.


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

2 Files Affected:

  • (modified) clang/lib/Sema/SemaDeclAttr.cpp (+1-1)
  • (modified) clang/test/SemaCXX/wmissing-noreturn-suggestion.cpp (+22)
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cppindex 7ebb53318702c..72972221d23c5 100644--- a/clang/lib/Sema/SemaDeclAttr.cpp+++ b/clang/lib/Sema/SemaDeclAttr.cpp@@ -1976,7 +1976,7 @@ void clang::inferNoReturnAttr(Sema &S, const Decl *D) {       Diags.isIgnored(diag::warn_suggest_noreturn_function, FD->getLocation()))     return;-  if (!FD->hasAttr<NoReturnAttr>() && !FD->hasAttr<InferredNoReturnAttr>() &&+  if (!FD->isNoReturn() && !FD->hasAttr<InferredNoReturnAttr>() &&       isKnownToAlwaysThrow(FD)) {     NonConstFD->addAttr(InferredNoReturnAttr::CreateImplicit(S.Context));diff --git a/clang/test/SemaCXX/wmissing-noreturn-suggestion.cpp b/clang/test/SemaCXX/wmissing-noreturn-suggestion.cppindex 7548ba8904a71..8beffcd39e85c 100644--- a/clang/test/SemaCXX/wmissing-noreturn-suggestion.cpp+++ b/clang/test/SemaCXX/wmissing-noreturn-suggestion.cpp@@ -21,3 +21,25 @@ int ensureZero(int i) {   if (i == 0) return 0;   throwError("ERROR"); // no-warning }+++template <typename Ex>+[[noreturn]]+void tpl_throws(Ex const& e) {+    throw e;+}++[[noreturn]]+void tpl_throws_test() {+    tpl_throws(0);+}++[[gnu::noreturn]]+int gnu_throws() {+    throw 0;+}++[[noreturn]]+int cxx11_throws() {+    throw 0;+}

Copy link
Collaborator

@AaronBallmanAaronBallman left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for the fix!

@cor3ntincor3ntin merged commitafffa0d intollvm:mainJul 14, 2025
12 checks passed
@llvm-ci
Copy link
Collaborator

LLVM Buildbot has detected a new failure on builderopenmp-gcc-x86_64-linux-debian running ongribozavr4 while buildingclang at step 6 "test-openmp".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-openmp) failure: test (failure)******************** TEST 'libomp :: tasking/issue-94260-2.c' FAILED ********************Exit Code: -11Command Output (stdout):--# RUN: at line 1/b/1/openmp-gcc-x86_64-linux-debian/llvm.build/./bin/clang -fopenmp   -I /b/1/openmp-gcc-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -I /b/1/openmp-gcc-x86_64-linux-debian/llvm.src/openmp/runtime/test -L /b/1/openmp-gcc-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -fno-omit-frame-pointer -I /b/1/openmp-gcc-x86_64-linux-debian/llvm.src/openmp/runtime/test/ompt /b/1/openmp-gcc-x86_64-linux-debian/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c -o /b/1/openmp-gcc-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp -lm -latomic && /b/1/openmp-gcc-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp# executed command: /b/1/openmp-gcc-x86_64-linux-debian/llvm.build/./bin/clang -fopenmp -I /b/1/openmp-gcc-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -I /b/1/openmp-gcc-x86_64-linux-debian/llvm.src/openmp/runtime/test -L /b/1/openmp-gcc-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -fno-omit-frame-pointer -I /b/1/openmp-gcc-x86_64-linux-debian/llvm.src/openmp/runtime/test/ompt /b/1/openmp-gcc-x86_64-linux-debian/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c -o /b/1/openmp-gcc-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp -lm -latomic# executed command: /b/1/openmp-gcc-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp# note: command had no output on stdout or stderr# error: command failed with exit status: -11--********************

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@AaronBallmanAaronBallmanAaronBallman approved these changes

@erichkeaneerichkeaneAwaiting requested review from erichkeane

Assignees
No one assigned
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"clangClang issues not falling into any other category
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@cor3ntin@llvmbot@llvm-ci@AaronBallman

[8]ページ先頭

©2009-2025 Movatter.jp