https://github.com/yuxuanchen1997 created https://github.com/llvm/llvm-project/pull/119903
https://github.com/llvm/llvm-project/commit/30ad53b92cec0cff9679d559edcc5b933312ba0c introduced a new test that includes <vector> from the system include path without honoring environment variables that may provide the path to C++ standard library. This is not supported in some CI systems because we don't always have a <vector> in standard location. The conventional way of doing includes in the test is through `Inputs` directory and pass it as an include path. The `vector` file included in this patch has been shortened, but I have verified that it works with this test. i.e. the clang repl crashes on this test in the same way if the fix in https://github.com/llvm/llvm-project/pull/117475 is reverted. >From 2ed046e0819189e1f8d6cdef57fc6458a2a80b99 Mon Sep 17 00:00:00 2001 From: Yuxuan Chen <yuxuanchen1...@outlook.com> Date: Fri, 13 Dec 2024 09:09:14 -0800 Subject: [PATCH] [clang] test should not depend on system header --- clang/test/Interpreter/Inputs/vector | 8 ++++++++ clang/test/Interpreter/crash.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 clang/test/Interpreter/Inputs/vector diff --git a/clang/test/Interpreter/Inputs/vector b/clang/test/Interpreter/Inputs/vector new file mode 100644 index 00000000000000..2add83c58e0d17 --- /dev/null +++ b/clang/test/Interpreter/Inputs/vector @@ -0,0 +1,8 @@ +#ifndef VECTOR +#define VECTOR +template <typename> +class vector { +public: + vector(); +}; +#endif // VECTOR diff --git a/clang/test/Interpreter/crash.cpp b/clang/test/Interpreter/crash.cpp index 1ab24b0febfa15..9a606983524d82 100644 --- a/clang/test/Interpreter/crash.cpp +++ b/clang/test/Interpreter/crash.cpp @@ -5,7 +5,7 @@ // // RUN: split-file %s %t // -// RUN: %clang++ -std=c++20 -fPIC -c %t/vec.cpp -o %t/vec.o +// RUN: %clang++ -Xclang -nostdsysteminc -I%S/Inputs/ -std=c++20 -fPIC -c %t/vec.cpp -o %t/vec.o // RUN: %clang++ -shared %t/vec.o -o %t/vec.so // // RUN: cat %t/Test.cpp | LD_LIBRARY_PATH=%t:$LD_LIBRARY_PATH clang-repl _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits