Skip to content

Commit c8843e5

Browse files
committed
address comments
1 parent 7c28943 commit c8843e5

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

clang/include/clang/Basic/AttrDocs.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3921,9 +3921,9 @@ have their lifetimes extended.
39213921
def LifetimeCaptureByDocs : Documentation {
39223922
let Category = DocCatFunction;
39233923
let Content = [{
3924-
Similar to `lifetimebound`_, the ``lifetime_capture_by(X)`` attribute on a function
3925-
parameter or implicit object parameter indicates that the capturing entity
3926-
``X`` may refer to the object referred by that parameter.
3924+
Similar to `lifetimebound`_, the ``lifetime_capture_by(X)`` attribute on a
3925+
function parameter or implicit object parameter indicates that the capturing
3926+
entity ``X`` may refer to the object referred by that parameter.
39273927

39283928
Below is a list of types of the parameters and what they're considered to refer to:
39293929

clang/lib/Sema/CheckExprLifetime.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,10 +1491,13 @@ void checkAssignmentLifetime(Sema &SemaRef, const AssignedEntity &Entity,
14911491

14921492
void checkCaptureByLifetime(Sema &SemaRef, const CapturingEntity &Entity,
14931493
Expr *Init) {
1494-
return checkExprLifetimeImpl(SemaRef, /*InitEntity=*/nullptr,
1495-
/*ExtendingEntity=*/nullptr, LK_LifetimeCapture,
1496-
/*AEntity=*/nullptr,
1497-
/*CapEntity=*/&Entity, Init);
1494+
if (!SemaRef.getDiagnostics().isIgnored(
1495+
diag::warn_dangling_reference_captured, SourceLocation()))
1496+
return checkExprLifetimeImpl(SemaRef, /*InitEntity=*/nullptr,
1497+
/*ExtendingEntity=*/nullptr,
1498+
LK_LifetimeCapture,
1499+
/*AEntity=*/nullptr,
1500+
/*CapEntity=*/&Entity, Init);
14981501
}
14991502

15001503
} // namespace clang::sema

0 commit comments

Comments
 (0)