File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -4008,6 +4008,22 @@ The attribute supports specifying more than one capturing entities:
4008
4008
s2.insert(a);
4009
4009
}
4010
4010
4011
+ Limitation: The capturing entity ``X`` is not used by the analysis and is
4012
+ used for documentation purposes only. This is because the analysis is
4013
+ statement-local and only detects use of a temporary as an argument to the
4014
+ annotated parameter.
4015
+
4016
+ .. code-block:: c++
4017
+
4018
+ void addToSet(std::string_view a [[clang::lifetime_capture_by(s)]], std::set<std::string_view>& s);
4019
+ void use() {
4020
+ std::set<std::string_view> s;
4021
+ if (foo()) {
4022
+ std::string str;
4023
+ addToSet(str, s); // Not detected.
4024
+ }
4025
+ }
4026
+
4011
4027
.. _`lifetimebound`: https://clang.llvm.org/docs/AttributeReference.html#lifetimebound
4012
4028
}];
4013
4029
}
Original file line number Diff line number Diff line change 2
2
3
3
#include " Inputs/lifetime-analysis.h"
4
4
5
- struct X {
6
- const int *x;
7
- };
5
+ struct X {} x;
8
6
X x;
9
7
10
8
// ****************************************************************************
You can’t perform that action at this time.
0 commit comments