Skip to content

Commit 2804762

Browse files
committed
[clang][NFC] Use const reference for IndirectLocalPath if possible.
1 parent 0edaba1 commit 2804762

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/Sema/CheckExprLifetime.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,14 @@ using LocalVisitor = llvm::function_ref<bool(IndirectLocalPath &Path, Local L,
226226
ReferenceKind RK)>;
227227
} // namespace
228228

229-
static bool isVarOnPath(IndirectLocalPath &Path, VarDecl *VD) {
229+
static bool isVarOnPath(const IndirectLocalPath &Path, VarDecl *VD) {
230230
for (auto E : Path)
231231
if (E.Kind == IndirectLocalPathEntry::VarInit && E.D == VD)
232232
return true;
233233
return false;
234234
}
235235

236-
static bool pathContainsInit(IndirectLocalPath &Path) {
236+
static bool pathContainsInit(const IndirectLocalPath &Path) {
237237
return llvm::any_of(Path, [=](IndirectLocalPathEntry E) {
238238
return E.Kind == IndirectLocalPathEntry::DefaultInit ||
239239
E.Kind == IndirectLocalPathEntry::VarInit;
@@ -1076,7 +1076,7 @@ static SourceRange nextPathEntryRange(const IndirectLocalPath &Path, unsigned I,
10761076
return E->getSourceRange();
10771077
}
10781078

1079-
static bool pathOnlyHandlesGslPointer(IndirectLocalPath &Path) {
1079+
static bool pathOnlyHandlesGslPointer(const IndirectLocalPath &Path) {
10801080
for (const auto &It : llvm::reverse(Path)) {
10811081
switch (It.Kind) {
10821082
case IndirectLocalPathEntry::VarInit:
@@ -1124,7 +1124,7 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
11241124

11251125
// FIXME: consider moving the TemporaryVisitor and visitLocalsRetained*
11261126
// functions to a dedicated class.
1127-
auto TemporaryVisitor = [&](IndirectLocalPath &Path, Local L,
1127+
auto TemporaryVisitor = [&](const IndirectLocalPath &Path, Local L,
11281128
ReferenceKind RK) -> bool {
11291129
SourceRange DiagRange = nextPathEntryRange(Path, 0, L);
11301130
SourceLocation DiagLoc = DiagRange.getBegin();

0 commit comments

Comments
 (0)