clang 20.0.0git
|
#include "clang/AST/Decl.h"
#include "Linkage.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/Attr.h"
#include "clang/AST/CanonicalType.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/ODRHash.h"
#include "clang/AST/PrettyDeclStackTrace.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/Randstruct.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/Redeclarable.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Linkage.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/NoSanitizeList.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/Sanitizers.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TargetCXXABI.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/Visibility.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstring>
#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include <type_traits>
#include "clang/AST/DeclNodes.inc"
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? | |
static LVComputationKind | withExplicitVisibilityAlready (LVComputationKind Kind) |
Given an LVComputationKind, return one of the same type/value sort that records that it already has explicit visibility. | |
static std::optional< Visibility > | getExplicitVisibility (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? | |
template<class T > | |
static std::enable_if_t<!std::is_base_of_v< RedeclarableTemplateDecl, T >, bool > | isExplicitMemberSpecialization (const T *D) |
Does the given declaration have member specialization information, and if so, is it an explicit specialization? | |
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. | |
template<class T > | |
static Visibility | getVisibilityFromAttr (const T *attr) |
Given a visibility attribute, return the explicit visibility associated with it. | |
static std::optional< Visibility > | getVisibilityOf (const NamedDecl *D, NamedDecl::ExplicitVisibilityKind kind) |
Return the explicit visibility of the given declaration. | |
static const Decl * | getOutermostFuncOrBlockContext (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? | |
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? | |
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. | |
static bool | useInlineVisibilityHidden (const NamedDecl *D) |
template<typename T > | |
static bool | isFirstInExternCContext (T *D) |
static bool | isSingleLineLanguageLinkage (const Decl &D) |
static LinkageInfo | getExternalLinkageFor (const NamedDecl *D) |
static StorageClass | getStorageClass (const Decl *D) |
static bool | isExportedFromModuleInterfaceUnit (const NamedDecl *D) |
static std::optional< Visibility > | getExplicitVisibilityAux (const NamedDecl *ND, NamedDecl::ExplicitVisibilityKind kind, bool IsMostRecent) |
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) |
static bool | typeIsPostfix (QualType QT) |
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. | |
#define ABSTRACT_DECL | ( | DECL | ) |
|
static |
Definition at line 2184 of file Decl.cpp.
References clang::CLanguageLinkage, clang::CXXLanguageLinkage, D, clang::Decl::getASTContext(), clang::Decl::getDeclContext(), clang::ASTContext::getLangOpts(), isFirstInExternCContext(), clang::DeclContext::isRecord(), and clang::NoLanguageLinkage.
Referenced by clang::VarDecl::getLanguageLinkage(), and clang::FunctionDecl::getLanguageLinkage().
|
static |
Definition at line 2656 of file Decl.cpp.
References D.
Referenced by clang::VarDecl::getTemplateInstantiationPattern(), clang::EnumDecl::getTemplateInstantiationPattern(), and clang::FunctionDecl::getTemplateInstantiationPattern().
|
static |
|
static |
Definition at line 1225 of file Decl.cpp.
References getExplicitVisibilityAux(), clang::CXXRecordDecl::getInstantiatedFromMemberClass(), clang::FunctionDecl::getInstantiatedFromMemberFunction(), clang::VarDecl::getInstantiatedFromStaticDataMember(), clang::NamedDecl::getMostRecentDecl(), clang::VarTemplateSpecializationDecl::getSpecializedTemplate(), clang::VarTemplateDecl::getTemplatedDecl(), clang::FunctionDecl::getTemplateSpecializationInfo(), getVisibilityOf(), and V.
Referenced by clang::NamedDecl::getExplicitVisibility(), and getExplicitVisibilityAux().
|
static |
Definition at line 586 of file Decl.cpp.
References clang::LinkageInfo::external().
Referenced by clang::LinkageComputer::computeLVForDecl().
Retrieve the number of module identifiers needed to name the given module.
Definition at line 5677 of file Decl.cpp.
References clang::Module::Parent, and clang::Result.
Referenced by clang::ImportDecl::getIdentifierLocs().
Definition at line 303 of file Decl.cpp.
References D, clang::Decl::getDeclContext(), clang::DeclContext::getDeclKind(), and clang::DeclContext::getParent().
|
static |
Definition at line 590 of file Decl.cpp.
References D, and clang::SC_None.
|
static |
Definition at line 1964 of file Decl.cpp.
References clang::ast_matchers::decl.
Referenced by clang::DeclaratorDecl::getOuterLocStart(), and clang::TagDecl::getOuterLocStart().
|
static |
Given a visibility attribute, return the explicit visibility associated with it.
Definition at line 209 of file Decl.cpp.
References clang::ast_matchers::attr, clang::DefaultVisibility, clang::HiddenVisibility, and clang::ProtectedVisibility.
Referenced by getVisibilityOf().
|
static |
Return the explicit visibility of the given declaration.
Definition at line 223 of file Decl.cpp.
References D, clang::Decl::getAttr(), getVisibilityFromAttr(), and clang::NamedDecl::VisibilityForType.
Referenced by getExplicitVisibilityAux().
|
static |
Does the given declaration have a direct visibility attribute that would match the given rules?
Definition at line 419 of file Decl.cpp.
References D, clang::Decl::hasAttr(), clang::LVComputationKind::IgnoreAllVisibility, and clang::LVComputationKind::isTypeVisibility().
Referenced by shouldConsiderTemplateVisibility().
|
static |
Does this computation kind permit us to consider additional visibility settings from attributes and the like?
Definition at line 160 of file Decl.cpp.
References clang::LVComputationKind::IgnoreExplicitVisibility.
Referenced by shouldConsiderTemplateVisibility().
|
static |
Definition at line 2211 of file Decl.cpp.
References clang::CLanguageLinkage, D, clang::Decl::getASTContext(), clang::Decl::getDeclContext(), clang::ASTContext::getLangOpts(), and clang::DeclContext::isRecord().
Referenced by clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnPragmaRedefineExtname(), clang::Sema::ActOnVariableDeclarator(), clang::VarDecl::isExternC(), and clang::FunctionDecl::isExternC().
|
static |
|
static |
Definition at line 1184 of file Decl.cpp.
References D, clang::Decl::getModuleOwnershipKind(), clang::Decl::isInNamedModule(), clang::Decl::ModulePrivate, clang::Decl::ReachableWhenImported, clang::Decl::Unowned, clang::Decl::Visible, and clang::Decl::VisibleWhenImported.
Referenced by clang::NamedDecl::getFormalLinkage().
|
static |
Definition at line 574 of file Decl.cpp.
References D, clang::First, and clang::T.
Referenced by getDeclLanguageLinkage().
|
static |
Definition at line 3251 of file Decl.cpp.
References clang::NamedDecl::getIdentifier(), and clang::IdentifierInfo::isStr().
Referenced by clang::FunctionDecl::isMain().
|
static |
Definition at line 1824 of file Decl.cpp.
Referenced by clang::NamedDecl::declarationReplaces().
|
static |
Definition at line 579 of file Decl.cpp.
References D, and clang::Decl::getDeclContext().
Referenced by clang::VarDecl::isThisDeclarationADefinition().
|
static |
Definition at line 3771 of file Decl.cpp.
References clang::Decl::getLexicalDeclContext(), clang::FunctionDecl::getStorageClass(), clang::Decl::isImplicit(), clang::FunctionDecl::isInlineSpecified(), clang::DeclContext::isTranslationUnit(), and clang::SC_Extern.
Referenced by clang::FunctionDecl::doesDeclarationForceExternallyVisibleDefinition(), and clang::FunctionDecl::isInlineDefinitionExternallyVisible().
|
static |
Definition at line 3759 of file Decl.cpp.
References clang::Redeclarable< decl_type >::getPreviousDecl(), clang::FunctionDecl::getStorageClass(), and clang::SC_Extern.
Referenced by clang::FunctionDecl::doesDeclarationForceExternallyVisibleDefinition().
|
static |
Should we consider visibility associated with the template arguments and parameters of the given class template specialization?
Definition at line 430 of file Decl.cpp.
References hasDirectVisibilityAttribute(), hasExplicitVisibilityAlready(), clang::ClassTemplateSpecializationDecl::isExplicitInstantiationOrSpecialization(), and clang::ClassTemplateSpecializationDecl::isExplicitSpecialization().
|
static |
Definition at line 373 of file Decl.cpp.
References clang::Decl::hasAttr(), and clang::FunctionTemplateSpecializationInfo::isExplicitInstantiationOrSpecialization().
|
static |
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.
Definition at line 499 of file Decl.cpp.
References hasDirectVisibilityAttribute(), hasExplicitVisibilityAlready(), clang::VarTemplateSpecializationDecl::isExplicitInstantiationOrSpecialization(), and clang::VarTemplateSpecializationDecl::isExplicitSpecialization().
Definition at line 2038 of file Decl.cpp.
References clang::Type::getPointeeType(), clang::Type::getTypeClass(), clang::QualType::getTypePtr(), and clang::T.
Referenced by clang::DeclaratorDecl::getSourceRange(), and clang::TypedefDecl::getSourceRange().
Definition at line 546 of file Decl.cpp.
References D, clang::Decl::getASTContext(), clang::ASTContext::getLangOpts(), clang::VarDecl::getTemplateSpecializationKind(), clang::Decl::hasAttr(), clang::FunctionDecl::isInlined(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, and clang::TSK_Undeclared.
Is the given declaration a "type" or a "value" for the purposes of visibility computation?
Definition at line 181 of file Decl.cpp.
References D.
Referenced by clang::LinkageComputer::getDeclLinkageAndVisibility().
|
static |