[clang] eace826 - [clang] NFC, simplify the shouldLifetimeExtendThroughPath.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 19 04:06:13 PST 2024
Author: Haojian Wu
Date: 2024-12-19T13:05:57+01:00
New Revision: eace8269d9aeb67013d273735ec1be1002a6fac1
URL: https://github.com/llvm/llvm-project/commit/eace8269d9aeb67013d273735ec1be1002a6fac1
DIFF: https://github.com/llvm/llvm-project/commit/eace8269d9aeb67013d273735ec1be1002a6fac1.diff
LOG: [clang] NFC, simplify the shouldLifetimeExtendThroughPath.
Added:
Modified:
clang/lib/Sema/CheckExprLifetime.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp
index 843fdb4a65cd73..add6d7506bd6f0 100644
--- a/clang/lib/Sema/CheckExprLifetime.cpp
+++ b/clang/lib/Sema/CheckExprLifetime.cpp
@@ -1091,14 +1091,13 @@ enum PathLifetimeKind {
/// supposed to lifetime-extend along.
static PathLifetimeKind
shouldLifetimeExtendThroughPath(const IndirectLocalPath &Path) {
- PathLifetimeKind Kind = PathLifetimeKind::Extend;
for (auto Elem : Path) {
if (Elem.Kind == IndirectLocalPathEntry::DefaultInit)
return PathLifetimeKind::Extend;
- else if (Elem.Kind != IndirectLocalPathEntry::LambdaCaptureInit)
+ if (Elem.Kind != IndirectLocalPathEntry::LambdaCaptureInit)
return PathLifetimeKind::NoExtend;
}
- return Kind;
+ return PathLifetimeKind::Extend;
}
/// Find the range for the first interesting entry in the path at or after I.
More information about the cfe-commits
mailing list