SERVER-105887Open
Annotate BSONElement and BSONObj APIs with [[clang::lifetimebound]]
{{BSONElement}} instances are always views into a subset of a buffer containing a BSON document which is owned by a different object, and {{BSONObj}} instances are sometimes views of the entire documents to which they refer. We currently lack any compile-time protections against temporal memory misuses of these types due to referencing underlying buffers after their owning objects have been destroyed. Investigate solving these temporal memory misuses by annotating the {{BSONElement}} and {{BSONO