
...as that is apparently what MSVC does. This is an updated version of r263738, which had to be reverted in r263740 due to test failures. The original version had erroneously emitted functions that are defined in class templates, too (see the updated "Handle friend functions" code in EmitDeferredDecls, lib/CodeGen/ModuleBuilder.cpp). (The updated tests needed to be split out into their own dllexport-ms-friend.cpp because of the CHECK-NOTs which would have interfered with subsequent CHECK-DAGs in dllexport.cpp.) Differential Revision: http://reviews.llvm.org/D18430 llvm-svn: 264841
23 lines
698 B
C++
23 lines
698 B
C++
// RUN: %clang_cc1 -triple %ms_abi_triple -fms-extensions -emit-llvm -O0 -o - %s | FileCheck %s
|
|
|
|
// Friend functions defined in classes are emitted.
|
|
// CHECK: define weak_odr dllexport void @"\01?friend1@@YAXXZ"()
|
|
struct FuncFriend1 {
|
|
friend __declspec(dllexport) void friend1() {}
|
|
};
|
|
|
|
// But function templates and functions defined in class templates are not
|
|
// emitted.
|
|
// CHECK-NOT: friend2
|
|
// CHECK-NOT: friend3
|
|
// CHECK-NOT: friend4
|
|
struct FuncFriend2 {
|
|
template<typename> friend __declspec(dllexport) void friend2() {}
|
|
};
|
|
template<typename> struct FuncFriend3 {
|
|
friend __declspec(dllexport) void friend3() {}
|
|
struct Inner {
|
|
friend __declspec(dllexport) void friend4() {}
|
|
};
|
|
};
|