If we have some function with dllimport attribute and then we have the function definition in the same module but without dllimport attribute we should add dllexport attribute to this function definition. The same should be done for variables. Example:
struct __declspec(dllimport) C3 {
~C3();
};
C3::~C3() {;} // we should export this definition
NewImportAttr can be nullptr here, at least for invalid code. This change introduced https://bugs.llvm.org/show_bug.cgi?id=34981 , please take a look.