diff --git a/lib/Interpreter/ClangInternalState.cpp b/lib/Interpreter/ClangInternalState.cpp index 46ff119e..071bff20 100644 --- a/lib/Interpreter/ClangInternalState.cpp +++ b/lib/Interpreter/ClangInternalState.cpp @@ -164,8 +164,11 @@ namespace cling { differentContent(m_LookupTablesFile, m_DiffPair->m_LookupTablesFile, "lookup tables", verbose, &builtinNames); + // We create a virtual file for each input line in the format input_line_N. + llvm::SmallVector input_lines; + input_lines.push_back("input_line_[0-9].*"); differentContent(m_IncludedFilesFile, m_DiffPair->m_IncludedFilesFile, - "included files", verbose); + "included files", verbose, &input_lines); differentContent(m_ASTFile, m_DiffPair->m_ASTFile, "AST", verbose); diff --git a/lib/Interpreter/IncrementalParser.cpp b/lib/Interpreter/IncrementalParser.cpp index 673bb853..34b85340 100644 --- a/lib/Interpreter/IncrementalParser.cpp +++ b/lib/Interpreter/IncrementalParser.cpp @@ -700,20 +700,14 @@ namespace cling { // Create FileID for the current buffer. FileID FID; - if (CO.CodeCompletionOffset == -1) - { - FID = SM.createFileID(std::move(MB), SrcMgr::C_User, - /*LoadedID*/0, - /*LoadedOffset*/0, NewLoc); - } else { - // Create FileEntry and FileID for the current buffer. - // Enabling the completion point only works on FileEntries. - const clang::FileEntry* FE - = SM.getFileManager().getVirtualFile("vfile for " + source_name.str(), - InputSize, 0 /* mod time*/); - SM.overrideFileContents(FE, std::move(MB)); - FID = SM.createFileID(FE, NewLoc, SrcMgr::C_User); - + // Create FileEntry and FileID for the current buffer. + // Enabling the completion point only works on FileEntries. + const clang::FileEntry* FE + = SM.getFileManager().getVirtualFile(source_name.str(), InputSize, + 0 /* mod time*/); + SM.overrideFileContents(FE, std::move(MB)); + FID = SM.createFileID(FE, NewLoc, SrcMgr::C_User); + if (CO.CodeCompletionOffset != -1) { // The completion point is set one a 1-based line/column numbering. // It relies on the implementation to account for the wrapper extra line. PP.SetCodeCompletionPoint(FE, 1/* start point 1-based line*/, diff --git a/test/Autoloading/Incomplete.C b/test/Autoloading/Incomplete.C index 83d8ed76..edf0d3b9 100644 --- a/test/Autoloading/Incomplete.C +++ b/test/Autoloading/Incomplete.C @@ -10,8 +10,7 @@ // Test incompleteType .rawInput 1 -class __attribute__((annotate("Def.h"))) C; -//expected-note + {{}} +class __attribute__((annotate("Def.h"))) C; //expected-note + {{}} .rawInput 0 C c; //expected-error {{variable has incomplete type 'C'}} expected-warning@1 0+ {{Note: 'C' can be found in Def.h}} diff --git a/test/CodeUnloading/Simple.C b/test/CodeUnloading/Simple.C index 7db050f7..62a5b767 100644 --- a/test/CodeUnloading/Simple.C +++ b/test/CodeUnloading/Simple.C @@ -18,9 +18,8 @@ int f = 0; int f() { printf("Now f is a function\n"); return 0; -} int a = f(); +} int a = f(); //CHECK: Now f is a function .undo -//CHECK: Now f is a function .compareState "preUnload" //CHECK-NOT: Differences double f = 3.14 diff --git a/test/Driver/NoStdInc.C b/test/Driver/NoStdInc.C index 847aa012..fd55f99f 100644 --- a/test/Driver/NoStdInc.C +++ b/test/Driver/NoStdInc.C @@ -14,7 +14,7 @@ // RUN: cat %s | %cling -nostdinc++ -Xclang -verify 2>&1 | FileCheck %s // Test nobuiltinincTest -// expected-error@1 {{'new' file not found}} +// expected-error@input_line_1:1 {{'new' file not found}} // CHECK: Warning in cling::IncrementalParser::CheckABICompatibility(): // CHECK: Possible C++ standard library mismatch, compiled with {{.*$}} diff --git a/test/ErrorRecovery/ABI.C b/test/ErrorRecovery/ABI.C index 1e18bd85..90398933 100644 --- a/test/ErrorRecovery/ABI.C +++ b/test/ErrorRecovery/ABI.C @@ -8,7 +8,7 @@ // RUN: cat %s | %cling -nostdinc++ -nobuiltininc -Xclang -verify 2>&1 | FileCheck %s -// expected-error {{'new' file not found}} +// expected-error@input_line_1:1 {{'new' file not found}} // CHECK: Warning in cling::IncrementalParser::CheckABICompatibility(): // CHECK: Possible C++ standard library mismatch, compiled with diff --git a/test/ErrorRecovery/MacroExpansion.C b/test/ErrorRecovery/MacroExpansion.C index 72b8b830..d6410b57 100644 --- a/test/ErrorRecovery/MacroExpansion.C +++ b/test/ErrorRecovery/MacroExpansion.C @@ -13,10 +13,10 @@ .rawInput 1 -BEGIN_NAMESPACE int j; END_NAMESPACE +BEGIN_NAMESPACE int j; END_NAMESPACE // expected-note {{previous definition is here}} .storeState "testMacroExpansion" -BEGIN_NAMESPACE int j; END_NAMESPACE // expected-error {{redefinition of 'j'}} expected-note {{previous definition is here}} +BEGIN_NAMESPACE int j; END_NAMESPACE // expected-error {{redefinition of 'j'}} .compareState "testMacroExpansion" .rawInput 0 // CHECK-NOT: Differences diff --git a/test/Interfaces/evaluate.C b/test/Interfaces/evaluate.C index 6989b057..558c9fc7 100644 --- a/test/Interfaces/evaluate.C +++ b/test/Interfaces/evaluate.C @@ -56,10 +56,10 @@ V // CHECK: (cling::Value &) boxes [(int *) 0x12 ] gCling->evaluate("gCling->declare(\"double sin(double);\"); double one = sin(3.141/2);", V); V // CHECK: (cling::Value &) boxes [(double) 1.000000] -gCling->process("double one = sin(3.141/2);", &V); +gCling->process("double one = sin(3.141/2); // expected-note {{previous definition is here}}", &V); V // CHECK: (cling::Value &) boxes [(double) 1.000000] one // CHECK: (double) 1 -int one; // expected-error {{redefinition of 'one' with a different type: 'int' vs 'double'}} expected-note {{previous definition is here}} +int one; // expected-error {{redefinition of 'one' with a different type: 'int' vs 'double'}} // Make sure that PR#98434 doesn't get reintroduced. .rawInput diff --git a/test/Pragmas/load.C b/test/Pragmas/load.C index 7b1be3f5..1913e6cc 100644 --- a/test/Pragmas/load.C +++ b/test/Pragmas/load.C @@ -9,7 +9,8 @@ // RUN: clang -shared -DCLING_EXPORT=%dllexport %S/call_lib.c -o%T/libcall_lib%shlibext // RUN: cat %s | %cling -L %T -Xclang -verify 2>&1 | FileCheck %s -#pragma cling load("DoesNotExistPleaseRecover") // expected-error@1{{'DoesNotExistPleaseRecover' file not found}} +#pragma cling load("DoesNotExistPleaseRecover") +// expected-error@input_line_13:1{{'DoesNotExistPleaseRecover' file not found}} #pragma cling load("libcall_lib") extern "C" int cling_testlibrary_function(); diff --git a/test/Prompt/Redeclarations.C b/test/Prompt/Redeclarations.C index 79acb991..c8087fe8 100644 --- a/test/Prompt/Redeclarations.C +++ b/test/Prompt/Redeclarations.C @@ -8,12 +8,12 @@ // RUN: cat %s | %cling -Xclang -verify -class MyClass{}; -class MyClass{} // expected-error {{redefinition of 'MyClass'}} expected-note {{previous definition is here}} -MyClass s; -MyClass s; // expected-error {{redefinition of 's'}} expected-note {{previous definition is here}} +class MyClass{}; // expected-note {{previous definition is here}} +struct MyClass{} // expected-error {{redefinition of 'MyClass'}} +MyClass * s; // expected-note {{previous definition is here}} +MyClass s; // expected-error {{redefinition of 's'}} -const char* a = "test"; -const char* a = ""; // expected-error {{redefinition of 'a'}} expected-note {{previous definition is here}} +const char* a = "test"; // expected-note {{previous definition is here}} +const char* a = ""; // expected-error {{redefinition of 'a'}} .q diff --git a/test/Prompt/ValuePrinter/Regression.C b/test/Prompt/ValuePrinter/Regression.C index ed38e71a..1f152d05 100644 --- a/test/Prompt/ValuePrinter/Regression.C +++ b/test/Prompt/ValuePrinter/Regression.C @@ -105,5 +105,5 @@ auto fn_moo = std::bind (bla, _1,_2,10) // CHECK: ERROR in cling::executePrintVa void f(std::string) {} .rawInput 0 f // CHECK: (void (*)(std::string)) Function @0x{{[0-9a-f]+}} -// CHECK: at :1: +// CHECK: at input_line_{{[0-9].*}}:1: // CHECK: void f(std::string) {}