Skip to content

Commit 52ce95a

Browse files
ken-matsuihubert-reinterpretcast
authored andcommitted
[NFC] Prevent shadowing a variable declared in if
Prevents confusion over which `S` is referenced in the final `else` branch if such use is added. Reviewed By: hubert.reinterpretcast Differential Revision: https://reviews.llvm.org/D124556
1 parent beff64e commit 52ce95a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/lib/Basic/Diagnostic.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -983,13 +983,13 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd,
983983
if (const char *S = tok::getPunctuatorSpelling(Kind))
984984
// Quoted token spelling for punctuators.
985985
Out << '\'' << S << '\'';
986-
else if (const char *S = tok::getKeywordSpelling(Kind))
986+
else if ((S = tok::getKeywordSpelling(Kind)))
987987
// Unquoted token spelling for keywords.
988988
Out << S;
989-
else if (const char *S = getTokenDescForDiagnostic(Kind))
989+
else if ((S = getTokenDescForDiagnostic(Kind)))
990990
// Unquoted translatable token name.
991991
Out << S;
992-
else if (const char *S = tok::getTokenName(Kind))
992+
else if ((S = tok::getTokenName(Kind)))
993993
// Debug name, shouldn't appear in user-facing diagnostics.
994994
Out << '<' << S << '>';
995995
else

0 commit comments

Comments
 (0)