aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2022-05-10 16:29:15 +0200
committerJon Atack <jon@atack.com>2022-05-10 16:29:26 +0200
commit654284209f30fd309c326a527cda1d2d7385cee8 (patch)
treee33f6ceb349b019b72829a20d6cebdf258b76427 /doc
parente66b321fd1ddfffd9bfc59d407ad8f03490b873c (diff)
Add clang lifetimebound section to developer notes
Diffstat (limited to 'doc')
-rw-r--r--doc/developer-notes.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index ef40265818..ddbbd0709b 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -32,6 +32,7 @@ Developer Notes
- [C++ data structures](#c-data-structures)
- [Strings and formatting](#strings-and-formatting)
- [Shadowing](#shadowing)
+ - [Lifetimebound](#lifetimebound)
- [Threads and synchronization](#threads-and-synchronization)
- [Scripts](#scripts)
- [Shebang](#shebang)
@@ -885,6 +886,16 @@ please name variables so that their names do not shadow variables defined in the
When using nested cycles, do not name the inner cycle variable the same as in
the outer cycle, etc.
+Lifetimebound
+--------------
+
+The [Clang `lifetimebound`
+attribute](https://clang.llvm.org/docs/AttributeReference.html#lifetimebound)
+can be used to tell the compiler that a lifetime is bound to an object and
+potentially see a compile-time warning if the object has a shorter lifetime from
+the invalid use of a temporary. You can use the attribute by adding a `LIFETIMEBOUND`
+annotation defined in `src/attributes.h`; please grep the codebase for examples.
+
Threads and synchronization
----------------------------