[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] [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] 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 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
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] [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] 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 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] 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 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
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
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] [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 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
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-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] [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 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-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-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] 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-tools-extra] Refactor clang doc comment structure (PR #142273)

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

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

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

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

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

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

2025-06-01 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/142273 >From 725dd21adcd2f776b2e6adc648e3038812059bf3 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 31 May 2025 10:05:52 -0400 Subject: [PATCH 1/6] [clang-doc] Refactor CommentInfo.Kind to use CommentKind

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

2025-06-01 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/142273 >From cd99fbe06a384db3775d1fc8c923275df07d4db3 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 31 May 2025 10:05:52 -0400 Subject: [PATCH 1/7] [clang-doc] Refactor CommentInfo.Kind to use CommentKind

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

2025-05-31 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 created https://github.com/llvm/llvm-project/pull/142273 None >From 725dd21adcd2f776b2e6adc648e3038812059bf3 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 31 May 2025 10:05:52 -0400 Subject: [PATCH 1/2] [clang-doc] Refactor CommentInfo.Kind to use Comme

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

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

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
snarang181 wrote: @ilovepi, thanks for the patience and taking out the time to give detailed reviews. I will work on addresing your comments. One word on the tests: I was trying to test some of the other fail conditions but seems like a lot of the error conditions are caught by the parsing ear

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
@@ -284,10 +284,7 @@ Example usage for a project using a compile commands database: {UserStylesheets.begin(), UserStylesheets.end()}}; if (Format == "html") { -if (auto Err = getHtmlAssetFiles(argv[0], CDCtx)) { - llvm::errs() << toString(std::move(Err)) << "

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/141699 >From b2dc4f8a50d86ecdc5fd27fedd7efde5c6882df5 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Tue, 27 May 2025 21:32:41 -0400 Subject: [PATCH 1/7] [clang-doc] Refactor error handling to use ExitOnError

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
@@ -300,7 +297,7 @@ Example usage for a project using a compile commands database: "these files and continue:\n" << toString(std::move(Err)) << "\n"; else { - llvm::errs() << toString(std::move(Err)) << "\n"; s

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
snarang181 wrote: Also, from the CI test run, I see the Linux build failing. This seems unrelated, right? Does it warrant a rerun? ``` /home/gha/actions-runner/_work/llvm-project/llvm-project/libc/test/src/math/smoke/HypotTest.h:31: FAILURE Failed to match aNaN against LIBC_NAMESPACE::testing:

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
@@ -0,0 +1,12 @@ +// Test: Invalid output path (%t is a file, not a directory) snarang181 wrote: Thanks for the pointer. https://github.com/llvm/llvm-project/pull/141699 ___ cfe-commits mailing list cfe-commits@lists.

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
@@ -0,0 +1,12 @@ +// Test: Invalid output path (%t is a file, not a directory) +// RUN: rm -rf %t && echo "not a dir" > %t +// RUN: not clang-doc %s -output=%t/subdir 2>&1 | FileCheck --check-prefix=BAD-OUTPUT %s + +// BAD-OUTPUT: clang-doc error: +// BAD-OUTPUT: {{(Not a directo

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
@@ -371,22 +368,15 @@ Example usage for a project using a compile commands database: sortUsrToInfo(USRToInfo); // Ensure the root output directory exists. - if (std::error_code Err = llvm::sys::fs::create_directories(OutDirectory); - Err != std::error_code()) { -

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

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

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
@@ -0,0 +1,12 @@ +// Test: Invalid output path (%t is a file, not a directory) +// RUN: rm -rf %t && echo "not a dir" > %t +// RUN: not clang-doc %s -output=%t/subdir 2>&1 | FileCheck --check-prefix=BAD-OUTPUT %s + +// BAD-OUTPUT: clang-doc error: +// BAD-OUTPUT: {{(Not a directo

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
@@ -373,20 +370,16 @@ Example usage for a project using a compile commands database: // Ensure the root output directory exists. if (std::error_code Err = llvm::sys::fs::create_directories(OutDirectory); Err != std::error_code()) { -llvm::errs() << "Failed to cre

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/141699 >From b2dc4f8a50d86ecdc5fd27fedd7efde5c6882df5 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Tue, 27 May 2025 21:32:41 -0400 Subject: [PATCH 1/6] [clang-doc] Refactor error handling to use ExitOnError

[clang-tools-extra] [clang-doc] Refactor error handling to use ExitOnError (PR #141699)

2025-05-29 Thread Samarth Narang via cfe-commits
snarang181 wrote: @ilovepi -- In the updated version, I have used the `createFileError()` API and checked that the output is reliable. Also, I have renamed the lit test file; in the tests, I create a temporary file using `%t` and then obviously, it cannot create a directory there. Hopefully th

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

2025-05-31 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/142273 >From 725dd21adcd2f776b2e6adc648e3038812059bf3 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 31 May 2025 10:05:52 -0400 Subject: [PATCH 1/4] [clang-doc] Refactor CommentInfo.Kind to use CommentKind

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

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

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

2025-05-31 Thread Samarth Narang via cfe-commits
snarang181 wrote: @ilovepi, would be great to get your review here. https://github.com/llvm/llvm-project/pull/142273 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-05-31 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/142273 >From 725dd21adcd2f776b2e6adc648e3038812059bf3 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 31 May 2025 10:05:52 -0400 Subject: [PATCH 1/5] [clang-doc] Refactor CommentInfo.Kind to use CommentKind

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

2025-06-01 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/142273 >From cd99fbe06a384db3775d1fc8c923275df07d4db3 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 31 May 2025 10:05:52 -0400 Subject: [PATCH 1/8] [clang-doc] Refactor CommentInfo.Kind to use CommentKind

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

2025-06-01 Thread Samarth Narang via cfe-commits
@@ -26,6 +26,66 @@ namespace clang { namespace doc { +CommentKind stringToCommentKind(llvm::StringRef KindStr) { + if (KindStr == "FullComment") +return CommentKind::CK_FullComment; snarang181 wrote: Updated the function to do a `StringMap` lookup. htt

[clang-tools-extra] [clang-doc] [test] Generalize error message patterns (PR #142373)

2025-06-02 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 commented: Looks fine. But I see your point regarding portability, I'll think how we can modify this. https://github.com/llvm/llvm-project/pull/142373 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists

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

2025-06-05 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/142273 >From 51adbab1511e92c44925d20661ed86d2ab28dca0 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 31 May 2025 10:05:52 -0400 Subject: [PATCH 1/9] [clang-doc] Refactor CommentInfo.Kind to use CommentKind

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

2025-06-05 Thread Samarth Narang via cfe-commits
snarang181 wrote: Left a reply to this [comment](https://github.com/llvm/llvm-project/pull/142273/files#r2125020120) @ilovepi. Addressed some other comments. https://github.com/llvm/llvm-project/pull/142273 ___ cfe-commits mailing list cfe-commits@l

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

2025-06-05 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/142273 >From 51adbab1511e92c44925d20661ed86d2ab28dca0 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 31 May 2025 10:05:52 -0400 Subject: [PATCH 01/10] [clang-doc] Refactor CommentInfo.Kind to use CommentK

[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] [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
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] [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] 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] [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 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 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 `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] [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 `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 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 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 `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] 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] [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] 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-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] [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] 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] [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
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 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-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-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
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] [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
@@ -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-tools-extra] Refactor clang doc comment structure (PR #142273)

2025-06-05 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/142273 >From f75d81cacf455477fe9bc6cb498fb2f76bebcfe2 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 31 May 2025 10:05:52 -0400 Subject: [PATCH 01/12] [clang-doc] Refactor CommentInfo.Kind to use CommentK

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

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

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

2025-06-05 Thread Samarth Narang via cfe-commits
snarang181 wrote: > Oh, lets updated the PR description with a more complete description of the > change. It can also be marked as `Fixes #NNN` since this basically implements > everything outlined in the issues, unless I'm forgetting something. Done. https://github.com/llvm/llvm-project/pull

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

2025-06-05 Thread Samarth Narang via cfe-commits
https://github.com/snarang181 updated https://github.com/llvm/llvm-project/pull/142273 >From 5bc81ef0cd42194bfe4f8aef9bc98a17ada2d297 Mon Sep 17 00:00:00 2001 From: Samarth Narang Date: Sat, 31 May 2025 10:05:52 -0400 Subject: [PATCH 01/11] [clang-doc] Refactor CommentInfo.Kind to use CommentK

[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 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
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 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

  1   2   >