forked from OSchip/llvm-project
[clang-repl] Recover the lookup tables of the primary context.
Before this patch, there was re-declaration error if error was encountered in the same line. The recovery support acted only if this type of error was encountered in the first line of the program and not in subsequent lines. For example: ``` clang-repl> int i=9; clang-repl> int j=9; err; input_line_3:1:5: error: redefinition of 'j' int j = 9; ``` Differential revision: https://reviews.llvm.org/D123674
This commit is contained in:
parent
41a054ef78
commit
5ff27fe1ff
|
@ -188,7 +188,7 @@ IncrementalParser::ParseOrWrapTopLevelDecl() {
|
|||
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();
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// RUN: clang-repl "int x = 10;" "int y=7; err;" "int y = 10;"
|
||||
// RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \
|
||||
// RUN: 'auto r1 = printf("i = %d\n", i);' | FileCheck --check-prefix=CHECK-DRIVER %s
|
||||
// REQUIRES: host-supports-jit
|
||||
|
|
Loading…
Reference in New Issue