Skip to content

Commit 6542842

Browse files
committed
Add clang lifetimebound section to developer notes
1 parent e66b321 commit 6542842

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doc/developer-notes.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Developer Notes
3232
- [C++ data structures](#c-data-structures)
3333
- [Strings and formatting](#strings-and-formatting)
3434
- [Shadowing](#shadowing)
35+
- [Lifetimebound](#lifetimebound)
3536
- [Threads and synchronization](#threads-and-synchronization)
3637
- [Scripts](#scripts)
3738
- [Shebang](#shebang)
@@ -885,6 +886,16 @@ please name variables so that their names do not shadow variables defined in the
885886
When using nested cycles, do not name the inner cycle variable the same as in
886887
the outer cycle, etc.
887888
889+
Lifetimebound
890+
--------------
891+
892+
The [Clang `lifetimebound`
893+
attribute](https://clang.llvm.org/docs/AttributeReference.html#lifetimebound)
894+
can be used to tell the compiler that a lifetime is bound to an object and
895+
potentially see a compile-time warning if the object has a shorter lifetime from
896+
the invalid use of a temporary. You can use the attribute by adding a `LIFETIMEBOUND`
897+
annotation defined in `src/attributes.h`; please grep the codebase for examples.
898+
888899
Threads and synchronization
889900
----------------------------
890901

0 commit comments

Comments
 (0)