mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-02 08:45:54 +01:00
When diagnosing a problem with C++ code imported from Carbon, include the location of the specific `import Cpp` statement that imported the C++ code as part of the backtrace, rather than providing a location in a generated file that doesn't exist on disk. Also fix handling in autoupdate of check lines that contain multiple file name and line number pairs to use the matched file name for remapping of locations rather than the first file name in the line.
44 lines
1.7 KiB
Plaintext
44 lines
1.7 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/bad_import.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/bad_import.carbon
|
|
|
|
// --- fail_import_cpp.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
// CHECK:STDERR: fail_import_cpp.carbon:[[@LINE+4]]:1: error: `Cpp` import missing library [CppInteropMissingLibrary]
|
|
// CHECK:STDERR: import Cpp;
|
|
// CHECK:STDERR: ^~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
import Cpp;
|
|
|
|
// --- fail_import_cpp_library_empty.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
// CHECK:STDERR: fail_import_cpp_library_empty.carbon:[[@LINE+4]]:1: error: `Cpp` import missing library [CppInteropMissingLibrary]
|
|
// CHECK:STDERR: import Cpp library "";
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
import Cpp library "";
|
|
|
|
// --- fail_import_cpp_library_file_with_quotes.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
// CHECK:STDERR: fail_import_cpp_library_file_with_quotes.carbon:[[@LINE+6]]:1: in import [InImport]
|
|
// CHECK:STDERR: fail_import_cpp_library_file_with_quotes.carbon:[[@LINE+5]]: error: fail_import_cpp_library_file_with_quotes.carbon:[[@LINE+5]]:10: fatal error: '\"foo.h\"' file not found
|
|
// CHECK:STDERR: 10 | #include "\"foo.h\""
|
|
// CHECK:STDERR: | ^~~~~~~~~~~
|
|
// CHECK:STDERR: [CppInteropParseError]
|
|
// CHECK:STDERR:
|
|
import Cpp library "\"foo.h\"";
|