[all-commits] [llvm/llvm-project] e7f422: Add clang::lifetimebound annotation to ArrayRef co...

Haojian Wu via All-commits all-commits at lists.llvm.org
Mon Oct 28 00:39:18 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e7f422d5c2ea05704eaab2cdd67a8b1ebc55e95b
      https://github.com/llvm/llvm-project/commit/e7f422d5c2ea05704eaab2cdd67a8b1ebc55e95b
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2024-10-28 (Mon, 28 Oct 2024)

  Changed paths:
    M llvm/include/llvm/ADT/ArrayRef.h
    M llvm/include/llvm/Support/Compiler.h

  Log Message:
  -----------
  Add clang::lifetimebound annotation to ArrayRef constructors. (#113547)

This enables clang to detect more dangling issues.

```
ArrayRef<int> func() {
   constexpr int array[] = {...}; // oops, missing the static
   return array; // return a dangling reference, bomb.
}
```

See #113533.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list