summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/DynamicLibrary/PipSqueak.cxx
diff options
context:
space:
mode:
authorFrederich Munch <colsebas@hotmail.com>2017-06-13 16:48:41 +0000
committerFrederich Munch <colsebas@hotmail.com>2017-06-13 16:48:41 +0000
commit4c73b40dca42c802babc565430bd50c7edb48cef (patch)
tree6c87430992e2fd825032a3453bfc6574b384c57a /llvm/unittests/Support/DynamicLibrary/PipSqueak.cxx
parentc83c267b84c2f9986fa67cd62e738da7d9a76137 (diff)
downloadbcm5719-llvm-4c73b40dca42c802babc565430bd50c7edb48cef.tar.gz
bcm5719-llvm-4c73b40dca42c802babc565430bd50c7edb48cef.zip
Force RegisterStandardPasses to construct std::function in the IPO library.
Summary: Fixes an issue using RegisterStandardPasses from a statically linked object before PassManagerBuilder::addGlobalExtension is called from a dynamic library. Reviewers: efriedma, theraven Reviewed By: efriedma Subscribers: mehdi_amini, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D33515 llvm-svn: 305303
Diffstat (limited to 'llvm/unittests/Support/DynamicLibrary/PipSqueak.cxx')
-rw-r--r--llvm/unittests/Support/DynamicLibrary/PipSqueak.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/unittests/Support/DynamicLibrary/PipSqueak.cxx b/llvm/unittests/Support/DynamicLibrary/PipSqueak.cxx
index 375d72c0b53..0c2ec0010af 100644
--- a/llvm/unittests/Support/DynamicLibrary/PipSqueak.cxx
+++ b/llvm/unittests/Support/DynamicLibrary/PipSqueak.cxx
@@ -8,6 +8,10 @@
//===----------------------------------------------------------------------===//
#include "PipSqueak.h"
+#include "llvm/Transforms/IPO/PassManagerBuilder.h"
+
+#define PIPSQUEAK_TESTA_RETURN "LibCall"
+#include "ExportedFuncs.cxx"
struct Global {
std::string *Str;
@@ -45,5 +49,13 @@ extern "C" PIPSQUEAK_EXPORT void TestOrder(std::vector<std::string> &V) {
Glb.Vec = &V;
}
-#define PIPSQUEAK_TESTA_RETURN "LibCall"
-#include "ExportedFuncs.cxx"
+
+static void LibPassRegistration(const llvm::PassManagerBuilder &,
+ llvm::legacy::PassManagerBase &) {}
+
+extern "C" PIPSQUEAK_EXPORT void TestPassReg(
+ void (*addGlobalExtension)(llvm::PassManagerBuilder::ExtensionPointTy,
+ llvm::PassManagerBuilder::ExtensionProc)) {
+ addGlobalExtension(llvm::PassManagerBuilder::EP_EarlyAsPossible,
+ LibPassRegistration);
+}
OpenPOWER on IntegriCloud