[clang] [Clang] Added check for unexpanded pack in attribute [[assume]] (PR #91841)
Sirraide wrote: I’d recommend just adding the tests to wherever the `[[assume]]` attribute is already being tested; that’d be somewhere in `test/SemaCXX` https://github.com/llvm/llvm-project/pull/91841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Added check for unexpanded pack in attribute [[assume]] (PR #91841)
azmat-y wrote: Would I be correct in assuming that the test would be somewhat similar to this. llvm-project/clang/test/Sema/unroll-template-value-crash.cpp ``` // RUN: %clang_cc1 -x c++ -verify %s // expected-no-diagnostics template void foo() { #pragma unroll Unroll for (int i = 0; i < Unroll; ++i); #pragma GCC unroll Unroll for (int i = 0; i < Unroll; ++i); } ``` Can you point me towards information on clang_cc1 and similar arguments used for lit. I have scanned through [lit](https://llvm.org/docs/CommandGuide/lit.html#execution-options) but could not find a mention for it. https://github.com/llvm/llvm-project/pull/91841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Added check for unexpanded pack in attribute [[assume]] (PR #91841)
https://github.com/Sirraide commented: This needs tests to make sure this is actually doing what it’s supposed to do. https://github.com/llvm/llvm-project/pull/91841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Added check for unexpanded pack in attribute [[assume]] (PR #91841)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Azmat Yusuf (azmat-y) Changes Added check for unexpanded parameter pack in attribute [[assume]]. This solves #91232. --- Full diff: https://github.com/llvm/llvm-project/pull/91841.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaStmtAttr.cpp (+5) ``diff diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp index 1c84830b6ddd2..36f8ecadcfab7 100644 --- a/clang/lib/Sema/SemaStmtAttr.cpp +++ b/clang/lib/Sema/SemaStmtAttr.cpp @@ -670,6 +670,11 @@ ExprResult Sema::ActOnCXXAssumeAttr(Stmt *St, const ParsedAttr , } auto *Assumption = A.getArgAsExpr(0); + + if (DiagnoseUnexpandedParameterPack(Assumption)) { +return ExprError(); + } + if (Assumption->getDependence() == ExprDependence::None) { ExprResult Res = BuildCXXAssumeExpr(Assumption, A.getAttrName(), Range); if (Res.isInvalid()) `` https://github.com/llvm/llvm-project/pull/91841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Added check for unexpanded pack in attribute [[assume]] (PR #91841)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/91841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [Clang] Added check for unexpanded pack in attribute [[assume]] (PR #91841)
https://github.com/azmat-y created https://github.com/llvm/llvm-project/pull/91841 Added check for unexpanded parameter pack in attribute [[assume]]. This solves #91232. >From c9f0887b5af64387938e0d80a4210af296e68f31 Mon Sep 17 00:00:00 2001 From: Azmat Yusuf Date: Sat, 11 May 2024 09:56:02 +0530 Subject: [PATCH] [Clang] Added check for unexpanded pack in attribute [[assume]] --- clang/lib/Sema/SemaStmtAttr.cpp | 5 + 1 file changed, 5 insertions(+) diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp index 1c84830b6ddd2..36f8ecadcfab7 100644 --- a/clang/lib/Sema/SemaStmtAttr.cpp +++ b/clang/lib/Sema/SemaStmtAttr.cpp @@ -670,6 +670,11 @@ ExprResult Sema::ActOnCXXAssumeAttr(Stmt *St, const ParsedAttr , } auto *Assumption = A.getArgAsExpr(0); + + if (DiagnoseUnexpandedParameterPack(Assumption)) { +return ExprError(); + } + if (Assumption->getDependence() == ExprDependence::None) { ExprResult Res = BuildCXXAssumeExpr(Assumption, A.getAttrName(), Range); if (Res.isInvalid()) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits