summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-02-04 14:59:29 (GMT)
committerBrad King <brad.king@kitware.com>2015-02-04 14:59:29 (GMT)
commit8d8aacd65af229da0cadf81911ffa3ef77db7b57 (patch)
tree7a85fbe387dae1fb9667176fe6ce350df28e09f0 /test
parent1074cb11ebdc29bff2fc7eb633252348e0758106 (diff)
downloadCastXML-8d8aacd65af229da0cadf81911ffa3ef77db7b57.zip
CastXML-8d8aacd65af229da0cadf81911ffa3ef77db7b57.tar.gz
CastXML-8d8aacd65af229da0cadf81911ffa3ef77db7b57.tar.bz2
Detect: Use Clang builtin include dir even with --castxml-cc-<id>
We need implementation-provided headers to come from Clang to match what is really built in to the parser. When not using --castxml-cc-<id>, the Clang driver adds its builtin include directory in methods like Linux::AddClangSystemIncludeArgs MSVCToolChain::AddClangSystemIncludeArgs CrossWindowsToolChain::AddClangSystemIncludeArgs (see lib/Driver/*ToolChain*.cpp). When using --castxml-cc-<id>, we must add the Clang builtin include dir in the appropriate place. GNU-like compilers should have a builtin include directory too, providing files like <emmintrin.h>. The Clang driver does not add this directory from GCC toolchains and instead adds its own builtin include directory. In this case, replace the detected compiler builtin include directory with ours. MSVC-like compilers have no separate builtin include directory. The Clang driver simply places its own builtin include direcory before the system include directory read from the INCLUDE environment variable. In this case, do the same.
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/cc-gnu-builtin/emmintrin.h0
-rw-r--r--test/cc-gnu.c1
-rw-r--r--test/expect/cmd.cc-gnu-c-cmd.stderr.txt2
-rw-r--r--test/expect/cmd.cc-gnu-cxx-cmd.stderr.txt2
-rw-r--r--test/expect/cmd.cc-msvc-c-cmd.stderr.txt2
-rw-r--r--test/expect/cmd.cc-msvc-cxx-cmd.stderr.txt2
7 files changed, 7 insertions, 4 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index db8bc74..1725bbb 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -123,6 +123,8 @@ castxml_test_cmd(rsp-o-missing @${input}/o-missing.rsp)
# Test --castxml-cc-gnu detection.
add_executable(cc-gnu cc-gnu.c)
+set_property(SOURCE cc-gnu.c APPEND PROPERTY COMPILE_DEFINITIONS
+ "TEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"")
castxml_test_cmd(cc-gnu-c-E --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_c} -E -dM)
castxml_test_cmd(cc-gnu-c-cmd --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_c} "-###")
castxml_test_cmd(cc-gnu-cxx-E --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_cxx} -E -dM)
diff --git a/test/cc-gnu-builtin/emmintrin.h b/test/cc-gnu-builtin/emmintrin.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/cc-gnu-builtin/emmintrin.h
diff --git a/test/cc-gnu.c b/test/cc-gnu.c
index b1cb2ea..2bf616d 100644
--- a/test/cc-gnu.c
+++ b/test/cc-gnu.c
@@ -8,6 +8,7 @@ int main(void)
fprintf(stderr,
"#include <...> search starts here:\n"
" /some/include\n"
+ " " TEST_DIR "/cc-gnu-builtin\n"
" /some/Frameworks\n"
" /some/CustomFW (framework directory)\n"
);
diff --git a/test/expect/cmd.cc-gnu-c-cmd.stderr.txt b/test/expect/cmd.cc-gnu-c-cmd.stderr.txt
index 1ac617b..175c3bd 100644
--- a/test/expect/cmd.cc-gnu-c-cmd.stderr.txt
+++ b/test/expect/cmd.cc-gnu-c-cmd.stderr.txt
@@ -1 +1 @@
-"clang" .* "-[^i][^"]*" "[^-"][^"]*" "-isystem" "/some/include" "-iframework" "/some/Frameworks" "-iframework" "/some/CustomFW" "-[^i]
+"clang" .* "-[^i][^"]*" "[^-"][^"]*" "-isystem" "/some/include" "-isystem" "[^"]*/include" "-iframework" "/some/Frameworks" "-iframework" "/some/CustomFW" "-[^i]
diff --git a/test/expect/cmd.cc-gnu-cxx-cmd.stderr.txt b/test/expect/cmd.cc-gnu-cxx-cmd.stderr.txt
index 1ac617b..175c3bd 100644
--- a/test/expect/cmd.cc-gnu-cxx-cmd.stderr.txt
+++ b/test/expect/cmd.cc-gnu-cxx-cmd.stderr.txt
@@ -1 +1 @@
-"clang" .* "-[^i][^"]*" "[^-"][^"]*" "-isystem" "/some/include" "-iframework" "/some/Frameworks" "-iframework" "/some/CustomFW" "-[^i]
+"clang" .* "-[^i][^"]*" "[^-"][^"]*" "-isystem" "/some/include" "-isystem" "[^"]*/include" "-iframework" "/some/Frameworks" "-iframework" "/some/CustomFW" "-[^i]
diff --git a/test/expect/cmd.cc-msvc-c-cmd.stderr.txt b/test/expect/cmd.cc-msvc-c-cmd.stderr.txt
index fb9ae02..7c2e031 100644
--- a/test/expect/cmd.cc-msvc-c-cmd.stderr.txt
+++ b/test/expect/cmd.cc-msvc-c-cmd.stderr.txt
@@ -1 +1 @@
-"clang" .* "-[^i][^"]*" "[^-"][^"]*" "-isystem" "/some/include" "-isystem" "/some/other/include" "-[^i]
+"clang" .* "-[^i][^"]*" "[^-"][^"]*" "-isystem" "[^"]*/include" "-isystem" "/some/include" "-isystem" "/some/other/include" "-[^i]
diff --git a/test/expect/cmd.cc-msvc-cxx-cmd.stderr.txt b/test/expect/cmd.cc-msvc-cxx-cmd.stderr.txt
index fb9ae02..7c2e031 100644
--- a/test/expect/cmd.cc-msvc-cxx-cmd.stderr.txt
+++ b/test/expect/cmd.cc-msvc-cxx-cmd.stderr.txt
@@ -1 +1 @@
-"clang" .* "-[^i][^"]*" "[^-"][^"]*" "-isystem" "/some/include" "-isystem" "/some/other/include" "-[^i]
+"clang" .* "-[^i][^"]*" "[^-"][^"]*" "-isystem" "[^"]*/include" "-isystem" "/some/include" "-isystem" "/some/other/include" "-[^i]