]> granicus.if.org Git - clang/commitdiff
[Driver] Support g++ headers in include/g++
authorDavid Greene <greened@obbligato.org>
Tue, 13 Nov 2018 21:38:45 +0000 (21:38 +0000)
committerDavid Greene <greened@obbligato.org>
Tue, 13 Nov 2018 21:38:45 +0000 (21:38 +0000)
ray's gcc installation puts C++ headers in PREFIX/include/g++ without
indicating a gcc version at all. Typically this is because the version
is encoded somewhere in PREFIX.

Differential Revision: https://reviews.llvm.org/D53770

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346802 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Linux.cpp
test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/g++/backward/.keep [new file with mode: 0644]
test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o [new file with mode: 0644]
test/Driver/Inputs/cray_suse_gcc_tree/usr/include/c++/4.8/.keep [new file with mode: 0644]
test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o [new file with mode: 0644]
test/Driver/linux-header-search.cpp

index 2ac335c97b22ba8d2b8f2f54814b95b52017e45d..59034bc97c4e2501865609c506b7287620a76fdd 100644 (file)
@@ -930,6 +930,9 @@ void Linux::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
       // Freescale SDK C++ headers are directly in <sysroot>/usr/include/c++,
       // without a subdirectory corresponding to the gcc version.
       LibDir.str() + "/../include/c++",
+      // Cray's gcc installation puts headers under "g++" without a
+      // version suffix.
+      LibDir.str() + "/../include/g++",
   };
 
   for (const auto &IncludePath : LibStdCXXIncludePathCandidates) {
diff --git a/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/g++/backward/.keep b/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/g++/backward/.keep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o b/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/Driver/Inputs/cray_suse_gcc_tree/usr/include/c++/4.8/.keep b/test/Driver/Inputs/cray_suse_gcc_tree/usr/include/c++/4.8/.keep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o b/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o
new file mode 100644 (file)
index 0000000..e69de29
index b4118f9c42fc9e1855ba35d78bb34d0fdecb0c66..03502423c15a7832c4907b8c3d70aaab1ca03e7a 100644 (file)
 // CHECK-OE-AARCH64: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-OE-AARCH64: "-internal-isystem" "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0/../../../include/c++/6.3.0"
 // CHECK-OE-AARCH64: "-internal-isystem" "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0/../../../include/c++/6.3.0/backward"
+
+// Check header search with Cray's gcc package.
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN:     -target x86_64-unknown-linux-gnu -stdlib=libstdc++ \
+// RUN:     --sysroot=%S/Inputs/cray_suse_gcc_tree \
+// RUN:     --gcc-toolchain="%S/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos" \
+// RUN:   | FileCheck --check-prefix=CHECK-CRAY-X86 %s
+
+// CHECK-CRAY-X86: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-CRAY-X86: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-CRAY-X86: "-internal-isystem" "[[SYSROOT]]/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/../../../../include/g++"
+// CHECK-CRAY-X86: "-internal-isystem" "[[SYSROOT]]/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/../../../../include/g++/backward"