clang  6.0.0svn
Macros | Functions
DeclBase.cpp File Reference
#include "clang/AST/DeclBase.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/Attr.h"
#include "clang/AST/AttrIterator.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclContextInternals.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DependentDiagnostic.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/Type.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/VersionTuple.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <string>
#include <tuple>
#include <utility>
#include "clang/AST/DeclNodes.inc"
Include dependency graph for DeclBase.cpp:

Go to the source code of this file.

Macros

#define DECL(DERIVED, BASE)   static int n##DERIVED##s = 0;
 
#define ABSTRACT_DECL(DECL)
 
#define DECL(DERIVED, BASE)
 
#define ABSTRACT_DECL(DECL)
 
#define DECL(DERIVED, BASE)   case DERIVED: return #DERIVED;
 
#define ABSTRACT_DECL(DECL)
 
#define DECL(DERIVED, BASE)   case Decl::DERIVED: return #DERIVED;
 
#define ABSTRACT_DECL(DECL)
 
#define DECL(DERIVED, BASE)   totalDecls += n##DERIVED##s;
 
#define ABSTRACT_DECL(DECL)
 
#define DECL(DERIVED, BASE)
 
#define ABSTRACT_DECL(DECL)
 
#define DECL(DERIVED, BASE)   case DERIVED: ++n##DERIVED##s; break;
 
#define ABSTRACT_DECL(DECL)
 
#define DECL(NAME, BASE)
 
#define DECL_CONTEXT(NAME)
 
#define DECL_CONTEXT_BASE(NAME)
 
#define DECL(NAME, BASE)
 
#define DECL_CONTEXT_BASE(NAME)
 
#define DECL(NAME, BASE)
 
#define DECL_CONTEXT(NAME)
 
#define DECL_CONTEXT_BASE(NAME)
 
#define DECL(NAME, BASE)
 
#define DECL_CONTEXT_BASE(NAME)
 
#define DECL(NAME, BASE)
 
#define DECL_CONTEXT(NAME)   case Decl::NAME:
 
#define DECL_CONTEXT_BASE(NAME)
 
#define DECL(NAME, BASE)
 
#define DECL_CONTEXT_BASE(NAME)
 

Functions

static StringRef getRealizedPlatform (const AvailabilityAttr *A, const ASTContext &Context)
 
static AvailabilityResult CheckAvailability (ASTContext &Context, const AvailabilityAttr *A, std::string *Message, VersionTuple EnclosingVersion)
 Determine the availability of the given declaration based on the target platform. More...
 
static Decl::Kind getKind (const Decl *D)
 
static Decl::Kind getKind (const DeclContext *DC)
 
template<class T >
static DeclgetNonClosureContext (T *D)
 Starting at a given context (a Decl or DeclContext), look for a code context that is not a closure (a lambda, block, etc.). More...
 
static bool isLinkageSpecContext (const DeclContext *DC, LinkageSpecDecl::LanguageIDs ID)
 
static bool shouldBeHidden (NamedDecl *D)
 shouldBeHidden - Determine whether a declaration which was declared within its semantic context should be invisible to qualified name lookup. More...
 

Macro Definition Documentation

◆ ABSTRACT_DECL [1/7]

#define ABSTRACT_DECL (   DECL)

Definition at line 70 of file DeclBase.cpp.

◆ ABSTRACT_DECL [2/7]

#define ABSTRACT_DECL (   DECL)

Definition at line 70 of file DeclBase.cpp.

◆ ABSTRACT_DECL [3/7]

#define ABSTRACT_DECL (   DECL)

Definition at line 70 of file DeclBase.cpp.

◆ ABSTRACT_DECL [4/7]

#define ABSTRACT_DECL (   DECL)

Definition at line 70 of file DeclBase.cpp.

◆ ABSTRACT_DECL [5/7]

#define ABSTRACT_DECL (   DECL)

Definition at line 70 of file DeclBase.cpp.

◆ ABSTRACT_DECL [6/7]

#define ABSTRACT_DECL (   DECL)

Definition at line 70 of file DeclBase.cpp.

◆ ABSTRACT_DECL [7/7]

#define ABSTRACT_DECL (   DECL)

Definition at line 70 of file DeclBase.cpp.

◆ DECL [1/13]

#define DECL (   DERIVED,
  BASE 
)    static int n##DERIVED##s = 0;

Definition at line 67 of file DeclBase.cpp.

◆ DECL [2/13]

#define DECL (   DERIVED,
  BASE 
)
Value:
static_assert(alignof(Decl) >= alignof(DERIVED##Decl), \
"Alignment sufficient after objects prepended to " #DERIVED);
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86

Definition at line 67 of file DeclBase.cpp.

◆ DECL [3/13]

#define DECL (   DERIVED,
  BASE 
)    case DERIVED: return #DERIVED;

Definition at line 67 of file DeclBase.cpp.

◆ DECL [4/13]

#define DECL (   DERIVED,
  BASE 
)    case Decl::DERIVED: return #DERIVED;

