[XCOFF] Fix link errors from explicit template instantiation
authorReid Kleckner <rnk@google.com>
Thu, 7 Nov 2019 17:27:43 +0000 (09:27 -0800)
committerReid Kleckner <rnk@google.com>
Thu, 7 Nov 2019 17:29:48 +0000 (09:29 -0800)
commitc989993ba1a666f04f7aee7df51d9f4de0588b71
treec10fbd2bd485ee82f1afe764ff8594252b3aaf30
parent7d2b0ec345487537e37a24b323d612c7c06295cd
[XCOFF] Fix link errors from explicit template instantiation

I happen to be using clang-cl+lld-link locally, and I get these link
errors:

lld-link: error: undefined symbol: public: unsigned short __cdecl llvm::object::XCOFFSectionHeader<struct llvm::object::XCOFFSectionHeader64>::getSectionType(void) const
>>> referenced by C:\src\llvm-project\llvm\tools\llvm-readobj\XCOFFDumper.cpp:106
>>>               tools\llvm-readobj\CMakeFiles\llvm-readobj.dir\XCOFFDumper.cpp.obj:(public: virtual void __cdecl `anonymous namespace'::XCOFFDumper::printSectionHeaders(void))

I suspect this is because the explicit template instaniation appears
before the inline method definitions in the .cpp file, so they aren't
available at the point of instantiation. Move the explicit instantiation
later.

Also, forward declare the explicit instantiation for good measure.
llvm/include/llvm/Object/XCOFFObjectFile.h
llvm/lib/Object/XCOFFObjectFile.cpp