clang  6.0.0svn
Macros | Functions
Decl.cpp File Reference
#include "clang/AST/Decl.h"
#include "Linkage.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "llvm/Support/ErrorHandling.h"
#include <algorithm>
#include "clang/AST/DeclNodes.inc"
Include dependency graph for Decl.cpp:

Go to the source code of this file.

Macros

#define DECL(Type, Base)
 
#define ABSTRACT_DECL(DECL)
 

Functions

static bool hasExplicitVisibilityAlready (LVComputationKind computation)
 Does this computation kind permit us to consider additional visibility settings from attributes and the like? More...
 
static LVComputationKind withExplicitVisibilityAlready (LVComputationKind Kind)
 Given an LVComputationKind, return one of the same type/value sort that records that it already has explicit visibility. More...
 
static Optional< VisibilitygetExplicitVisibility (const NamedDecl *D, LVComputationKind kind)
 
static bool usesTypeVisibility (const NamedDecl *D)
 Is the given declaration a "type" or a "value" for the purposes of visibility computation? More...
 
template<class T >
static std::enable_if<!std::is_base_of< RedeclarableTemplateDecl, T >::value, bool >::type isExplicitMemberSpecialization (const T *D)
 Does the given declaration have member specialization information, and if so, is it an explicit specialization? More...
 
static bool isExplicitMemberSpecialization (const RedeclarableTemplateDecl *D)
 For templates, this question is easier: a member template can't be explicitly instantiated, so there's a single bit indicating whether or not this is an explicit member specialization. More...
 
template<class T >
static Visibility getVisibilityFromAttr (const T *attr)
 Given a visibility attribute, return the explicit visibility associated with it. More...
 
static Optional< VisibilitygetVisibilityOf (const NamedDecl *D, NamedDecl::ExplicitVisibilityKind kind)
 Return the explicit visibility of the given declaration. More...
 
static const DeclgetOutermostFuncOrBlockContext (const Decl *D)
 
static bool shouldConsiderTemplateVisibility (const FunctionDecl *fn, const FunctionTemplateSpecializationInfo *specInfo)
 
static bool hasDirectVisibilityAttribute (const NamedDecl *D, LVComputationKind computation)
 Does the given declaration have a direct visibility attribute that would match the given rules? More...
 
static bool shouldConsiderTemplateVisibility (const ClassTemplateSpecializationDecl *spec, LVComputationKind computation)
 Should we consider visibility associated with the template arguments and parameters of the given class template specialization? More...
 
static bool shouldConsiderTemplateVisibility (const VarTemplateSpecializationDecl *spec, LVComputationKind computation)
 Should we consider visibility associated with the template arguments and parameters of the given variable template specialization? As usual, follow class template specialization logic up to initialization. More...
 
static bool useInlineVisibilityHidden (const NamedDecl *D)
 
template<typename T >
static bool isFirstInExternCContext (T *D)
 
static bool isSingleLineLanguageLinkage (const Decl &D)
 
static bool isExportedFromModuleIntefaceUnit (const NamedDecl *D)
 
static LinkageInfo getInternalLinkageFor (const NamedDecl *D)
 
static LinkageInfo getExternalLinkageFor (const NamedDecl *D)
 
static Optional< VisibilitygetExplicitVisibilityAux (const NamedDecl *ND, NamedDecl::ExplicitVisibilityKind kind, bool IsMostRecent)
 
static const CXXRecordDeclgetOutermostEnclosingLambda (const CXXRecordDecl *Record)
 
template<typename T >
static bool isRedeclarableImpl (Redeclarable< T > *)
 
static bool isRedeclarableImpl (...)
 
static bool isRedeclarable (Decl::Kind K)
 
template<typename DeclT >
static SourceLocation getTemplateOrInnerLocStart (const DeclT *decl)
 
template<typename T >
static LanguageLinkage getDeclLanguageLinkage (const T &D)
 
template<typename T >
static bool isDeclExternC (const T &D)
 
