class ImportDecl

Declaration

class ImportDecl : public Decl, private TrailingObjects { /* full declaration omitted */ };

Description

Describes a module import declaration, which makes the contents of the named module visible in the current translation unit. An import declaration imports the named module (or submodule). For example: A C++20 module import declaration imports the named module or partition. Periods are permitted in C++20 module names, but have no semantic meaning. For example: Import declarations can also be implicitly generated from # include/ # import directives.

Declared at: clang/include/clang/AST/Decl.h:4523

Inherits from: Decl, TrailingObjects

Member Variables

private clang::Module* ImportedModule = nullptr
The imported module.
private llvm::PointerIntPair<ImportDecl*, 1, bool> NextLocalImportAndComplete
When the bit is false, we only have a single source location for the end of the import declaration.

Inherited from Decl:

protected NextInContextAndBits
protected Access
protected FromASTFile
protected IdentifierNamespace
protected CacheValidAndLinkage

Method Overview

  • public static clang::ImportDecl * Create(clang::ASTContext & C, clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::Module * Imported, ArrayRef<clang::SourceLocation> IdentifierLocs)
  • public static clang::ImportDecl * CreateDeserialized(clang::ASTContext & C, unsigned int ID, unsigned int NumLocations)
  • public static clang::ImportDecl * CreateImplicit(clang::ASTContext & C, clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::Module * Imported, clang::SourceLocation EndLoc)
  • private ImportDecl(clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::Module * Imported, ArrayRef<clang::SourceLocation> IdentifierLocs)
  • private ImportDecl(clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::Module * Imported, clang::SourceLocation EndLoc)
  • private ImportDecl(clang::Decl::EmptyShell Empty)
  • public static bool classof(const clang::Decl * D)
  • public static bool classofKind(clang::Decl::Kind K)
  • public ArrayRef<clang::SourceLocation> getIdentifierLocs() const
  • public clang::Module * getImportedModule() const
  • private clang::ImportDecl * getNextLocalImport() const
  • public clang::SourceRange getSourceRange() const
  • private bool isImportComplete() const
  • private void setImportComplete(bool C)
  • private void setNextLocalImport(clang::ImportDecl * Import)

Inherited from Decl:

Methods

static clang::ImportDecl* Create(
    clang::ASTContext& C,
    clang::DeclContext* DC,
    clang::SourceLocation StartLoc,
    clang::Module* Imported,
    ArrayRef<clang::SourceLocation>
        IdentifierLocs)

Description

Create a new module import declaration.

Declared at: clang/include/clang/AST/Decl.h:4567

Parameters

clang::ASTContext& C
clang::DeclContext* DC
clang::SourceLocation StartLoc
clang::Module* Imported
ArrayRef<clang::SourceLocation> IdentifierLocs

static clang::ImportDecl* CreateDeserialized(
    clang::ASTContext& C,
    unsigned int ID,
    unsigned int NumLocations)

Description

Create a new, deserialized module import declaration.

Declared at: clang/include/clang/AST/Decl.h:4578

Parameters

clang::ASTContext& C
unsigned int ID
unsigned int NumLocations

static clang::ImportDecl* CreateImplicit(
    clang::ASTContext& C,
    clang::DeclContext* DC,
    clang::SourceLocation StartLoc,
    clang::Module* Imported,
    clang::SourceLocation EndLoc)

Description

Create a new module import declaration for an implicitly-generated import.

Declared at: clang/include/clang/AST/Decl.h:4573

Parameters

clang::ASTContext& C
clang::DeclContext* DC
clang::SourceLocation StartLoc
clang::Module* Imported
clang::SourceLocation EndLoc

ImportDecl(clang::DeclContext* DC,
           clang::SourceLocation StartLoc,
           clang::Module* Imported,
           ArrayRef<clang::SourceLocation>
               IdentifierLocs)

Declared at: clang/include/clang/AST/Decl.h:4543

Parameters

clang::DeclContext* DC
clang::SourceLocation StartLoc
clang::Module* Imported
ArrayRef<clang::SourceLocation> IdentifierLocs

ImportDecl(clang::DeclContext* DC,
           clang::SourceLocation StartLoc,
           clang::Module* Imported,
           clang::SourceLocation EndLoc)

Declared at: clang/include/clang/AST/Decl.h:4546

Parameters

clang::DeclContext* DC
clang::SourceLocation StartLoc
clang::Module* Imported
clang::SourceLocation EndLoc

ImportDecl(clang::Decl::EmptyShell Empty)

Declared at: clang/include/clang/AST/Decl.h:4549

Parameters

clang::Decl::EmptyShell Empty

static bool classof(const clang::Decl* D)

Declared at: clang/include/clang/AST/Decl.h:4593

Parameters

const clang::Decl* D

static bool classofKind(clang::Decl::Kind K)

Declared at: clang/include/clang/AST/Decl.h:4594

Parameters

clang::Decl::Kind K

ArrayRef<clang::SourceLocation>
getIdentifierLocs() const

Description

Retrieves the locations of each of the identifiers that make up the complete module name in the import declaration. This will return an empty array if the locations of the individual identifiers aren't available.

Declared at: clang/include/clang/AST/Decl.h:4589

clang::Module* getImportedModule() const

Description

Retrieve the module that was imported by the import declaration.

Declared at: clang/include/clang/AST/Decl.h:4582

clang::ImportDecl* getNextLocalImport() const

Description

The next import in the list of imports local to the translation unit being parsed (not loaded from an AST file).

Declared at: clang/include/clang/AST/Decl.h:4557

clang::SourceRange getSourceRange() const

Description

Source range that this declaration covers.

Declared at: clang/include/clang/AST/Decl.h:4591

bool isImportComplete() const

Declared at: clang/include/clang/AST/Decl.h:4551

void setImportComplete(bool C)

Declared at: clang/include/clang/AST/Decl.h:4553

Parameters

bool C

void setNextLocalImport(clang::ImportDecl* Import)

Declared at: clang/include/clang/AST/Decl.h:4561

Parameters

clang::ImportDecl* Import