diff options
author | Hans Wennborg <hans@hanshq.net> | 2014-06-11 22:44:39 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2014-06-11 22:44:39 +0000 |
commit | e8ad3839a19e0731b8c8ba716263ecbea0223c03 (patch) | |
tree | 8b5f79c2e51a0aed2184a1e0c9d7cb6276097eaf /clang/test/CodeGenCXX/dllimport.cpp | |
parent | 28db74b2f02a1d20ff2580a94a614c6e482d1593 (diff) | |
download | bcm5719-llvm-e8ad3839a19e0731b8c8ba716263ecbea0223c03.tar.gz bcm5719-llvm-e8ad3839a19e0731b8c8ba716263ecbea0223c03.zip |
Don't inherit dllimport to inline move assignment operators
Current MSVC versions don't have move assignment operators, so we
can't rely on them being available in the dll. If we have the
definition, we can just use that directly. This breaks pointer
equality, but should work fine otherwise.
When there is an MSVC version that supports move assignment,
we can key this off the -fmsc-ver option.
http://reviews.llvm.org/D4105
llvm-svn: 210715
Diffstat (limited to 'clang/test/CodeGenCXX/dllimport.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/dllimport.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/dllimport.cpp b/clang/test/CodeGenCXX/dllimport.cpp index 62ed9cc3b8a..78a15b518e8 100644 --- a/clang/test/CodeGenCXX/dllimport.cpp +++ b/clang/test/CodeGenCXX/dllimport.cpp @@ -27,6 +27,8 @@ struct ExplicitSpec_NotImported {}; #define USE(func) void UNIQ(use)() { func(); } #define USEMEMFUNC(class, func) void (class::*UNIQ(use)())() { return &class::func; } #define USECLASS(class) void UNIQ(USE)() { class x; } +#define USECOPYASSIGN(class) class& (class::*UNIQ(use)())(class&) { return &class::operator=; } +#define USEMOVEASSIGN(class) class& (class::*UNIQ(use)())(class&&) { return &class::operator=; } //===----------------------------------------------------------------------===// // Globals @@ -518,9 +520,18 @@ struct __declspec(dllimport) T { static int b; // MO1-DAG: @"\01?b@T@@2HA" = external dllimport global i32 + + T& operator=(T&) = default; + // MO1-DAG: define available_externally dllimport x86_thiscallcc nonnull %struct.T* @"\01??4T@@QAEAAU0@AAU0@@Z" + + T& operator=(T&&) = default; + // Note: Don't mark inline move operators dllimport because current MSVC versions don't export them. + // MO1-DAG: define linkonce_odr x86_thiscallcc nonnull %struct.T* @"\01??4T@@QAEAAU0@$$QAU0@@Z" }; USEMEMFUNC(T, a) USEVAR(T::b) +USECOPYASSIGN(T) +USEMOVEASSIGN(T) template <typename T> struct __declspec(dllimport) U { void foo() {} }; // MO1-DAG: define available_externally dllimport x86_thiscallcc void @"\01?foo@?$U@H@@QAEXXZ" |