[PATCH] D123674: Clang-Repl Error Recovery Bug Fix
Purva Chaudhari via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 11 05:08:20 PDT 2022
Purva-Chaudhari updated this revision to Diff 436129.
Purva-Chaudhari added a comment.
Fix asan test fail
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123674/new/
https://reviews.llvm.org/D123674
Files:
clang/lib/Interpreter/IncrementalParser.cpp
clang/test/Interpreter/errorRecovery.cpp
Index: clang/test/Interpreter/errorRecovery.cpp
===================================================================
--- /dev/null
+++ clang/test/Interpreter/errorRecovery.cpp
@@ -0,0 +1,16 @@
+// RUN: clang-repl "int x = 12;" 'extern "C" int printf(const char*,...);' \
+// RUN: 'auto r1 = printf("x = %d\n", x);' | FileCheck --check-prefix=CHECK-DRIVER %s
+// REQUIRES: host-supports-jit
+// UNSUPPORTED: system-aix
+// CHECK-DRIVER: x = 12
+// RUN: cat %s | clang-repl | FileCheck %s
+extern "C" int printf(const char *, ...);
+int x = 5;
+auto r1 = printf("x = %d\n", x);
+// CHECK: x = 5
+
+int y = 10; err;
+int y = 11;
+auto r2 = printf("y = %d\n", y);
+// CHECK-NEXT: y = 11
+quit
Index: clang/lib/Interpreter/IncrementalParser.cpp
===================================================================
--- clang/lib/Interpreter/IncrementalParser.cpp
+++ clang/lib/Interpreter/IncrementalParser.cpp
@@ -188,7 +188,7 @@
S.TUScope->setEntity(PreviousTU);
// Clean up the lookup table
- if (StoredDeclsMap *Map = PreviousTU->getLookupPtr()) {
+ if (StoredDeclsMap *Map = PreviousTU->getPrimaryContext()->getLookupPtr()) {
for (auto I = Map->begin(); I != Map->end(); ++I) {
StoredDeclsList &List = I->second;
DeclContextLookupResult R = List.getLookupResult();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123674.436129.patch
Type: text/x-patch
Size: 1316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220611/aa04a973/attachment.bin>
More information about the cfe-commits
mailing list