[Preprocessor] Fix warning: left and right subexpressions are identical. NFCI.
authorMichael Kruse <llvm-project@meinersbur.de>
Fri, 5 Nov 2021 05:13:49 +0000 (00:13 -0500)
committerMichael Kruse <llvm-project@meinersbur.de>
Fri, 5 Nov 2021 05:43:40 +0000 (00:43 -0500)
This is reported by msvc as
warning C6287: redundant code: the left and right subexpressions are identical

EmittedDirectiveOnThisLine implies EmittedTokensOnThisLine
making this an NFC change. To be on the safe side and because both of
them are checked at other places as well, we continue to check both.

Compiler warning reported here:
https://reviews.llvm.org/D104601#2957333

clang/lib/Frontend/PrintPreprocessedOutput.cpp

index 360fa14..fadf0c0 100644 (file)
@@ -700,7 +700,7 @@ void PrintPPOutputPPCallbacks::HandleWhitespaceBeforeTok(const Token &Tok,
     // - The whitespace is necessary to keep the tokens apart and there is not
     //   already a newline between them
     if (RequireSpace || (!MinimizeWhitespace && Tok.hasLeadingSpace()) ||
-        ((EmittedTokensOnThisLine || EmittedTokensOnThisLine) &&
+        ((EmittedTokensOnThisLine || EmittedDirectiveOnThisLine) &&
          AvoidConcat(PrevPrevTok, PrevTok, Tok)))
       OS << ' ';
   }