Currently we are trying to implement the semantics of C++ Modules. A big challenge would be the ODR checking. Previously we did this in ASTReader, it would handle the case for something like:
module; #include "something" export module a_module; import another_module; // check the ODR consistency here
or
export module m; import a_module; import another_module; // check the ODR consistency here
However, it wouldn't handle the case:
import another_module; // check ODR here, everything looks fine. #include "something" // Oops, we don't check for ODR now
In the case, the read process is ended. But we need to check the ODR still. To reuse the facility we do in ASTReader, this patch moves the corresponding codes into ASTContext. This should be good since there were facilities like hasSameTemplateName and hasSameType.
Although the patch is a little bit big, all of the change should be trivial.