Author: Jorge Gorbe Moya
Date: 2022-07-12T16:46:58-07:00
New Revision: ee88c0cf09969ba44307068797e12533b94768a6

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

LOG: [NFCI] Fix unused variable/function warnings in 
MacroCallReconstructorTest.cpp when asserts are disabled.

Added: 
    

Modified: 
    clang/unittests/Format/MacroCallReconstructorTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp 
b/clang/unittests/Format/MacroCallReconstructorTest.cpp
index 2bda62aa42be..3abe0383aeae 100644
--- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
+++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
@@ -91,14 +91,6 @@ struct Chunk {
   llvm::SmallVector<UnwrappedLine, 0> Children;
 };
 
-bool tokenMatches(const FormatToken *Left, const FormatToken *Right) {
-  if (Left->getType() == Right->getType() &&
-      Left->TokenText == Right->TokenText)
-    return true;
-  llvm::dbgs() << Left->TokenText << " != " << Right->TokenText << "\n";
-  return false;
-}
-
 // Allows to produce chunks of a token list by typing the code of equal tokens.
 //
 // Created from a list of tokens, users call "consume" to get the next chunk
@@ -110,7 +102,9 @@ struct Matcher {
   Chunk consume(StringRef Tokens) {
     TokenList Result;
     for (const FormatToken *Token : uneof(Lex.lex(Tokens))) {
-      assert(tokenMatches(*It, Token));
+      (void)Token;  // Fix unused variable warning when asserts are disabled.
+      assert((*It)->getType() == Token->getType() &&
+             (*It)->TokenText == Token->TokenText);
       Result.push_back(*It);
       ++It;
     }


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to