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();


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();
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to