Commit ff48b1e
Annotate net-new Snapshot-borrow accessors with [[clang::lifetimebound]]
Summary:
Adds [[clang::lifetimebound]] to the borrow-returning folly::observer snapshot accessors NOT
already covered by the D109704537 stack, so the compiler (-Wdangling / -Wreturn-stack-address)
catches consumers that bind a reference/pointer into a snapshot that does not outlive it:
- TLObserver::getSnapshotRef() / operator*() (Observer.h)
- HazptrObserver::HazptrSnapshot operator*/->/get (HazptrObserver.h)
- CoreCachedObserver::CoreCachedSnapshot operator*/->/get (CoreCachedObserver.h)
Snapshot::operator*/->/get are annotated separately by the D109704537 stack.
The single consumer this surfaced -- luna/quorumlib QuorumConfig::getConfigName returning a
const std::string& into a temporary snapshot -- is fixed in the parent diff D109961109; with it
in the stack, full CI is green.
Reviewed By: r-barnes
Differential Revision: D109953065
fbshipit-source-id: 8e9cb2d93b658960e0a7d1f94867910664be97411 parent 5b42321 commit ff48b1e
3 files changed
Lines changed: 23 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
61 | | - | |
62 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
418 | 419 | | |
419 | 420 | | |
420 | 421 | | |
421 | | - | |
422 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
423 | 426 | | |
424 | 427 | | |
425 | 428 | | |
| |||
0 commit comments