Definition at line 67 of file DeclBase.cpp.

◆ DECL [5/13]

#define DECL (   DERIVED,
  BASE 
)    totalDecls += n##DERIVED##s;

Definition at line 67 of file DeclBase.cpp.

◆ DECL [6/13]

#define DECL (   DERIVED,
  BASE 
)
Value:
if (n##DERIVED##s > 0) { \
totalBytes += (int)(n##DERIVED##s * sizeof(DERIVED##Decl)); \
llvm::errs() << " " << n##DERIVED##s << " " #DERIVED " decls, " \
<< sizeof(DERIVED##Decl) << " each (" \
<< n##DERIVED##s * sizeof(DERIVED##Decl) \
<< " bytes)\n"; \
}
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86

Definition at line 67 of file DeclBase.cpp.

◆ DECL [7/13]

#define DECL (   DERIVED,
  BASE 
)    case DERIVED: ++n##DERIVED##s; break;

Definition at line 67 of file DeclBase.cpp.

◆ DECL [8/13]

#define DECL (   NAME,
  BASE 
)

Definition at line 67 of file DeclBase.cpp.

◆ DECL [9/13]

#define DECL (   NAME,
  BASE 
)

Definition at line 67 of file DeclBase.cpp.

◆ DECL [10/13]

#define DECL (   NAME,
  BASE 
)

Definition at line 67 of file DeclBase.cpp.

◆ DECL [11/13]

#define DECL (   NAME,
  BASE 
)

Definition at line 67 of file DeclBase.cpp.

◆ DECL [12/13]

#define DECL (   NAME,
  BASE 
)

Definition at line 67 of file DeclBase.cpp.

◆ DECL [13/13]

#define DECL (   NAME,
  BASE 
)

Definition at line 67 of file DeclBase.cpp.

◆ DECL_CONTEXT [1/3]

#define DECL_CONTEXT (   NAME)
Value:
case Decl::NAME: \
return static_cast<NAME##Decl*>(const_cast<DeclContext*>(D));
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1252

◆ DECL_CONTEXT [2/3]

#define DECL_CONTEXT (   NAME)
Value:
case Decl::NAME: \
return static_cast<NAME##Decl*>(const_cast<Decl*>(D));
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86

◆ DECL_CONTEXT [3/3]

#define DECL_CONTEXT (   NAME)    case Decl::NAME:

◆ DECL_CONTEXT_BASE [1/6]

#define DECL_CONTEXT_BASE (   NAME)

◆ DECL_CONTEXT_BASE [2/6]

