This is an archive of the discontinued LLVM Phabricator instance.

[NFC] [AST] Move isSame* check in ASTReader to ASTContext
ClosedPublic

Authored by ChuanqiXu on Jan 26 2022, 1:22 AM.

Details

Summary

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.

Diff Detail

Event Timeline

ChuanqiXu requested review of this revision.Jan 26 2022, 1:22 AM
ChuanqiXu created this revision.

I'm insufficiently confident to review this kind of code motion.

ChuanqiXu edited the summary of this revision. (Show Details)Jan 26 2022, 4:19 AM
erichkeane accepted this revision.Jan 26 2022, 6:03 AM

This seems fine to me, no reason it cannot live in ASTContext if it makes future code easier.

This revision is now accepted and ready to land.Jan 26 2022, 6:03 AM
This revision was landed with ongoing or failed builds.Jan 26 2022, 6:31 PM
This revision was automatically updated to reflect the committed changes.