Author: Boaz Brickner Date: 2024-11-20T08:59:43+01:00 New Revision: 560dd940f5731fc255b67dde076427cabcddb149
URL: https://github.com/llvm/llvm-project/commit/560dd940f5731fc255b67dde076427cabcddb149 DIFF: https://github.com/llvm/llvm-project/commit/560dd940f5731fc255b67dde076427cabcddb149.diff LOG: [clang] [NFC] In GetDiagForGotoScopeDecl(), limit Init to inside the if condition (#116080) Added: Modified: clang/lib/Sema/JumpDiagnostics.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp index 8c830769a969cd..d465599450e7ff 100644 --- a/clang/lib/Sema/JumpDiagnostics.cpp +++ b/clang/lib/Sema/JumpDiagnostics.cpp @@ -179,9 +179,9 @@ static ScopePair GetDiagForGotoScopeDecl(Sema &S, const Decl *D) { } } - const Expr *Init = VD->getInit(); - if (S.Context.getLangOpts().CPlusPlus && VD->hasLocalStorage() && Init && - !Init->containsErrors()) { + if (const Expr *Init = VD->getInit(); S.Context.getLangOpts().CPlusPlus && + VD->hasLocalStorage() && Init && + !Init->containsErrors()) { // C++11 [stmt.dcl]p3: // A program that jumps from a point where a variable with automatic // storage duration is not in scope to a point where it is in scope _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits