[clang] [clang] Output a warning when [[lifetimebound]] attribute is applied on a function parameter while the function returns void (PR #113460)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 23 07:47:54 PDT 2024


================
@@ -6970,6 +6970,18 @@ static void checkAttributesAfterMerging(Sema &S, NamedDecl &ND) {
         }
       }
     }
+
+    for (unsigned int I = 0; I < FD->getNumParams(); ++I) {
----------------
usx95 wrote:

We would also want to diagnose this for member functions where lifetimebound is not attached to a param but to the function type.
```cpp
struct S {
  void member() [[clang::lifetimebound]];
}
```

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


More information about the cfe-commits mailing list