Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -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<clang_i_Group>,
Expand Down
48 changes: 48 additions & 0 deletions flang/test/Integration/mixed-lang-stdlib.cpp
Original file line number Diff line number Diff line change
@@ -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 <iostream>

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
Loading