| 1 |
//===- CheckExprLifetime.h ----------------------------------- -*- C++ -*-===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
//===----------------------------------------------------------------------===// |
| 7 |
// |
| 8 |
// This files implements a statement-local lifetime analysis. |
| 9 |
// |
| 10 |
//===----------------------------------------------------------------------===// |
| 11 |
|
| 12 |
#ifndef LLVM_CLANG_SEMA_CHECK_EXPR_LIFETIME_H |
| 13 |
#define LLVM_CLANG_SEMA_CHECK_EXPR_LIFETIME_H |
| 14 |
|
| 15 |
#include "clang/AST/Expr.h" |
| 16 |
#include "clang/Sema/Initialization.h" |
| 17 |
#include "clang/Sema/Sema.h" |
| 18 |
|
| 19 |
namespace clang::sema { |
| 20 |
|
| 21 |
/// Describes an entity that is being assigned. |
| 22 |
struct AssignedEntity { |
| 23 |
// The left-hand side expression of the assignment. |
| 24 |
Expr *LHS = nullptr; |
| 25 |
}; |
| 26 |
|
| 27 |
/// Check that the lifetime of the given expr (and its subobjects) is |
| 28 |
/// sufficient for initializing the entity, and perform lifetime extension |
| 29 |
/// (when permitted) if not. |
| 30 |
void checkExprLifetime(Sema &SemaRef, const InitializedEntity &Entity, |
| 31 |
Expr *Init); |
| 32 |
|
| 33 |
/// Check that the lifetime of the given expr (and its subobjects) is |
| 34 |
/// sufficient for assigning to the entity. |
| 35 |
void checkExprLifetime(Sema &SemaRef, const AssignedEntity &Entity, Expr *Init); |
| 36 |
|
| 37 |
} // namespace clang::sema |
| 38 |
|
| 39 |
#endif // LLVM_CLANG_SEMA_CHECK_EXPR_LIFETIME_H |