diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 607ff47a857b8..3f8f980c20a27 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5812,7 +5812,7 @@ def std_EQ : Joined<["-", "--"], "std=">, ; }]>; def stdlib_EQ : Joined<["-", "--"], "stdlib=">, - Visibility<[ClangOption, CC1Option]>, + Visibility<[ClangOption, CC1Option, FlangOption]>, HelpText<"C++ standard library to use">, Values<"libc++,libstdc++,platform">; def stdlibxx_isystem : JoinedOrSeparate<["-"], "stdlib++-isystem">, Group, diff --git a/flang/test/Integration/mixed-lang-stdlib.cpp b/flang/test/Integration/mixed-lang-stdlib.cpp new file mode 100644 index 0000000000000..0ce8355f0035b --- /dev/null +++ b/flang/test/Integration/mixed-lang-stdlib.cpp @@ -0,0 +1,48 @@ +// REQUIRES: system-linux +// RUN: split-file %s %t +// RUN: chmod +x %t/mixed-runtest.sh +// RUN: %t/mixed-runtest.sh -stdlib=platform %t %t/mixed-cppfile.cpp +// %t/mixed-fortranfile.f90 %flang | FileCheck %s + +//--- mixed-cppfile.cpp +#include + +extern "C" void hello(void) { std::cout << "Hello" << std::endl; } + +// clang-format off +// CHECK: PASS +//--- mixed-fortranfile.f90 +program mixed + implicit none + interface + subroutine hello() bind(c) + implicit none + end subroutine + end interface + + call hello() +end program + +//--- mixed-runtest.sh +#!/bin/bash +LDFLAGS=$1 +TMPDIR=$2 +CPPFILE=$3 +F90FILE=$4 +FLANG=$5 +BINDIR=`dirname $FLANG` +CPPCOMP=$BINDIR/clang++ +if [ -x $CPPCOMP ] +then + $CPPCOMP -shared $LDFLAGS $CPPFILE -o $TMPDIR/libmixed.so + $FLANG $LDFLAGS -o $TMPDIR/mixed $F90FILE -L$TMPDIR -lmixed -Wl,-rpath=$TMPDIR + if [ -x $TMPDIR/mixed ] + then + echo "PASS" + else + echo "FAIL" + fi +else + # No clang compiler, just pass by default + echo "PASS" +fi