This fixes https://bugs.llvm.org/show_bug.cgi?id=47116.
According to https://eel.is/c++draft/module.interface#2, it is meaningless to export an entity which is not in namespace scope.
The reason why the compiler crashes is that the compiler missed ExportDecl when the compiler traverse the subclass of DeclContext. So here is the crash.
Also, this patch implements https://eel.is/c++draft/module.interface#6 in Sema::CheckRedeclaration* functions.
Test Plan: check-all
I think it would be good to add some comments to document the function (as done with surrounding code).