clang 22.0.0git
SemaModule.cpp File Reference

Go to the source code of this file.

Functions

static void checkModuleImportContext (Sema &S, Module *M, SourceLocation ImportLoc, DeclContext *DC, bool FromInclude=false)
static std::string stringFromPath (ModuleIdPath Path)
static bool isImportingModuleUnitFromSameModule (ASTContext &Ctx, Module *Imported, Module *CurrentModule, Module *&FoundPrimaryModuleInterface)
 Helper function for makeTransitiveImportsVisible to decide whether the.
static void makeTransitiveImportsVisible (ASTContext &Ctx, VisibleModuleSet &VisibleModules, Module *Imported, Module *CurrentModule, SourceLocation ImportLoc, bool IsImportingPrimaryModuleInterface=false)
 [module.import]p7: Additionally, when a module-import-declaration in a module unit of some module M imports another module unit U of M, it also imports all translation units imported by non-exported module-import-declarations in the module unit purview of U.
static bool DiagReservedModuleName (Sema &S, const IdentifierInfo *II, SourceLocation Loc)
 Tests whether the given identifier is reserved as a module name and diagnoses if it is.
static const ExportDeclgetEnclosingExportDecl (const Decl *D)
 Determine whether D is lexically within an export-declaration.
static bool checkExportedDecl (Sema &S, Decl *D, SourceLocation BlockStart)
 Check that it's valid to export D.
static bool checkExportedDeclContext (Sema &S, DeclContext *DC, SourceLocation BlockStart)
 Check that it's valid to export all the declarations in DC.

Function Documentation

◆ checkExportedDecl()

◆ checkExportedDeclContext()

bool checkExportedDeclContext ( Sema & S,
DeclContext * DC,
SourceLocation BlockStart )
static

Check that it's valid to export all the declarations in DC.

Definition at line 938 of file SemaModule.cpp.

References checkExportedDecl(), and clang::DeclContext::decls().

Referenced by checkExportedDecl().

◆ checkModuleImportContext()

◆ DiagReservedModuleName()

bool DiagReservedModuleName ( Sema & S,
const IdentifierInfo * II,
SourceLocation Loc )
static

Tests whether the given identifier is reserved as a module name and diagnoses if it is.

Returns true if a diagnostic is emitted and false otherwise.

Definition at line 232 of file SemaModule.cpp.

References clang::SemaBase::Diag(), clang::Sema::getLangOpts(), clang::Sema::getSourceManager(), clang::Invalid, clang::SourceManager::isInSystemHeader(), clang::IdentifierInfo::isReserved(), clang::IdentifierInfo::isStr(), clang::NotReserved, and clang::Valid.

Referenced by clang::Sema::ActOnModuleDecl().

◆ getEnclosingExportDecl()

const ExportDecl * getEnclosingExportDecl ( const Decl * D)
static

Determine whether D is lexically within an export-declaration.

Definition at line 640 of file SemaModule.cpp.

References clang::Decl::getLexicalDeclContext(), and clang::DeclContext::getLexicalParent().

Referenced by clang::Sema::ActOnModuleImport(), and clang::Sema::ActOnStartExportDecl().

◆ isImportingModuleUnitFromSameModule()

bool isImportingModuleUnitFromSameModule ( ASTContext & Ctx,
Module * Imported,
Module * CurrentModule,
Module *& FoundPrimaryModuleInterface )
static

Helper function for makeTransitiveImportsVisible to decide whether the.

Parameters
Importedmodule unit is in the same module with the
CurrentModule.
FoundPrimaryModuleInterfaceis a helper parameter to record the primary module interface unit corresponding to the module
CurrentModule.Since currently it is expensive to decide whether two module units come from the same module by comparing the module name.

Definition at line 86 of file SemaModule.cpp.

References clang::ASTContext::isInSameModule(), clang::Module::isModulePartition(), clang::Module::isModulePartitionImplementation(), and clang::Module::isNamedModule().

Referenced by makeTransitiveImportsVisible().

◆ makeTransitiveImportsVisible()

void makeTransitiveImportsVisible ( ASTContext & Ctx,
VisibleModuleSet & VisibleModules,
Module * Imported,
Module * CurrentModule,
SourceLocation ImportLoc,
bool IsImportingPrimaryModuleInterface = false )
static

[module.import]p7: Additionally, when a module-import-declaration in a module unit of some module M imports another module unit U of M, it also imports all translation units imported by non-exported module-import-declarations in the module unit purview of U.

These rules can in turn lead to the importation of yet more translation units.

Definition at line 131 of file SemaModule.cpp.

References clang::Module::Exports, clang::Module::Imports, isImportingModuleUnitFromSameModule(), clang::Module::isNamedModule(), and clang::VisibleModuleSet::setVisible().

Referenced by clang::Sema::ActOnModuleDecl(), and clang::Sema::ActOnModuleImport().

◆ stringFromPath()

std::string stringFromPath ( ModuleIdPath Path)
static

Definition at line 65 of file SemaModule.cpp.

Referenced by clang::Sema::ActOnModuleDecl(), and clang::Sema::ActOnModuleImport().