This revision was not accepted when it landed; it landed in state "Needs
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG159073bc0a87: [clang-repl] Support compound statement as a
top-level statement. (authored by v.g.vassilev).
Herald added a project: clang.
Changed prior to commit:
https://reviews.llvm.org/D139798?vs=481945&id=498279#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139798/new/
https://reviews.llvm.org/D139798
Files:
clang/lib/Parse/ParseDecl.cpp
clang/test/Interpreter/execute-stmts.cpp
Index: clang/test/Interpreter/execute-stmts.cpp
===================================================================
--- clang/test/Interpreter/execute-stmts.cpp
+++ clang/test/Interpreter/execute-stmts.cpp
@@ -34,5 +34,10 @@
for (; i > 4; --i) printf("i = %d\n", i);
// CHECK-NEXT: i = 5
+{++i;}
+
+for (; i > 4; --i) { printf("i = %d\n", i); };
+// CHECK-NEXT: i = 5
+
int j = i; printf("j = %d\n", j);
// CHECK-NEXT: j = 4
Index: clang/lib/Parse/ParseDecl.cpp
===================================================================
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -5400,7 +5400,9 @@
// Parse a top-level-stmt.
Parser::StmtVector Stmts;
ParsedStmtContext SubStmtCtx = ParsedStmtContext();
+ Actions.PushFunctionScope();
StmtResult R = ParseStatementOrDeclaration(Stmts, SubStmtCtx);
+ Actions.PopFunctionScopeInfo();
if (!R.isUsable())
return nullptr;
Index: clang/test/Interpreter/execute-stmts.cpp
===================================================================
--- clang/test/Interpreter/execute-stmts.cpp
+++ clang/test/Interpreter/execute-stmts.cpp
@@ -34,5 +34,10 @@
for (; i > 4; --i) printf("i = %d\n", i);
// CHECK-NEXT: i = 5
+{++i;}
+
+for (; i > 4; --i) { printf("i = %d\n", i); };
+// CHECK-NEXT: i = 5
+
int j = i; printf("j = %d\n", j);
// CHECK-NEXT: j = 4
Index: clang/lib/Parse/ParseDecl.cpp
===================================================================
--- clang/lib/Parse/ParseDecl.cpp
+++ clang/lib/Parse/ParseDecl.cpp
@@ -5400,7 +5400,9 @@
// Parse a top-level-stmt.
Parser::StmtVector Stmts;
ParsedStmtContext SubStmtCtx = ParsedStmtContext();
+ Actions.PushFunctionScope();
StmtResult R = ParseStatementOrDeclaration(Stmts, SubStmtCtx);
+ Actions.PopFunctionScopeInfo();
if (!R.isUsable())
return nullptr;
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits