clang 17.0.0git
Functions
SemaModule.cpp File Reference
#include "clang/AST/ASTConsumer.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/SemaInternal.h"
#include <optional>

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 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 checkExportedDeclContext (Sema &S, DeclContext *DC, SourceLocation BlockStart)
 Check that it's valid to export all the declarations in DC.
 
static std::optional< UnnamedDeclKind > getUnnamedDeclKind (Decl *D)
 
unsigned getUnnamedDeclDiag (UnnamedDeclKind UDK, bool InBlock)
 
static void diagExportedUnnamedDecl (Sema &S, UnnamedDeclKind UDK, Decl *D, SourceLocation BlockStart)
 
static bool checkExportedDecl (Sema &S, Decl *D, SourceLocation BlockStart)
 Check that it's valid to export D.
 

Function Documentation

◆ checkExportedDecl()

static bool checkExportedDecl ( Sema S,
Decl D,
SourceLocation  BlockStart 
)
static

◆ checkExportedDeclContext()

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

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

Definition at line 932 of file SemaModule.cpp.

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

Referenced by checkExportedDecl().

◆ checkModuleImportContext()

static void checkModuleImportContext ( Sema S,
Module M,
SourceLocation  ImportLoc,
DeclContext DC,
bool  FromInclude = false 
)
static

◆ diagExportedUnnamedDecl()

static void diagExportedUnnamedDecl ( Sema S,
UnnamedDeclKind  UDK,
Decl D,
SourceLocation  BlockStart 
)
static

◆ DiagReservedModuleName()

static 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 139 of file SemaModule.cpp.

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

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

◆ getEnclosingExportDecl()

static const ExportDecl * getEnclosingExportDecl ( const Decl D)
static

Determine whether D is lexically within an export-declaration.

Definition at line 536 of file SemaModule.cpp.

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

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

◆ getUnnamedDeclDiag()

unsigned getUnnamedDeclDiag ( UnnamedDeclKind  UDK,
bool  InBlock 
)

Definition at line 846 of file SemaModule.cpp.

Referenced by diagExportedUnnamedDecl().

◆ getUnnamedDeclKind()

static std::optional< UnnamedDeclKind > getUnnamedDeclKind ( Decl D)
static

Definition at line 833 of file SemaModule.cpp.

Referenced by checkExportedDecl().

◆ stringFromPath()

static std::string stringFromPath ( ModuleIdPath  Path)
static

Definition at line 62 of file SemaModule.cpp.

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