Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/Sema/SemaDecl.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 1,593 Lines • ▼ Show 20 Lines | bool Sema::CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old) { | ||||
if (NewM && NewM->Kind == Module::PrivateModuleFragment) | if (NewM && NewM->Kind == Module::PrivateModuleFragment) | ||||
NewM = NewM->Parent; | NewM = NewM->Parent; | ||||
if (OldM && OldM->Kind == Module::PrivateModuleFragment) | if (OldM && OldM->Kind == Module::PrivateModuleFragment) | ||||
OldM = OldM->Parent; | OldM = OldM->Parent; | ||||
if (NewM == OldM) | if (NewM == OldM) | ||||
return false; | return false; | ||||
// If NewM and OldM are two partitions of the same module so the redeclaration | |||||
// should be compatible. | |||||
if (NewM && OldM && | |||||
NewM->getPrimaryModuleName() == OldM->getPrimaryModuleName()) | |||||
return false; | |||||
bool NewIsModuleInterface = NewM && NewM->isModulePurview(); | bool NewIsModuleInterface = NewM && NewM->isModulePurview(); | ||||
bool OldIsModuleInterface = OldM && OldM->isModulePurview(); | bool OldIsModuleInterface = OldM && OldM->isModulePurview(); | ||||
if (NewIsModuleInterface || OldIsModuleInterface) { | if (NewIsModuleInterface || OldIsModuleInterface) { | ||||
// C++ Modules TS [basic.def.odr] 6.2/6.7 [sic]: | // C++ Modules TS [basic.def.odr] 6.2/6.7 [sic]: | ||||
// if a declaration of D [...] appears in the purview of a module, all | // if a declaration of D [...] appears in the purview of a module, all | ||||
// other such declarations shall appear in the purview of the same module | // other such declarations shall appear in the purview of the same module | ||||
Diag(New->getLocation(), diag::err_mismatched_owning_module) | Diag(New->getLocation(), diag::err_mismatched_owning_module) | ||||
<< New | << New | ||||
▲ Show 20 Lines • Show All 9,991 Lines • Show Last 20 Lines |