[all-commits] [llvm/llvm-project] f484a0: [clang] Suppress a dangling false positive when ow...

Haojian Wu via All-commits all-commits at lists.llvm.org
Fri Nov 1 05:33:18 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f484a04d796123097572c5c2089fefa28e951747
      https://github.com/llvm/llvm-project/commit/f484a04d796123097572c5c2089fefa28e951747
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2024-11-01 (Fri, 01 Nov 2024)

  Changed paths:
    M clang/lib/Sema/CheckExprLifetime.cpp
    M clang/test/Sema/warn-lifetime-analysis-nocfg.cpp

  Log Message:
  -----------
  [clang] Suppress a dangling false positive when owner is moved in member initializer. (#114213)

This patch extends the filtering heuristic to apply for the
Lifetimebound code path.

This will suppress a common false positive:

```
namespace std {
template<typename T>
struct unique_ptr {
  T &operator*();
  T *get() const [[clang::lifetimebound]];
};
} // namespace std

struct X {
  X(std::unique_ptr<int> up) :
    pointer(up.get()), owner(std::move(up)) {}

  int *pointer;
  std::unique_ptr<int> owner;
};
```

See #114201.



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