clang
3.7.0
|
#include "clang/AST/Decl.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/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"
Go to the source code of this file.
Classes | |
class | clang::LinkageComputer |
Namespaces | |
clang | |
Macros | |
#define | DECL(Type, Base) |
#define | ABSTRACT_DECL(DECL) |
Enumerations | |
enum | LVComputationKind { LVForType = NamedDecl::VisibilityForType, LVForValue = NamedDecl::VisibilityForValue, LVForExplicitType = (LVForType | IgnoreExplicitVisibilityBit), LVForExplicitValue = (LVForValue | IgnoreExplicitVisibilityBit), LVForLinkageOnly } |
Variables | |
const unsigned | IgnoreExplicitVisibilityBit = 2 |
const unsigned | IgnoreAllVisibilityBit = 4 |
#define ABSTRACT_DECL | ( | DECL | ) |
#define DECL | ( | Type, | |
Base | |||
) |
enum LVComputationKind |
Kinds of LV computation. The linkage side of the computation is always the same, but different things can change how visibility is computed.
|
static |
Definition at line 1225 of file Decl.cpp.
References clang::LinkageInfo::external(), clang::Decl::getDeclContext(), clang::Decl::getKind(), clang::CXXRecordDecl::getLambdaContextDecl(), clang::CXXRecordDecl::getLambdaManglingNumber(), getLVForClassMember(), getLVForClosure(), getLVForLocalDecl(), getLVForNamespaceScopeDecl(), getOutermostEnclosingLambda(), clang::DeclContext::getRedeclContext(), clang::LinkageInfo::internal(), clang::DeclContext::isFileContext(), clang::DeclContext::isFunctionOrMethod(), clang::CXXRecordDecl::isLambda(), clang::DeclContext::isRecord(), and clang::LinkageInfo::none().
Referenced by clang::LinkageComputer::getLVForDecl(), and clang::NamedDecl::isLinkageValid().
|
static |
Definition at line 1837 of file Decl.cpp.
References clang::CLanguageLinkage, Context, clang::CXXLanguageLinkage, clang::ASTContext::getLangOpts(), isFirstInExternCContext(), clang::DeclContext::isRecord(), and clang::NoLanguageLinkage.
Referenced by clang::VarDecl::getLanguageLinkage(), and clang::FunctionDecl::getLanguageLinkage().
|
static |
Definition at line 155 of file Decl.cpp.
References clang::NamedDecl::getExplicitVisibility(), and hasExplicitVisibilityAlready().
Referenced by getLVForClassMember(), getLVForLocalDecl(), and getLVForNamespaceScopeDecl().
|
static |
Definition at line 1040 of file Decl.cpp.
References clang::CXXRecordDecl::getInstantiatedFromMemberClass(), clang::FunctionDecl::getInstantiatedFromMemberFunction(), clang::VarDecl::getInstantiatedFromStaticDataMember(), clang::NamedDecl::getMostRecentDecl(), getVisibilityOf(), and clang::None.
Referenced by clang::NamedDecl::getExplicitVisibility().
|
static |
Definition at line 842 of file Decl.cpp.
References clang::DefaultVisibility, clang::Decl::getDeclContext(), getExplicitVisibility(), clang::LinkageInfo::getLinkage(), clang::Type::getLinkage(), getLVForDecl(), getLVForTemplateParameterList(), getLVForType(), clang::ClassTemplateDecl::getTemplatedDecl(), clang::LinkageInfo::getVisibility(), hasDirectVisibilityAttribute(), hasExplicitVisibilityAlready(), clang::HiddenVisibility, isExplicitMemberSpecialization(), clang::isExternallyVisible(), clang::LinkageInfo::isVisibilityExplicit(), clang::LinkageInfo::mergeExternalVisibility(), clang::LinkageInfo::mergeMaybeWithVisibility(), mergeTemplateLV(), clang::LinkageInfo::mergeVisibility(), clang::LinkageInfo::none(), clang::LinkageInfo::uniqueExternal(), clang::UniqueExternalLinkage, useInlineVisibilityHidden(), and withExplicitVisibilityAlready().
Referenced by computeLVForDecl().
|
static |
Definition at line 1115 of file Decl.cpp.
References clang::LinkageInfo::external(), clang::Decl::getDeclContext(), getLVForDecl(), and clang::DeclContext::getRedeclContext().
Referenced by computeLVForDecl(), and getLVForLocalDecl().
|
static |
getLVForDecl - Get the linkage and visibility for the given declaration.
Definition at line 1355 of file Decl.cpp.
References clang::LinkageComputer::getLVForDecl().
Referenced by clang::NamedDecl::getLinkageAndVisibility(), clang::NamedDecl::getLinkageInternal(), getLVForClassMember(), getLVForClosure(), getLVForLocalDecl(), getLVForNamespaceScopeDecl(), and getLVForTemplateArgumentList().
|
static |
Definition at line 1131 of file Decl.cpp.
References Context, clang::Decl::getASTContext(), getExplicitVisibility(), clang::ASTContext::getLangOpts(), clang::LinkageInfo::getLinkage(), getLVForClosure(), getLVForDecl(), getOutermostFuncOrBlockContext(), clang::Redeclarable< decl_type >::getPreviousDecl(), clang::FunctionDecl::getTemplateSpecializationKind(), clang::LinkageInfo::getVisibility(), hasExplicitVisibilityAlready(), clang::HiddenVisibility, clang::LinkageInfo::internal(), clang::isExternallyVisible(), clang::FunctionDecl::isInlined(), clang::isTemplateInstantiation(), clang::LinkageInfo::isVisibilityExplicit(), clang::LinkageInfo::mergeVisibility(), clang::LinkageInfo::none(), clang::SC_PrivateExtern, clang::SC_Static, clang::LinkageInfo::setLinkage(), clang::LinkageInfo::uniqueExternal(), and clang::VisibleNoLinkage.
Referenced by computeLVForDecl().
|
static |
Definition at line 578 of file Decl.cpp.
References Context, clang::DefaultVisibility, clang::ExternalLinkage, clang::Decl::getAsFunction(), clang::Decl::getASTContext(), clang::Decl::getDeclContext(), getExplicitVisibility(), clang::LinkageInfo::getLinkage(), clang::Type::getLinkage(), getLVForDecl(), getLVForTemplateParameterList(), getLVForType(), clang::DeclContext::getParent(), clang::Redeclarable< decl_type >::getPreviousDecl(), clang::DeclContext::getRedeclContext(), hasExplicitVisibilityAlready(), clang::HiddenVisibility, clang::LinkageInfo::internal(), clang::InternalLinkage, clang::isExternalFormalLinkage(), clang::DeclContext::isFileContext(), isFirstInExternCContext(), clang::Decl::isInAnonymousNamespace(), isSingleLineLanguageLinkage(), clang::LinkageInfo::isVisibilityExplicit(), LVForType, LVForValue, clang::LinkageInfo::merge(), clang::LinkageInfo::mergeMaybeWithVisibility(), mergeTemplateLV(), clang::LinkageInfo::mergeVisibility(), clang::LinkageInfo::none(), clang::SC_Extern, clang::SC_None, clang::SC_PrivateExtern, clang::SC_Static, clang::LinkageInfo::uniqueExternal(), clang::UniqueExternalLinkage, and useInlineVisibilityHidden().
Referenced by computeLVForDecl().
|
static |
Get the most restrictive linkage for the types and declarations in the given template argument list.
Note that we don't take an LVComputationKind because we always want to honor the visibility of template arguments in the same way.
Definition at line 316 of file Decl.cpp.
References clang::TemplateArgument::Declaration, clang::TemplateArgument::Expression, getLVForDecl(), getLVForType(), clang::TemplateArgument::Integral, clang::LinkageInfo::merge(), clang::TemplateArgument::Null, clang::TemplateArgument::NullPtr, clang::TemplateArgument::Pack, clang::TemplateArgument::Template, clang::TemplateArgument::TemplateExpansion, clang::TemplateArgument::Type, and usesTypeVisibility().
Referenced by getLVForTemplateArgumentList(), and mergeTemplateLV().
|
static |
Definition at line 360 of file Decl.cpp.
References clang::TemplateArgumentList::asArray(), and getLVForTemplateArgumentList().
|
static |
Get the most restrictive linkage for the types in the given template parameter list. For visibility purposes, template parameters are part of the signature of a template.
Definition at line 242 of file Decl.cpp.
References clang::TemplateTemplateParmDecl::getExpansionTemplateParameters(), clang::Type::getLinkageAndVisibility(), getLVForType(), clang::TemplateTemplateParmDecl::getNumExpansionTemplateParameters(), clang::TemplateDecl::getTemplateParameters(), clang::Type::isDependentType(), clang::TemplateTemplateParmDecl::isExpandedParameterPack(), clang::LinkageInfo::merge(), P, and clang::ast_matchers::type.
Referenced by getLVForClassMember(), getLVForNamespaceScopeDecl(), and mergeTemplateLV().
|
static |
Definition at line 232 of file Decl.cpp.
References clang::DefaultVisibility, clang::Type::getLinkage(), clang::Type::getLinkageAndVisibility(), and LVForLinkageOnly.
Referenced by getLVForClassMember(), getLVForNamespaceScopeDecl(), getLVForTemplateArgumentList(), and getLVForTemplateParameterList().
Retrieve the number of module identifiers needed to name the given module.
Definition at line 4029 of file Decl.cpp.
References clang::Module::Parent, and clang::Result.
Referenced by clang::ImportDecl::getIdentifierLocs().
|
inlinestatic |
Definition at line 1213 of file Decl.cpp.
References clang::DeclContext::getParent(), and clang::CXXRecordDecl::isLambda().
Referenced by computeLVForDecl().
Definition at line 300 of file Decl.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getDeclKind(), and clang::DeclContext::getParent().
Referenced by getLVForLocalDecl().
|
static |
Definition at line 1613 of file Decl.cpp.
Referenced by clang::DeclaratorDecl::getOuterLocStart(), and clang::TagDecl::getOuterLocStart().
|
static |
Given a visibility attribute, return the explicit visibility associated with it.
Definition at line 192 of file Decl.cpp.
References clang::DefaultVisibility, clang::HiddenVisibility, and clang::ProtectedVisibility.
Referenced by getVisibilityOf().
|
static |
Return the explicit visibility of the given declaration.
Definition at line 205 of file Decl.cpp.
References clang::DefaultVisibility, clang::Decl::getASTContext(), clang::Decl::getAttr(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), getVisibilityFromAttr(), clang::None, clang::Decl::specific_attrs(), 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 405 of file Decl.cpp.
References clang::Decl::hasAttr(), LVForExplicitType, LVForExplicitValue, LVForLinkageOnly, LVForType, and LVForValue.
Referenced by getLVForClassMember(), and shouldConsiderTemplateVisibility().
|
static |
Does this computation kind permit us to consider additional visibility settings from attributes and the like?
Definition at line 137 of file Decl.cpp.
References IgnoreExplicitVisibilityBit.
Referenced by getExplicitVisibility(), getLVForClassMember(), getLVForLocalDecl(), getLVForNamespaceScopeDecl(), mergeTemplateLV(), and shouldConsiderTemplateVisibility().
|
static |
Definition at line 1865 of file Decl.cpp.
References clang::CLanguageLinkage, and clang::DeclContext::isRecord().
Referenced by clang::VarDecl::isExternC(), and clang::FunctionDecl::isExternC().
|
static |
Does the given declaration have member specialization information, and if so, is it an explicit specialization?
Definition at line 174 of file Decl.cpp.
Referenced by getLVForClassMember().
|
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 185 of file Decl.cpp.
References clang::RedeclarableTemplateDecl::isMemberSpecialization().
|
static |
Definition at line 3650 of file Decl.cpp.
References clang::FieldDecl::classofKind(), and clang::IndirectFieldDecl::classofKind().
|
static |
Definition at line 566 of file Decl.cpp.
Referenced by getDeclLanguageLinkage(), and getLVForNamespaceScopeDecl().
|
static |
Definition at line 1454 of file Decl.cpp.
References clang::ObjCMethodDecl::classofKind(), clang::ObjCInterfaceDecl::classofKind(), clang::ObjCCompatibleAliasDecl::classofKind(), and clang::TypedefNameDecl::classofKind().
Referenced by clang::NamedDecl::declarationReplaces().
|
static |
Definition at line 2429 of file Decl.cpp.
References clang::NamedDecl::getIdentifier(), and clang::IdentifierInfo::isStr().
Referenced by clang::FunctionDecl::isMain(), and clang::FunctionDecl::isReplaceableGlobalAllocationFunction().
|
static |
Definition at line 1484 of file Decl.cpp.
Referenced by clang::NamedDecl::declarationReplaces().
|
static |
Definition at line 571 of file Decl.cpp.
References clang::Decl::getDeclContext().
Referenced by getLVForNamespaceScopeDecl(), and clang::VarDecl::isThisDeclarationADefinition().
|
static |
Merge in template-related linkage and visibility for the given function template specialization.
We don't need a computation kind here because we can assume LVForValue.
[out] | LV | the computation to use for the parent |
Definition at line 385 of file Decl.cpp.
References getLVForTemplateArgumentList(), getLVForTemplateParameterList(), clang::FunctionTemplateSpecializationInfo::getTemplate(), clang::TemplateDecl::getTemplateParameters(), clang::LinkageInfo::mergeMaybeWithVisibility(), shouldConsiderTemplateVisibility(), and clang::FunctionTemplateSpecializationInfo::TemplateArguments.
Referenced by getLVForClassMember(), and getLVForNamespaceScopeDecl().
|
static |
Merge in template-related linkage and visibility for the given class template specialization.
Definition at line 462 of file Decl.cpp.
References getLVForTemplateArgumentList(), getLVForTemplateParameterList(), clang::ClassTemplateSpecializationDecl::getSpecializedTemplate(), clang::ClassTemplateSpecializationDecl::getTemplateArgs(), clang::TemplateDecl::getTemplateParameters(), hasExplicitVisibilityAlready(), clang::LinkageInfo::mergeExternalVisibility(), clang::LinkageInfo::mergeMaybeWithVisibility(), clang::LinkageInfo::mergeVisibility(), and shouldConsiderTemplateVisibility().
|
static |
Merge in template-related linkage and visibility for the given variable template specialization. As usual, follow class template specialization logic up to initialization.
Definition at line 514 of file Decl.cpp.
References getLVForTemplateArgumentList(), getLVForTemplateParameterList(), clang::VarTemplateSpecializationDecl::getSpecializedTemplate(), clang::VarTemplateSpecializationDecl::getTemplateArgs(), clang::TemplateDecl::getTemplateParameters(), hasExplicitVisibilityAlready(), clang::LinkageInfo::mergeExternalVisibility(), clang::LinkageInfo::mergeMaybeWithVisibility(), clang::LinkageInfo::mergeVisibility(), and shouldConsiderTemplateVisibility().
|
static |
Definition at line 2737 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 2725 of file Decl.cpp.
References clang::Redeclarable< decl_type >::getPreviousDecl(), clang::FunctionDecl::getStorageClass(), and clang::SC_Extern.
Referenced by clang::FunctionDecl::doesDeclarationForceExternallyVisibleDefinition().
|
static |
Definition at line 365 of file Decl.cpp.
References clang::Decl::hasAttr(), and clang::FunctionTemplateSpecializationInfo::isExplicitInstantiationOrSpecialization().
Referenced by mergeTemplateLV().
|
static |
Should we consider visibility associated with the template arguments and parameters of the given class template specialization?
Definition at line 426 of file Decl.cpp.
References hasDirectVisibilityAttribute(), hasExplicitVisibilityAlready(), clang::ClassTemplateSpecializationDecl::isExplicitInstantiationOrSpecialization(), and clang::ClassTemplateSpecializationDecl::isExplicitSpecialization().
|
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 490 of file Decl.cpp.
References hasDirectVisibilityAttribute(), hasExplicitVisibilityAlready(), clang::VarTemplateSpecializationDecl::isExplicitInstantiationOrSpecialization(), and clang::VarTemplateSpecializationDecl::isExplicitSpecialization().
Definition at line 538 of file Decl.cpp.
References clang::Decl::getASTContext(), clang::ASTContext::getLangOpts(), clang::FunctionDecl::getMemberSpecializationInfo(), clang::FunctionDecl::getTemplateSpecializationInfo(), clang::Decl::hasAttr(), clang::FunctionDecl::hasBody(), clang::FunctionDecl::isInlined(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, and clang::TSK_Undeclared.
Referenced by getLVForClassMember(), and getLVForNamespaceScopeDecl().
Is the given declaration a "type" or a "value" for the purposes of visibility computation?
Definition at line 164 of file Decl.cpp.
Referenced by clang::NamedDecl::getLinkageAndVisibility(), and getLVForTemplateArgumentList().
|
static |
Given an LVComputationKind, return one of the same type/value sort that records that it already has explicit visibility.
Definition at line 144 of file Decl.cpp.
References IgnoreExplicitVisibilityBit, LVForExplicitType, LVForExplicitValue, LVForType, and LVForValue.
Referenced by getLVForClassMember().
const unsigned IgnoreExplicitVisibilityBit = 2 |
Definition at line 103 of file Decl.cpp.
Referenced by hasExplicitVisibilityAlready(), and withExplicitVisibilityAlready().