template<typename DeclT >
static DeclT * getDefinitionOrSelf (DeclT *D)
 
template<std::size_t Len>
static bool isNamed (const NamedDecl *ND, const char(&Str)[Len])
 
static bool redeclForcesDefMSVC (const FunctionDecl *Redecl)
 
static bool RedeclForcesDefC99 (const FunctionDecl *Redecl)
 
static unsigned getNumModuleIdentifiers (Module *Mod)
 Retrieve the number of module identifiers needed to name the given module. More...
 

Macro Definition Documentation

◆ ABSTRACT_DECL

#define ABSTRACT_DECL (   DECL)

◆ DECL

#define DECL (   Type,
  Base 
)
Value:
case Decl::Type: \
return isRedeclarableImpl((Type##Decl *)nullptr);
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:81
The base class of the type hierarchy.
Definition: Type.h:1300
static bool isRedeclarableImpl(Redeclarable< T > *)
Definition: Decl.cpp:1542

Function Documentation

◆ getDeclLanguageLinkage()

template<typename T >
static LanguageLinkage getDeclLanguageLinkage ( const T &  D)
static

◆ getDefinitionOrSelf()

template<typename DeclT >
static DeclT* getDefinitionOrSelf ( DeclT *  D)
static

◆ getExplicitVisibility()

static Optional<Visibility> getExplicitVisibility ( const NamedDecl D,
LVComputationKind  kind 
)
static

◆ getExplicitVisibilityAux()

static Optional<Visibility> getExplicitVisibilityAux ( const NamedDecl ND,
NamedDecl::ExplicitVisibilityKind  kind,
bool  IsMostRecent 
)
static

Definition at line 1021 of file Decl.cpp.

Referenced by clang::NamedDecl::getExplicitVisibility().

◆ getExternalLinkageFor()

static LinkageInfo getExternalLinkageFor ( const NamedDecl D)
static

◆ getInternalLinkageFor()

static LinkageInfo getInternalLinkageFor ( const NamedDecl D)
static

◆ getNumModuleIdentifiers()

static unsigned getNumModuleIdentifiers ( Module Mod)
static

Retrieve the number of module identifiers needed to name the given module.

Definition at line 4383 of file Decl.cpp.

References clang::Decl::Decl(), clang::Module::Parent, and clang::Result.

Referenced by clang::ImportDecl::getIdentifierLocs().

◆ getOutermostEnclosingLambda()

static const CXXRecordDecl* getOutermostEnclosingLambda ( const CXXRecordDecl Record)
inlinestatic

◆ getOutermostFuncOrBlockContext()

static const Decl* getOutermostFuncOrBlockContext ( const Decl D)
static

◆ getTemplateOrInnerLocStart()

template<typename DeclT >
static SourceLocation getTemplateOrInnerLocStart ( const DeclT *  decl)
static

◆ getVisibilityFromAttr()

template<class T >
static Visibility getVisibilityFromAttr ( const T *  attr)
static

Given a visibility attribute, return the explicit visibility associated with it.

Definition at line 154 of file Decl.cpp.

References clang::Default, clang::DefaultVisibility, clang::HiddenVisibility, and clang::ProtectedVisibility.

Referenced by getVisibilityOf().

◆ getVisibilityOf()

static Optional<Visibility> getVisibilityOf ( const NamedDecl D,
NamedDecl::ExplicitVisibilityKind  kind 
)
static

◆ hasDirectVisibilityAttribute()

static bool hasDirectVisibilityAttribute ( const NamedDecl D,
LVComputationKind  computation 
)
static

Does the given declaration have a direct visibility attribute that would match the given rules?

Definition at line 354 of file Decl.cpp.

References clang::Decl::hasAttr(), clang::LVComputationKind::IgnoreAllVisibility, and clang::LVComputationKind::isTypeVisibility().

Referenced by shouldConsiderTemplateVisibility().

◆ hasExplicitVisibilityAlready()

static bool hasExplicitVisibilityAlready ( LVComputationKind  computation)
static

Does this computation kind permit us to consider additional visibility settings from attributes and the like?

Definition at line 105 of file Decl.cpp.

References clang::LVComputationKind::IgnoreExplicitVisibility.

Referenced by clang::NamedDecl::getExplicitVisibility(), and shouldConsiderTemplateVisibility().

◆ isDeclExternC()

template<typename T >
static bool isDeclExternC ( const T &  D)
static

◆ isExplicitMemberSpecialization() [1/2]

template<class T >
static std::enable_if<!std::is_base_of<RedeclarableTemplateDecl, T>::value, bool>::type isExplicitMemberSpecialization ( const T *  D)
static

Does the given declaration have member specialization information, and if so, is it an explicit specialization?

Definition at line 136 of file Decl.cpp.

◆ isExplicitMemberSpecialization() [2/2]

static bool isExplicitMemberSpecialization ( const RedeclarableTemplateDecl D)
static

For templates, this question is easier: a member template can't be explicitly instantiated, so there's a single bit indicating whether or not this is an explicit member specialization.

Definition at line 147 of file Decl.cpp.

References clang::RedeclarableTemplateDecl::isMemberSpecialization().

◆ isExportedFromModuleIntefaceUnit()

static bool isExportedFromModuleIntefaceUnit ( const NamedDecl D)
static

◆ isFirstInExternCContext()

template<typename T >
static bool isFirstInExternCContext ( T *  D)
static

Definition at line 505 of file Decl.cpp.

◆ isNamed()

template<std::size_t Len>
static bool isNamed ( const NamedDecl ND,
const char(&)  Str[Len] 
)
static

◆ isRedeclarable()

static bool isRedeclarable ( Decl::Kind  K)
static

Definition at line 1546 of file Decl.cpp.

◆ isRedeclarableImpl() [1/2]

template<typename T >
static bool isRedeclarableImpl ( Redeclarable< T > *  )
static

Definition at line 1542 of file Decl.cpp.

◆ isRedeclarableImpl() [2/2]

static bool isRedeclarableImpl (   ...)
static

Definition at line 1545 of file Decl.cpp.

◆ isSingleLineLanguageLinkage()

static bool isSingleLineLanguageLinkage ( const Decl D)
static

Definition at line 510 of file Decl.cpp.

References clang::Decl::getDeclContext().

Referenced by clang::VarDecl::isThisDeclarationADefinition().

◆ RedeclForcesDefC99()

static bool RedeclForcesDefC99 ( const FunctionDecl Redecl)
static

◆ redeclForcesDefMSVC()

static bool redeclForcesDefMSVC ( const FunctionDecl Redecl)
static

◆ shouldConsiderTemplateVisibility() [1/3]

static bool shouldConsiderTemplateVisibility ( const FunctionDecl fn,
const FunctionTemplateSpecializationInfo specInfo 
)
static

◆ shouldConsiderTemplateVisibility() [2/3]

static bool shouldConsiderTemplateVisibility ( const ClassTemplateSpecializationDecl spec,
LVComputationKind  computation 
)
static

◆ shouldConsiderTemplateVisibility() [3/3]

static bool shouldConsiderTemplateVisibility ( const VarTemplateSpecializationDecl spec,
LVComputationKind  computation 
)
static

◆ useInlineVisibilityHidden()

static bool useInlineVisibilityHidden ( const NamedDecl D)
static

◆ usesTypeVisibility()

static bool usesTypeVisibility ( const NamedDecl D)
static

Is the given declaration a "type" or a "value" for the purposes of visibility computation?

Definition at line 126 of file Decl.cpp.

Referenced by clang::LinkageComputer::getDeclLinkageAndVisibility().

◆ withExplicitVisibilityAlready()

static LVComputationKind withExplicitVisibilityAlready ( LVComputationKind  Kind)
static

Given an LVComputationKind, return one of the same type/value sort that records that it already has explicit visibility.

Definition at line 112 of file Decl.cpp.

References clang::LVComputationKind::IgnoreExplicitVisibility.