[clang] 25bd9e1 - [clang][parse] Avoid creating StmtVectors every loop iteration

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 18 07:19:35 PST 2022


Author: Timm Bäder
Date: 2022-11-18T16:19:09+01:00
New Revision: 25bd9e10098a91623b63952967b6561d77f43c15

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

LOG: [clang][parse] Avoid creating StmtVectors every loop iteration

Added: 
    

Modified: 
    clang/lib/Parse/ParseStmt.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index 8610abb849476..6a50f83894304 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -37,8 +37,8 @@ StmtResult Parser::ParseStatement(SourceLocation *TrailingElseLoc,
 
   // We may get back a null statement if we found a #pragma. Keep going until
   // we get an actual statement.
+  StmtVector Stmts;
   do {
-    StmtVector Stmts;
     Res = ParseStatementOrDeclaration(Stmts, StmtCtx, TrailingElseLoc);
   } while (!Res.isInvalid() && !Res.get());
 


        


More information about the cfe-commits mailing list