[clang] 1d3873d - Move variable only used inside an assert into the assert.

Sterling Augustine via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 10 13:15:07 PDT 2021


Author: Sterling Augustine
Date: 2021-06-10T13:14:45-07:00
New Revision: 1d3873d41eca67e974bafbaa91866581bcc0d973

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

LOG: Move variable only used inside an assert into the assert.

This prevents build failures with -Wunused.

Added: 
    

Modified: 
    clang/lib/Serialization/ASTReaderStmt.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp
index 62d7a99b52c7..b100f946f558 100644
--- a/clang/lib/Serialization/ASTReaderStmt.cpp
+++ b/clang/lib/Serialization/ASTReaderStmt.cpp
@@ -3206,8 +3206,7 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
     }
 
     case STMT_OMP_UNROLL_DIRECTIVE: {
-      unsigned NumLoops = Record[ASTStmtReader::NumStmtFields];
-      assert(NumLoops == 1 && "Unroll directive accepts only a single loop");
+      assert(Record[ASTStmtReader::NumStmtFields] == 1 && "Unroll directive accepts only a single loop");
       unsigned NumClauses = Record[ASTStmtReader::NumStmtFields + 1];
       S = OMPUnrollDirective::CreateEmpty(Context, NumClauses);
       break;


        


More information about the cfe-commits mailing list