[clang] [clang][Sema] Make lifetime annotations non-type attributes (PR #196549)
via cfe-commits
cfe-commits at lists.llvm.org
Fri May 8 08:13:23 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Utkarsh Saxena (usx95)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/196549.diff
2 Files Affected:
- (modified) clang/include/clang/Basic/Attr.td (+2-2)
- (modified) clang/lib/AST/TypePrinter.cpp (-2)
``````````diff
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index 70b5773f95b08..84c610c181051 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -2126,14 +2126,14 @@ def ExplicitInit : InheritableAttr {
let SimpleHandler = 1;
}
-def LifetimeBound : DeclOrTypeAttr {
+def LifetimeBound : InheritableAttr {
let Spellings = [Clang<"lifetimebound", 0>];
let Subjects = SubjectList<[ParmVar, ImplicitObjectParameter], ErrorDiag>;
let Documentation = [LifetimeBoundDocs];
let SimpleHandler = 1;
}
-def LifetimeCaptureBy : DeclOrTypeAttr {
+def LifetimeCaptureBy : InheritableAttr {
let Spellings = [Clang<"lifetime_capture_by", 0>];
let Subjects = SubjectList<[ParmVar, ImplicitObjectParameter], ErrorDiag>;
let Args = [VariadicParamOrParamIdxArgument<"Params">];
diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp
index 80f5b90ba35c4..a7f99a5fddfd8 100644
--- a/clang/lib/AST/TypePrinter.cpp
+++ b/clang/lib/AST/TypePrinter.cpp
@@ -2008,8 +2008,6 @@ void TypePrinter::printAttributedAfter(const AttributedType *T,
case attr::CountedByOrNull:
case attr::SizedBy:
case attr::SizedByOrNull:
- case attr::LifetimeBound:
- case attr::LifetimeCaptureBy:
case attr::TypeNonNull:
case attr::TypeNullable:
case attr::TypeNullableResult:
``````````
</details>
https://github.com/llvm/llvm-project/pull/196549
More information about the cfe-commits
mailing list