This patch implements the suggestion in D29753 that calling DeclMustBeEmitted in the middle of deserialization should be avoided and that the actual check should be deferred until it's safe to do so.
This patch fixes the attached test case we encountered when compiling our code with modules: Here clang would crash when accessing the invalid redecl chains while trying to evaluate the value of a const VarDecl that contains a function call. I've also added a test case for the the assertion fail hat Richard mentioned in D29753 which is also fixed by this patch.
Please lowercase the first letter of this function.