#define DECL_CONTEXT_BASE (   NAME)
Value:
if (DK >= first##NAME && DK <= last##NAME) \
return static_cast<NAME##Decl*>(const_cast<DeclContext*>(D));
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1252

◆ DECL_CONTEXT_BASE [3/6]

#define DECL_CONTEXT_BASE (   NAME)

◆ DECL_CONTEXT_BASE [4/6]

#define DECL_CONTEXT_BASE (   NAME)
Value:
if (DK >= first##NAME && DK <= last##NAME) \
return static_cast<NAME##Decl*>(const_cast<Decl*>(D));
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86

◆ DECL_CONTEXT_BASE [5/6]

#define DECL_CONTEXT_BASE (   NAME)

◆ DECL_CONTEXT_BASE [6/6]

#define DECL_CONTEXT_BASE (   NAME)
Value:
if (D->getKind() >= Decl::first##NAME && \
D->getKind() <= Decl::last##NAME) \
return true;

Function Documentation

◆ CheckAvailability()

static AvailabilityResult CheckAvailability ( ASTContext Context,
const AvailabilityAttr *  A,
std::string *  Message,
VersionTuple  EnclosingVersion 
)
static

Determine the availability of the given declaration based on the target platform.

When it returns an availability result other than AR_Available, if the Message parameter is non-NULL, it will be set to a string describing why the entity is unavailable.

FIXME: Make these strings localizable, since they end up in diagnostics.

Definition at line 494 of file DeclBase.cpp.

Referenced by clang::Decl::getAvailability(), and clang::Decl::isWeakImported().

◆ getKind() [1/2]

static Decl::Kind getKind ( const Decl D)
static

Definition at line 915 of file DeclBase.cpp.

References clang::Decl::getKind().

Referenced by clang::InitializedEntity::allowsNRVO(), clang::Type::canHaveNullability(), clang::ento::CallEvent::cloneWithState(), clang::CodeGen::CodeGenTypes::ConvertType(), clang::MacroDirective::dump(), clang::ento::CoreEngine::enqueueStmtNode(), clang::ObjCContainerDecl::FindPropertyDeclaration(), clang::OffsetOfNode::getArrayExprIndex(), clang::TemplateArgument::getAsDecl(), clang::TemplateArgument::getAsExpr(), clang::TemplateArgument::getAsIntegral(), clang::TemplateArgument::getAsTemplate(), clang::TemplateArgument::getAsTemplateOrTemplatePattern(), clang::TemplateArgument::getAsType(), clang::AttributeList::getAvailabilityDeprecated(), clang::AttributeList::getAvailabilityIntroduced(), clang::AttributeList::getAvailabilityObsoleted(), clang::OffsetOfNode::getBase(), clang::driver::Action::getClassName(), clang::InitializedEntity::getDecl(), clang::CFGImplicitDtor::getDestructorDecl(), clang::OffsetOfNode::getField(), clang::OffsetOfNode::getFieldName(), clang::CodeCompleteConsumer::OverloadCandidate::getFunction(), clang::TemplateArgument::getIntegralType(), clang::AttributeList::getKind(), clang::ImplicitConversionSequence::getKindRank(), clang::AttributeList::getLayoutCompatible(), clang::AttributeList::getMatchingCType(), getMaxAtomicAccessSize(), clang::AttributeList::getMessageExpr(), clang::AttributeList::getMustBeNull(), clang::InitializedEntity::getName(), clang::BuiltinType::getName(), clang::TemplateArgument::getNullPtrType(), clang::TemplateArgument::getPackAsArray(), clang::TemplateArgument::getParamTypeForDecl(), clang::AttributeList::getReplacementExpr(), clang::analyze_format_string::ConversionSpecifier::getStandardSpecifier(), clang::AttributeList::getStrictLoc(), clang::AttributeList::getUnavailableLoc(), clang::NamedDecl::getUnderlyingDecl(), HandleOpenCLAccessAttr(), clang::TemplateSpecializationTypeLoc::initializeArgLocs(), clang::AttributeList::isAlignasAttribute(), clang::ImplicitConversionSequence::isAmbiguous(), clang::ImplicitConversionSequence::isBad(), clang::DeclGroupRef::isDeclGroup(), clang::ImplicitConversionSequence::isEllipsis(), clang::VarDecl::isFileVarDecl(), clang::BuiltinType::isFloatingPoint(), clang::VarDecl::isFunctionOrMethodVarDecl(), clang::BuiltinType::isInteger(), clang::VarDecl::isLocalVarDecl(), clang::VarDecl::isLocalVarDeclOrParm(), clang::BuiltinType::isNonOverloadPlaceholderType(), clang::TemplateArgument::isNull(), clang::BuiltinType::isPlaceholderType(), clang::ProgramPoint::isPurgeKind(), clang::BuiltinType::isSignedInteger(), clang::DeclGroupRef::isSingleDecl(), clang::ImplicitConversionSequence::isStandard(), clang::VarDecl::isStaticDataMember(), clang::Decl::isTemplateParameter(), clang::BuiltinType::isUnsignedInteger(), clang::ImplicitConversionSequence::isUserDefined(), clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall(), MatchTwoAttributeLists(), clang::CodeGen::EHScopeStack::iterator::operator++(), clang::StringLiteral::outputString(), clang::TemplateArgument::pack_begin(), clang::TemplateArgument::pack_end(), clang::TemplateArgument::pack_size(), printExprAsWritten(), PrintFloatingLiteral(), clang::ento::MemSpaceRegion::Profile(), clang::ProgramPoint::Profile(), clang::ento::StaticGlobalSpaceRegion::Profile(), clang::ento::StackSpaceRegion::Profile(), clang::ento::PathDiagnosticPiece::Profile(), clang::ento::DeclRegion::Profile(), clang::ProgramPoint::ProgramPoint(), clang::AttributeList::PropertyData::PropertyData(), clang::TemplateArgument::setIntegralType(), clang::Decl::setNonMemberOperator(), sumOffsets(), clang::ast_matchers::dynamic::internal::variadicMatcherDescriptor(), clang::ProgramPoint::withTag(), and clang::ento::CallEvent::~CallEvent().

◆ getKind() [2/2]

static Decl::Kind getKind ( const DeclContext DC)
static

Definition at line 916 of file DeclBase.cpp.

References clang::DeclContext::getDeclKind().

◆ getNonClosureContext()

template<class T >
static Decl* getNonClosureContext ( T *  D)
static

◆ getRealizedPlatform()

static StringRef getRealizedPlatform ( const AvailabilityAttr *  A,
const ASTContext Context 
)
static

Definition at line 472 of file DeclBase.cpp.

◆ isLinkageSpecContext()

static bool isLinkageSpecContext ( const DeclContext DC,
LinkageSpecDecl::LanguageIDs  ID 
)
static

◆ shouldBeHidden()

static bool shouldBeHidden ( NamedDecl D)
static

shouldBeHidden - Determine whether a declaration which was declared within its semantic context should be invisible to qualified name lookup.

Definition at line 1428 of file DeclBase.cpp.

References clang::NamedDecl::getDeclName(), clang::Decl::getIdentifierNamespace(), and clang::Decl::isTemplateParameter().

Referenced by clang::DeclContext::makeDeclVisibleInContext().