forked from OSchip/llvm-project
[NFC] [C++20] [Modules] Use Sema::isModuleUnitOfCurrentTU to simplify the code
This commit is contained in:
parent
e818ce0e06
commit
8d91b1da57
|
@ -2278,9 +2278,6 @@ private:
|
|||
|
||||
bool isAcceptableSlow(const NamedDecl *D, AcceptableKind Kind);
|
||||
|
||||
// Determine whether the module M belongs to the current TU.
|
||||
bool isModuleUnitOfCurrentTU(const Module *M) const;
|
||||
|
||||
public:
|
||||
/// Get the module unit whose scope we are currently within.
|
||||
Module *getCurrentModule() const {
|
||||
|
@ -2301,6 +2298,9 @@ public:
|
|||
return DirectModuleImports.contains(M);
|
||||
}
|
||||
|
||||
// Determine whether the module M belongs to the current TU.
|
||||
bool isModuleUnitOfCurrentTU(const Module *M) const;
|
||||
|
||||
/// Make a merged definition of an existing hidden definition \p ND
|
||||
/// visible at the specified location.
|
||||
void makeMergedDefinitionVisible(NamedDecl *ND);
|
||||
|
|
|
@ -1920,12 +1920,7 @@ bool LookupResult::isReachableSlow(Sema &SemaRef, NamedDecl *D) {
|
|||
// If D comes from a module and SemaRef doesn't own a module, it implies D
|
||||
// comes from another TU. In case SemaRef owns a module, we could judge if D
|
||||
// comes from another TU by comparing the module unit.
|
||||
//
|
||||
// FIXME: It would look better if we have direct method to judge whether D is
|
||||
// in another TU.
|
||||
if (SemaRef.getCurrentModule() &&
|
||||
SemaRef.getCurrentModule()->getTopLevelModule() ==
|
||||
DeclModule->getTopLevelModule())
|
||||
if (SemaRef.isModuleUnitOfCurrentTU(DeclModule))
|
||||
return true;
|
||||
|
||||
// [module.reach]/p3:
|
||||
|
|
Loading…
Reference in New Issue