[clang] [clang] Introduce [[clang::lifetime_capture_by(X)]] (PR #111499)
Boaz Brickner via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 00:50:41 PDT 2024
================
@@ -1091,21 +1104,22 @@ static bool isAssignmentOperatorLifetimeBound(CXXMethodDecl *CMD) {
}
static bool shouldRunGSLAssignmentAnalysis(const Sema &SemaRef,
- const AssignedEntity &Entity) {
+ const CapturingEntity &Entity) {
bool EnableGSLAssignmentWarnings = !SemaRef.getDiagnostics().isIgnored(
diag::warn_dangling_lifetime_pointer_assignment, SourceLocation());
return (EnableGSLAssignmentWarnings &&
- (isRecordWithAttr<PointerAttr>(Entity.LHS->getType()) ||
+ (isRecordWithAttr<PointerAttr>(Entity.Expression->getType()) ||
isAssignmentOperatorLifetimeBound(Entity.AssignmentOperator)));
}
static void checkExprLifetimeImpl(Sema &SemaRef,
const InitializedEntity *InitEntity,
const InitializedEntity *ExtendingEntity,
LifetimeKind LK,
- const AssignedEntity *AEntity, Expr *Init) {
- assert((AEntity && LK == LK_Assignment) ||
- (InitEntity && LK != LK_Assignment));
+ const CapturingEntity *CEntity, Expr *Init) {
----------------
bricknerb wrote:
Can we name CEntity with something more readable?
Perhaps even CaptEntity?
https://github.com/llvm/llvm-project/pull/111499
More information about the cfe-commits
mailing list