[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-07-21 Thread Samarth Narang via cfe-commits
snarang181 wrote: > @snarang181 how soon will you be able to address this? This diagnostic keeps > being broken at HEAD, and we need to decide whether this change should be > reverted until you have time to get back to this. I'll prepare a revert for > now and will proceed with it, if I don't

[clang] [clang][Sema] Two-pass noreturn inference via CFG for always-throwing functions (PR #147447)

2025-07-07 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/147447 >From 21f0d364933cd59acaa1fb323c1018dbce7c3452 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Mon, 7 Jul 2025 19:02:38 -0700 Subject: [PATCH 1/3] Add logic to suppress noreturn falling for some basic co

[clang] [clang][Sema] Two-pass noreturn inference via CFG for always-throwing functions (PR #147447)

2025-07-07 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/147447 >From 21f0d364933cd59acaa1fb323c1018dbce7c3452 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Mon, 7 Jul 2025 19:02:38 -0700 Subject: [PATCH 1/2] Add logic to suppress noreturn falling for some basic co

[clang] [clang][Sema] Two-pass noreturn inference via CFG for always-throwing functions (PR #147447)

2025-07-07 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 created https://github.com/llvm/llvm-project/pull/147447 This patch adds a new AnalysisBasedWarnings pass that runs right before IssueWarnings: 1. Pass 1 seeds trivial always-throwing functions. 2. Pass 2 performs a fixed-point CFG-based analysis (CheckFallThrough)

[clang] [clang] [Sema] Suggest [[noreturn]] for void functions that always throw (PR #146234)

2025-06-30 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 closed https://github.com/llvm/llvm-project/pull/146234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] [Sema] Suggest [[noreturn]] for void functions that always throw (PR #146234)

2025-06-30 Thread Samarth Narang via cfe-commits
snarang181 wrote: The linux test failure seems unrelated to these changes. https://github.com/llvm/llvm-project/pull/146234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] [Sema] Suggest [[noreturn]] for void functions that always throw (PR #146234)

2025-06-30 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/146234 >From 588ae1c6c4b965a6cd57044284845a62c75da9c2 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 28 Jun 2025 15:31:37 -0400 Subject: [PATCH 1/3] Emit a suggestion to explicitly mark the function with

[clang] [clang] [Sema] Suggest [[noreturn]] for void functions that always throw (PR #146234)

2025-06-29 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/146234 >From 588ae1c6c4b965a6cd57044284845a62c75da9c2 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 28 Jun 2025 15:31:37 -0400 Subject: [PATCH 1/2] Emit a suggestion to explicitly mark the function with

[clang] [clang] [Sema] Suggest [[noreturn]] for void functions that always throw (PR #146234)

2025-06-29 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/146234 >From 588ae1c6c4b965a6cd57044284845a62c75da9c2 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 28 Jun 2025 15:31:37 -0400 Subject: [PATCH 1/2] Emit a suggestion to explicitly mark the function with

[clang] [clang] [Sema] Suggest [[noreturn]] for void functions that always throw (PR #146234)

2025-06-29 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/146234 >From 588ae1c6c4b965a6cd57044284845a62c75da9c2 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 28 Jun 2025 15:31:37 -0400 Subject: [PATCH 1/2] Emit a suggestion to explicitly mark the function with

[clang] [clang] [Sema] Suggest [[noreturn]] for void functions that always throw (PR #146234)

2025-06-29 Thread Samarth Narang via cfe-commits
@@ -1979,6 +1979,13 @@ void clang::inferNoReturnAttr(Sema &S, const Decl *D) { if (!FD->hasAttr() && !FD->hasAttr() && isKnownToAlwaysThrow(FD)) { NonConstFD->addAttr(InferredNoReturnAttr::CreateImplicit(S.Context)); + +// Conditionally, emit the suggestion warn

[clang] [clang] [Sema] Suggest [[noreturn]] for void functions that always throw (PR #146234)

2025-06-28 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 ready_for_review https://github.com/llvm/llvm-project/pull/146234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] [Sema] Suggest [[noreturn]] for void functions that always throw (PR #146234)

2025-06-28 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 edited https://github.com/llvm/llvm-project/pull/146234 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] [Sema] Suggest [[noreturn]] for void functions that always throw (PR #146234)

2025-06-28 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/146234 >From c6b4a421c0087a06111df3a6f79b929e7285644b Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 28 Jun 2025 15:31:37 -0400 Subject: [PATCH] Emit a suggestion to explicitly mark the function with [[no

[clang] [clang] [Sema] Suggest [[noreturn]] for void functions that always throw (PR #146234)

2025-06-28 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 created https://github.com/llvm/llvm-project/pull/146234 Fixes https://github.com/llvm/llvm-project/issues/146223. >From 6f450c2686e4c4900234ac9aae9dd085966eff64 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 28 Jun 2025 15:31:37 -0400 Subject: [PATCH] E

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-27 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 closed https://github.com/llvm/llvm-project/pull/145166 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-27 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 ready_for_review https://github.com/llvm/llvm-project/pull/145166 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-27 Thread Samarth Narang via cfe-commits
@@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -fexceptions -Wreturn-type -verify %s +// expected-no-diagnostics + +namespace std { + class string { + public: +string(const char*); // constructor for runtime_error + }; + class runtime_error { + publi

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-27 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 602b472aadebe365cb9f499ce85687a5e31605b8 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH 1/9] Suppress noreturn warning if last statement in a functio

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-26 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 602b472aadebe365cb9f499ce85687a5e31605b8 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH 1/7] Suppress noreturn warning if last statement in a functio

[clang] [Clang] Implement diagnostics for why is_empty is false (PR #145044)

2025-06-25 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 closed https://github.com/llvm/llvm-project/pull/145044 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-25 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From 7f11d3392e3f3ead823c8af2ea9a3b1f9ef9e0c9 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 01/10] Implement diagnostics for why `std::is_standard_layout

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-25 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 closed https://github.com/llvm/llvm-project/pull/144161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-25 Thread Samarth Narang via cfe-commits
snarang181 wrote: > Precommit CI found relevant failures: > > ``` > FAILED: tools/clang/include/clang/Basic/DiagnosticAnalysisEnums.inc > /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/include/clang/Basic/DiagnosticAnalysisEnums.inc > > cd > /home/gha/actions-runn

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-25 Thread Samarth Narang via cfe-commits
snarang181 wrote: @AaronBallman, as per the comment I left below: it is because of the conflicting definitions of the TableGen description of `VirtualFunction`. Will push a resolution soon. > Needs some manual intervention after the merge. Conflicting redundance in the > tablegen description

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-25 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From 7f11d3392e3f3ead823c8af2ea9a3b1f9ef9e0c9 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 1/8] Implement diagnostics for why `std::is_standard_layout`

[clang] [Clang] Implement diagnostics for why is_empty is false (PR #145044)

2025-06-25 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145044 >From 29de582dd07ceb89ead7ecf24be6c19004edd46e Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 20 Jun 2025 10:51:04 -0400 Subject: [PATCH 1/3] Explain why 'is_empty' evaluates to false Add tests for

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-25 Thread Samarth Narang via cfe-commits
snarang181 wrote: > > > I feel like this is a solution that can grow out of hand very easily. IMO > > > the better solution would be to have `-Wmissing-noreturn` place a > > > `[[noreturn]]` into the AST to avoid incorrect follow-up diagnostics. > > > > > > I agree, in principle I would expe

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-25 Thread Samarth Narang via cfe-commits
@@ -2285,6 +2286,139 @@ static void DiagnoseNonTriviallyCopyableReason(Sema &SemaRef, SemaRef.Diag(D->getLocation(), diag::note_defined_here) << D; } +static bool hasMultipleDataBaseClassesWithFields(const CXXRecordDecl *D) { + int NumBasesWithFields = 0; + for (const CXX

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-25 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From 7f11d3392e3f3ead823c8af2ea9a3b1f9ef9e0c9 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 1/9] Implement diagnostics for why `std::is_standard_layout`

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-25 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From 7f11d3392e3f3ead823c8af2ea9a3b1f9ef9e0c9 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 1/8] Implement diagnostics for why `std::is_standard_layout`

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-25 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From 7f11d3392e3f3ead823c8af2ea9a3b1f9ef9e0c9 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 1/8] Implement diagnostics for why `std::is_standard_layout`

[clang] [Clang] Implement diagnostics for why is_empty is false (PR #145044)

2025-06-24 Thread Samarth Narang via cfe-commits
snarang181 wrote: Thank you for reviewing, @AaronBallman. Requesting a re-review. https://github.com/llvm/llvm-project/pull/145044 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement diagnostics for why is_empty is false (PR #145044)

2025-06-24 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145044 >From c56a2afe9e3ad22807c30ef69da41af6f325d3a5 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 20 Jun 2025 10:51:04 -0400 Subject: [PATCH 1/2] Explain why 'is_empty' evaluates to false Add tests for

[clang] [Clang] Implement diagnostics for why is_empty is false (PR #145044)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145044 >From ef3da9bb1debb04c3f3109cc10f8776f024265b6 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 20 Jun 2025 10:51:04 -0400 Subject: [PATCH] Explain why 'is_empty' evaluates to false Add tests for var

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From a149c93c3f49b6a51de972dc8418299f4074ddf8 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 1/7] Implement diagnostics for why `std::is_standard_layout`

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 004e79ee856a965459ce0372de97f4a89d0c Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH] Suppress noreturn warning if last statement in a function is

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
snarang181 wrote: > Thank you for the patch! Please add a release note in > `clang/docs/ReleaseNotes.rst`. @zwuis, added a description of the patch in the release notes and addressed your review comments. https://github.com/llvm/llvm-project/pull/145166 _

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 359dfb1a835617a83ae13865817480e68aa67750 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH 1/4] Suppress noreturn warning if last statement in a functio

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 359dfb1a835617a83ae13865817480e68aa67750 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH 1/3] Suppress noreturn warning if last statement in a functio

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 359dfb1a835617a83ae13865817480e68aa67750 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH 1/2] Suppress noreturn warning if last statement in a functio

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 359dfb1a835617a83ae13865817480e68aa67750 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH 1/3] Suppress noreturn warning if last statement in a functio

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 359dfb1a835617a83ae13865817480e68aa67750 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH 1/2] Suppress noreturn warning if last statement in a functio

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 edited https://github.com/llvm/llvm-project/pull/145166 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 ready_for_review https://github.com/llvm/llvm-project/pull/145166 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 359dfb1a835617a83ae13865817480e68aa67750 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH] Suppress noreturn warning if last statement in a function is

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 2c2324a684f32266aace70fc12bec297971625e6 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH] Suppress noreturn warning if last statement in a function is

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 8a51a2fcff8ea481cbdad513e9217f2c0861b0b4 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH] Suppress noreturn warning if last statement in a function is

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 57e65b8678cd89c49114d5b76be1ad7b086f3839 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH] Suppress noreturn warning if last statement in a function is

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From 9aaf629b7717ac0f83def10e228b85558716afbb Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH] Suppress noreturn warning if last statement in a function is

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From e92129c1d38d20214091694294e659170227522c Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH] Suppress noreturn warning if last statement in a function is

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/145166 >From a5930c939d0dfafa90c913167a6ea09ca7e30385 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH] Suppress noreturn warning if last statement in a function is

[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

2025-06-21 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 created https://github.com/llvm/llvm-project/pull/145166 None >From 9108bf02ab68115eac14965ce30a8a3690358b68 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 21 Jun 2025 08:42:00 -0400 Subject: [PATCH] Suppress noreturn warning if last statement in a funct

[clang] [Clang] Implement diagnostics for why is_empty is false (PR #145044)

2025-06-20 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 created https://github.com/llvm/llvm-project/pull/145044 Expands on https://github.com/llvm/llvm-project/issues/141911 >From 2660f0f3b2096640a52e0d2375c566994645d304 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 20 Jun 2025 10:51:04 -0400 Subject: [PATC

[clang] [Clang] Implement diagnostics for why is_empty is false (PR #145044)

2025-06-20 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 ready_for_review https://github.com/llvm/llvm-project/pull/145044 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-19 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From 3841ecf80c13101959a97316dda7a1b891e70502 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 1/5] Implement diagnostics for why `std::is_standard_layout`

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-19 Thread Samarth Narang via cfe-commits
@@ -1787,6 +1788,12 @@ def note_unsatisfied_trait_reason "%NonReplaceableField{has a non-replaceable member %1 of type %2}|" "%NTCBase{has a non-trivially-copyable base %1}|" "%NTCField{has a non-trivially-copyable member %1 of type %2}|" +

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-19 Thread Samarth Narang via cfe-commits
@@ -488,3 +488,83 @@ static_assert(__is_trivially_copyable(S12)); // expected-note@-1 {{'S12' is not trivially copyable}} \ // expected-note@#tc-S12 {{'S12' defined here}} } + +namespace standard_layout_tests { +struct WithVirtual { // #sl-Virtual +virtual void foo(); +}; +

[clang] [Clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-19 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From 3841ecf80c13101959a97316dda7a1b891e70502 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 1/6] Implement diagnostics for why `std::is_standard_layout`

[clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-19 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From 3841ecf80c13101959a97316dda7a1b891e70502 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 1/3] Implement diagnostics for why `std::is_standard_layout`

[clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-16 Thread Samarth Narang via cfe-commits
snarang181 wrote: Looks like all tests pass now. Requesting review now. https://github.com/llvm/llvm-project/pull/144161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-15 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From b33871b073e2438d0f747404d864616f49e235f6 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 1/2] Implement diagnostics for why `std::is_standard_layout`

[clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-14 Thread Samarth Narang via cfe-commits
snarang181 wrote: Rebased and testing the again. The Windows build failure seems largely unrelated to my changes. https://github.com/llvm/llvm-project/pull/144161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-14 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 ready_for_review https://github.com/llvm/llvm-project/pull/144161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-14 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From b6d3510ff82cd005e7d9b6b0d774cde3ad52250b Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 1/2] Implement diagnostics for why `std::is_standard_layout`

[clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-13 Thread Samarth Narang via cfe-commits
@@ -2276,6 +2277,134 @@ static void DiagnoseNonTriviallyCopyableReason(Sema &SemaRef, SemaRef.Diag(D->getLocation(), diag::note_defined_here) << D; } +static bool hasMixedAccessSpecifier(const CXXRecordDecl *D) { + AccessSpecifier FirstAccess = AS_none; + for (const Field

[clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-13 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/144161 >From 10b723750e120420970f864ebda05e0495d4632f Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH 1/2] Implement diagnostics for why `std::is_standard_layout`

[clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-13 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 edited https://github.com/llvm/llvm-project/pull/144161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-13 Thread Samarth Narang via cfe-commits
snarang181 wrote: Closing in favor of https://github.com/llvm/llvm-project/pull/144161 https://github.com/llvm/llvm-project/pull/143722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-13 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 closed https://github.com/llvm/llvm-project/pull/143722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement diagnostics for why `std::is_standard_layout` is false (PR #144161)

2025-06-13 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 created https://github.com/llvm/llvm-project/pull/144161 None >From 10b723750e120420970f864ebda05e0495d4632f Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Fri, 13 Jun 2025 23:22:18 +0200 Subject: [PATCH] Implement diagnostics for why `std::is_standard_layout

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-13 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/143722 >From 6f787e1997f53968e23586b4eb03c45e6559ebbf Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Mon, 2 Jun 2025 19:30:39 -0400 Subject: [PATCH 1/2] Add std layout diagnostics Add diagnostic test cases ---

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-13 Thread Samarth Narang via cfe-commits
snarang181 wrote: Something broke while resolving merge conflicts. Getting it back to a steady state and will mark it ready for review again. Apologies. https://github.com/llvm/llvm-project/pull/143722 ___ cfe-commits mailing list cfe-commits@lists.l

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-13 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 converted_to_draft https://github.com/llvm/llvm-project/pull/143722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-13 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/143722 >From e96c9c940bbfaf9da752c3537ea8bd023b8b15aa Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Mon, 2 Jun 2025 19:30:39 -0400 Subject: [PATCH 1/2] Add std layout diagnostics Add diagnostic test cases ---

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-12 Thread Samarth Narang via cfe-commits
@@ -488,3 +488,83 @@ static_assert(__is_trivially_copyable(S12)); // expected-note@-1 {{'S12' is not trivially copyable}} \ // expected-note@#tc-S12 {{'S12' defined here}} } + +namespace standard_layout_tests { +struct WithVirtual { // #sl-Virtual + virtual void foo(); +};

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-12 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/143722 >From b92f63bcd8b9910278102353bed4db6b433629ce Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Mon, 2 Jun 2025 19:30:39 -0400 Subject: [PATCH 1/2] Add std layout diagnostics Add diagnostic test cases ---

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-12 Thread Samarth Narang via cfe-commits
snarang181 wrote: > Thanks a lot for working on that. > > Can you add tests for all of these examples? > https://eel.is/c++draft/class.prop#11 > > In particular > > * If there are multiple direct base classes, a type is not a standard layout > * If in the inheritance hierarchy, there are mult

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-12 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/143722 >From 6b33849afd6c6c252eae76c4c5b17e25495ec90b Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Mon, 2 Jun 2025 19:30:39 -0400 Subject: [PATCH] Add std layout diagnostics Add diagnostic test cases --- ..

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-11 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 edited https://github.com/llvm/llvm-project/pull/143722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-11 Thread Samarth Narang via cfe-commits
snarang181 wrote: @cor3ntin, requesting your review here. https://github.com/llvm/llvm-project/pull/143722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-11 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 ready_for_review https://github.com/llvm/llvm-project/pull/143722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Explain why is_standard_layout evaluated to false (PR #143722)

2025-06-11 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 edited https://github.com/llvm/llvm-project/pull/143722 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add std layout diagnostics (PR #143722)

2025-06-11 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 created https://github.com/llvm/llvm-project/pull/143722 None >From 6b17d6c88bf02cd83e40df4182b67897e56a854a Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Mon, 2 Jun 2025 19:30:39 -0400 Subject: [PATCH] Add std layout diagnostics Add diagnostic test cases -

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-08 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/143275 >From c18c91f7f8f4332696dd309a5164c568f32c137b Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 7 Jun 2025 12:21:17 -0400 Subject: [PATCH 1/2] Replace loop with llvm:any_of --- clang/include/clang/A

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-08 Thread Samarth Narang via cfe-commits
@@ -177,13 +177,10 @@ class StoredDeclsList { if (ND->isFromASTFile()) return true; // FIXME: Can we get rid of this loop completely? - for (NamedDecl *D : Decls) -// Only replace the local declaration if the external declaration has -//

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-08 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/143275 >From c18c91f7f8f4332696dd309a5164c568f32c137b Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 7 Jun 2025 12:21:17 -0400 Subject: [PATCH 1/2] Replace loop with llvm:any_of --- clang/include/clang/A

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-08 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/143275 >From c18c91f7f8f4332696dd309a5164c568f32c137b Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 7 Jun 2025 12:21:17 -0400 Subject: [PATCH 1/2] Replace loop with llvm:any_of --- clang/include/clang/A

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-08 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/143275 >From c18c91f7f8f4332696dd309a5164c568f32c137b Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 7 Jun 2025 12:21:17 -0400 Subject: [PATCH 1/2] Replace loop with llvm:any_of --- clang/include/clang/A

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-08 Thread Samarth Narang via cfe-commits
@@ -177,13 +177,10 @@ class StoredDeclsList { if (ND->isFromASTFile()) return true; // FIXME: Can we get rid of this loop completely? - for (NamedDecl *D : Decls) -// Only replace the local declaration if the external declaration has -//

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-08 Thread Samarth Narang via cfe-commits
snarang181 wrote: > IIUC the `FIXME` comment means that the time complexity of this part of code > is not good enough and we can make it faster. OK. In any case, the usage of `llvm_any_of` seemed better than using an explicit `for-loop`. https://github.com/llvm/llvm-project/pull/143275 _

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-08 Thread Samarth Narang via cfe-commits
@@ -176,14 +176,10 @@ class StoredDeclsList { DeclListNode::Decls *Tail = erase_if([Decls](NamedDecl *ND) { if (ND->isFromASTFile()) return true; - // FIXME: Can we get rid of this loop completely? - for (NamedDecl *D : Decls) -// Only replac

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-08 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/143275 >From c18c91f7f8f4332696dd309a5164c568f32c137b Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 7 Jun 2025 12:21:17 -0400 Subject: [PATCH 1/2] Replace loop with llvm:any_of --- clang/include/clang/A

[clang-tools-extra] Refactor clang doc comment structure (PR #142273)

2025-06-08 Thread Samarth Narang via cfe-commits
snarang181 wrote: Sounds good, @ilovepi. I also raised an issue to get commit access and you might have gotten a notification. It'd be great if you can take a look at that too :) https://github.com/llvm/llvm-project/pull/142273 ___ cfe-commits mailin

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-07 Thread Samarth Narang via cfe-commits
snarang181 wrote: @ChuanqiXu9, requesting your review here. https://github.com/llvm/llvm-project/pull/143275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-07 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 ready_for_review https://github.com/llvm/llvm-project/pull/143275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-07 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 edited https://github.com/llvm/llvm-project/pull/143275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-07 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 edited https://github.com/llvm/llvm-project/pull/143275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Refactor replaceExternalDecls to use llvm::any_of (PR #143275)

2025-06-07 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 edited https://github.com/llvm/llvm-project/pull/143275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Replace loop with llvm:any_of (PR #143275)

2025-06-07 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 created https://github.com/llvm/llvm-project/pull/143275 None >From dc4e3c9afbef406ae1acbd572dfe9edd9d5efea3 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 7 Jun 2025 12:21:17 -0400 Subject: [PATCH] Replace loop with llvm:any_of --- clang/include/clang

  1   2   >