aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorHaojian Wu <hokein.wu@gmail.com>2024-12-19 12:19:02 +0100
committerHaojian Wu <hokein.wu@gmail.com>2024-12-19 13:05:57 +0100
commiteace8269d9aeb67013d273735ec1be1002a6fac1 (patch)
treee392b6a061faa295bc2b5ecb4ffdd19c466c65f5 /clang/lib
parent23377890d022eb1fa9cb42eba5c4f72a1f8ac38d (diff)
downloadllvm-eace8269d9aeb67013d273735ec1be1002a6fac1.zip
llvm-eace8269d9aeb67013d273735ec1be1002a6fac1.tar.gz
llvm-eace8269d9aeb67013d273735ec1be1002a6fac1.tar.bz2
[clang] NFC, simplify the shouldLifetimeExtendThroughPath.
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/CheckExprLifetime.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp
index 843fdb4..add6d75 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.