[clang] [clang] Fix GNU spellings of lifetimebound/lifetime_capture_by (PR #192070)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 14 08:01:38 PDT 2026


================
@@ -734,6 +734,13 @@ static void distributeTypeAttrsFromDeclarator(TypeProcessingState &state,
       continue;
 
     switch (attr.getKind()) {
+    case ParsedAttr::AT_LifetimeBound:
----------------
zeyi2 wrote:

For an example case like this:

```cpp
struct Foo2 {
  int &get2() __attribute__((lifetimebound));
};
```

before:

```text
`-CXXMethodDecl ... get2 'int &()'
```

after:

```text
`-CXXMethodDecl ... get2 'int &() [[clang::lifetimebound]]':'int &()'
```

-----

`isDeclarationOfFunction` is used to correctly handle cases like:

```c++
const int &get3(const int &a __attribute__((lifetimebound)));
```

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


More information about the cfe-commits mailing list