[clang] 8f099d1 - [Preprocessor] Fix warning: left and right subexpressions are identical. NFCI.

Michael Kruse via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 4 22:45:41 PDT 2021


Author: Michael Kruse
Date: 2021-11-05T00:43:40-05:00
New Revision: 8f099d17a1bee857ada3c5af032cfcb559252024

URL: https://github.com/llvm/llvm-project/commit/8f099d17a1bee857ada3c5af032cfcb559252024
DIFF: https://github.com/llvm/llvm-project/commit/8f099d17a1bee857ada3c5af032cfcb559252024.diff

LOG: [Preprocessor] Fix warning: left and right subexpressions are identical. NFCI.

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

Added: 
    

Modified: 
    clang/lib/Frontend/PrintPreprocessedOutput.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index 360fa1448b128..fadf0c054310d 100644
--- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -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 << ' ';
   }


        


More information about the cfe-commits mailing list