[clang] [clang-tools-extra] [llvm] [RFC] Perform lifetime bound checks for arguments to coroutine (PR #69360)
Bruno Cardoso Lopes via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 1 17:43:17 PDT 2023
================
@@ -7584,11 +7584,22 @@ static void visitLifetimeBoundArguments(IndirectLocalPath &Path, Expr *Call,
if (ObjectArg && implicitObjectParamIsLifetimeBound(Callee))
VisitLifetimeBoundArg(Callee, ObjectArg);
-
+ bool checkCoroCall = false;
+ if (const auto *RD = Callee->getReturnType()->getAsRecordDecl()) {
+ for (const auto &attr :
+ RD->getUnderlyingDecl()->specific_attrs<clang::AnnotateAttr>()) {
+ // Only for demonstration: Get feedback and add a clang annotation as an
+ // extension.
+ if (attr->getAnnotation() == "coro_type") {
----------------
bcardosolopes wrote:
I don't think you need this to find if a record is a "coroutine type", there are other ways, for example:
```
if (rec->getDeclName().isIdentifier() && rec->getName() == "promise_type") {
....
```
https://github.com/llvm/llvm-project/pull/69360
More information about the llvm-commits
mailing list