diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-02-15 23:28:10 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-02-15 23:28:10 +0000 |
commit | cac8ce06dd446dff8b8256bf19c0f3f46dbdf361 (patch) | |
tree | 14bc6d595bd65e3d7b0b30be756e267348a235ad /clang/test/CodeGenCXX/dllimport.cpp | |
parent | 6c3d625fd98a517228f829383acdd04df3e8e499 (diff) | |
download | bcm5719-llvm-cac8ce06dd446dff8b8256bf19c0f3f46dbdf361.tar.gz bcm5719-llvm-cac8ce06dd446dff8b8256bf19c0f3f46dbdf361.zip |
[dllimport] Check for dtor references in functions
Destructor references are not modelled explicitly in the AST. This adds
checks for destructor calls due to variable definitions and temporaries.
If a dllimport function references a non-dllimport destructor, it must
not be emitted available_externally, as the referenced destructor might
live across the DLL boundary and isn't exported.
llvm-svn: 295258
Diffstat (limited to 'clang/test/CodeGenCXX/dllimport.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/dllimport.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/dllimport.cpp b/clang/test/CodeGenCXX/dllimport.cpp index 731239e5eda..372a96ba2ef 100644 --- a/clang/test/CodeGenCXX/dllimport.cpp +++ b/clang/test/CodeGenCXX/dllimport.cpp @@ -368,6 +368,13 @@ struct ClassWithCtor { ClassWithCtor() {} }; struct __declspec(dllimport) ClassWithNonDllImportFieldWithCtor { ClassWithCtor t; }; USECLASS(ClassWithNonDllImportFieldWithCtor); // MO1-DAG: declare dllimport x86_thiscallcc %struct.ClassWithNonDllImportFieldWithCtor* @"\01??0ClassWithNonDllImportFieldWithCtor@@QAE@XZ"(%struct.ClassWithNonDllImportFieldWithCtor* returned) +struct ClassWithImplicitDtor { __declspec(dllimport) ClassWithImplicitDtor(); ClassWithDtor member; }; +__declspec(dllimport) inline void ReferencingDtorThroughDefinition() { ClassWithImplicitDtor x; }; +USE(ReferencingDtorThroughDefinition) +// MO1-DAG: declare dllimport void @"\01?ReferencingDtorThroughDefinition@@YAXXZ"() +__declspec(dllimport) inline void ReferencingDtorThroughTemporary() { ClassWithImplicitDtor(); }; +USE(ReferencingDtorThroughTemporary) +// MO1-DAG: declare dllimport void @"\01?ReferencingDtorThroughTemporary@@YAXXZ"() // A dllimport function with a TLS variable must not be available_externally. __declspec(dllimport) inline void FunctionWithTLSVar() { static __thread int x = 42; } |