Skip to content

Commit d9a88d5

Browse files
mrcvtlMarco Vitale
authored andcommitted
Address feedbacks
1 parent 37c5713 commit d9a88d5

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

clang/include/clang/AST/Decl.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,9 +1589,8 @@ class VarDecl : public DeclaratorDecl, public Redeclarable<VarDecl> {
15891589
NonParmVarDeclBits.IsCXXCondDecl = true;
15901590
}
15911591

1592-
/// Determine whether this variable is the compiler-generated '__range'
1593-
/// variable used to hold the range expression in a C++11 and later for-range
1594-
/// statement.
1592+
/// Whether this variable is the implicit '__range' variable in C++
1593+
/// range-based for loops.
15951594
bool isCXXForRangeImplicitVar() const {
15961595
return isa<ParmVarDecl>(this) ? false
15971596
: NonParmVarDeclBits.IsCXXForRangeImplicitVar;

clang/lib/Sema/CheckExprLifetime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ enum LifetimeKind {
5757
};
5858
using LifetimeResult =
5959
llvm::PointerIntPair<const InitializedEntity *, 3, LifetimeKind>;
60-
6160
} // namespace
6261

6362
/// Determine the declaration which an initialized entity ultimately refers to,
@@ -1344,7 +1343,8 @@ checkExprLifetimeImpl(Sema &SemaRef, const InitializedEntity *InitEntity,
13441343
if (IsGslPtrValueFromGslTempOwner && DiagLoc.isValid()) {
13451344

13461345
if (SemaRef.getLangOpts().CPlusPlus23) {
1347-
if (const VarDecl *VD = cast<VarDecl>(InitEntity->getDecl());
1346+
if (const VarDecl *VD =
1347+
dyn_cast_if_present<VarDecl>(InitEntity->getDecl());
13481348
VD && VD->isCXXForRangeImplicitVar())
13491349
return false;
13501350
}

clang/lib/Sema/SemaStmt.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,9 +2374,6 @@ static bool FinishForRangeVarDecl(Sema &SemaRef, VarDecl *Decl, Expr *Init,
23742374
SemaRef.ObjC().inferObjCARCLifetime(Decl))
23752375
Decl->setInvalidDecl();
23762376

2377-
if (SemaRef.getLangOpts().CPlusPlus23)
2378-
SemaRef.currentEvaluationContext().InLifetimeExtendingContext = true;
2379-
23802377
SemaRef.AddInitializerToDecl(Decl, Init, /*DirectInit=*/false);
23812378
SemaRef.FinalizeDeclaration(Decl);
23822379
SemaRef.CurContext->addHiddenDecl(Decl);

0 commit comments

Comments
 (0)