This is OpenMP-related part split off from https://reviews.llvm.org/D69585 .
When the referenced change is used to do template instatiations already in the PCH, OpenMP/declare_target_codegen.cpp test fails because some virtuals of template classes are not emitted. This is fixed by this patch. I do not understand the purpose of that code (neither I have any clue about OpenMP), but it was introduced in d2c1dd5902782fb773c64dbf4e0b529aa4044b05 , which also changed this very test, and the change makes the test pass again.