[clang] [Clang] Added check for unexpanded pack in attribute [[assume]] (PR #91841)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 10 22:39:17 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Azmat Yusuf (azmat-y)

<details>
<summary>Changes</summary>

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 &A,
   }
 
   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())

``````````

</details>


https://github.com/llvm/llvm-project/pull/91841


More information about the cfe-commits mailing list