Skip to content

Commit 560dd94

Browse files
authored
[clang] [NFC] In GetDiagForGotoScopeDecl(), limit Init to inside the if condition (#116080)
1 parent 1ff22f8 commit 560dd94

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/lib/Sema/JumpDiagnostics.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ static ScopePair GetDiagForGotoScopeDecl(Sema &S, const Decl *D) {
179179
}
180180
}
181181

182-
const Expr *Init = VD->getInit();
183-
if (S.Context.getLangOpts().CPlusPlus && VD->hasLocalStorage() && Init &&
184-
!Init->containsErrors()) {
182+
if (const Expr *Init = VD->getInit(); S.Context.getLangOpts().CPlusPlus &&
183+
VD->hasLocalStorage() && Init &&
184+
!Init->containsErrors()) {
185185
// C++11 [stmt.dcl]p3:
186186
// A program that jumps from a point where a variable with automatic
187187
// storage duration is not in scope to a point where it is in scope

0 commit comments

Comments
 (0)