r346802 - [Driver] Support g++ headers in include/g++

David Greene via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 13 13:38:46 PST 2018


Author: greened
Date: Tue Nov 13 13:38:45 2018
New Revision: 346802

URL: http://llvm.org/viewvc/llvm-project?rev=346802&view=rev
Log:
[Driver] Support g++ headers in include/g++

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


Added:
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/g++/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/g++/backward/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/g++/backward/.keep
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/include/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/include/c++/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/include/c++/4.8/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/include/c++/4.8/.keep
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/x86_64-suse-linux/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/x86_64-suse-linux/8.2.0/
    cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o
Modified:
    cfe/trunk/lib/Driver/ToolChains/Linux.cpp
    cfe/trunk/test/Driver/linux-header-search.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.cpp?rev=346802&r1=346801&r2=346802&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Tue Nov 13 13:38:45 2018
@@ -930,6 +930,9 @@ void Linux::addLibStdCxxIncludePaths(con
       // 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) {

Added: cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/g++/backward/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/g%2B%2B/backward/.keep?rev=346802&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o?rev=346802&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/include/c++/4.8/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/include/c%2B%2B/4.8/.keep?rev=346802&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o?rev=346802&view=auto
==============================================================================
    (empty)

Modified: cfe/trunk/test/Driver/linux-header-search.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-header-search.cpp?rev=346802&r1=346801&r2=346802&view=diff
==============================================================================
--- cfe/trunk/test/Driver/linux-header-search.cpp (original)
+++ cfe/trunk/test/Driver/linux-header-search.cpp Tue Nov 13 13:38:45 2018
@@ -517,3 +517,15 @@
 // 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"




More information about the cfe-commits mailing list