[llvm-commits] [PATCH] [lld] Add TargetInfo abstraction.

Chandler Carruth chandlerc at gmail.com
Fri Jan 18 22:16:19 PST 2013



================
Comment at: include/lld/ReaderWriter/ELFTargetInfo.h:25
@@ +24,3 @@
+
+  static std::unique_ptr<ELFTargetInfo> create(const LinkerOptions &lo);
+};
----------------
Michael Spencer wrote:
> kledzik at apple.com wrote:
> > Why is there this factory method, when the constructor is also public?  Do you intend for there to be hidden subclasses of ELFTargetInfo?
> It's public because it was easier to test like that. It should be protected.
How are you testing stuff?

This seems like the perfect kind of class to write unittests against. Can you rig up LLD to build unittests much like LLVM and Clang do?


FWIW, when using unittests, the more common pattern I've seen is to befriend the unittest fixture, and expose helper functions in the fixture for individual test cases to use.


http://llvm-reviews.chandlerc.com/D311



More information about the llvm-commits mailing list