[PATCH] D33789: Export the required symbol from DynamicLibraryTests

Frederich Munch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 10:07:51 PDT 2017


marsupial added inline comments.


================
Comment at: unittests/Support/DynamicLibrary/DynamicLibraryLib.cxx:1-12
+//===- llvm/unittest/Support/DynamicLibrary/DynamicLibraryLib.cpp ---------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
----------------
Perhaps a more general filename (**TestA.cpp**) and use macros to determine the return value so this implementation can be used in other modules.  This would allow for more testing/coverage in the future of other aspects of the DynamicLibrary manager (i.e. symbol resolution across multiple libs).

```
extern "C" PIPSQUEAK_EXPORT const char *TestA() {
#ifndef PIPSQUEAK_TESTA_RETURN
  return "ProcessCall";
#else
  return PIPSQUEAK_TESTA_RETURN;
#endif
}
```

**PipSqueak.cxx**
```
#define PIPSQUEAK_TESTA_RETURN "LibCall"
#include "TestA.cpp"
```


================
Comment at: unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp:23
 
-extern "C" PIPSQUEAK_EXPORT const char *TestA() { return "ProcessCall"; }
+extern "C" PIPSQUEAK_EXPORT const char *TestA();
 
----------------
Might as well move this declaration to **PipSqueak.h**.


https://reviews.llvm.org/D33789





More information about the llvm-commits mailing list