[PATCH] D35258: [Plugins] Add a slim plugin API to work together with the new PM

Philip Pfaffe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 3 03:50:22 PDT 2018


philip.pfaffe added inline comments.


================
Comment at: unittests/Passes/PluginsTest.cpp:26-34
+static std::string LibPath(const std::string Name = "TestPlugin") {
+  const std::vector<testing::internal::string> &Argvs =
+      testing::internal::GetArgvs();
+  const char *Argv0 = Argvs.size() > 0 ? Argvs[0].c_str() : "PluginsTests";
+  void *Ptr = (void *)anchor;
+  std::string Path = sys::fs::getMainExecutable(Argv0, Ptr);
+  llvm::SmallString<256> Buf{sys::path::parent_path(Path)};
----------------
chandlerc wrote:
> Do we have any tests that do this successfully already?
> 
> I'm worried it will be a nightmare to get this to work portably. But it is a really awesome level of testing, so seems worth at least trying, just wanted you to be prepared for the potential churn required to get it to work.
I think I copied this from `unittests/Support/DynamicLibrary`. Maybe it makes sense to factor this out into a common header in `llvm/Testing`?


Repository:
  rL LLVM

https://reviews.llvm.org/D35258





More information about the llvm-commits mailing list