clang API Documentation

Defines | 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/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/StmtCXX.h"
#include "clang/AST/Type.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include "clang/AST/DeclNodes.inc"
Include dependency graph for DeclBase.cpp:

Go to the source code of this file.

Defines

#define DECL(DERIVED, BASE)   static int n##DERIVED##s = 0;
#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 AvailabilityResult CheckAvailability (ASTContext &Context, const AvailabilityAttr *A, std::string *Message)
 Determine the availability of the given declaration based on the target platform.
static Decl::Kind getKind (const Decl *D)
static Decl::Kind getKind (const DeclContext *DC)
template<class T >
static DeclgetNonClosureContext (T *D)
static bool isLinkageSpecContext (const DeclContext *DC, LinkageSpecDecl::LanguageIDs ID)
static bool shouldBeHidden (NamedDecl *D)

Define Documentation

#define ABSTRACT_DECL (   DECL)

Definition at line 41 of file DeclBase.cpp.

#define ABSTRACT_DECL (   DECL)

Definition at line 41 of file DeclBase.cpp.

#define ABSTRACT_DECL (   DECL)

Definition at line 41 of file DeclBase.cpp.

#define ABSTRACT_DECL (   DECL)

Definition at line 41 of file DeclBase.cpp.

#define ABSTRACT_DECL (   DECL)

Definition at line 41 of file DeclBase.cpp.

#define ABSTRACT_DECL (   DECL)

Definition at line 41 of file DeclBase.cpp.

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

Definition at line 40 of file DeclBase.cpp.

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

Definition at line 40 of file DeclBase.cpp.

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

Definition at line 40 of file DeclBase.cpp.

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

Definition at line 40 of file DeclBase.cpp.

#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";                                        \
  }

Definition at line 40 of file DeclBase.cpp.

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

Definition at line 40 of file DeclBase.cpp.

#define DECL (   NAME,
  BASE 
)

Definition at line 40 of file DeclBase.cpp.

#define DECL (   NAME,
  BASE 
)

Definition at line 40 of file DeclBase.cpp.

#define DECL (   NAME,
  BASE 
)

Definition at line 40 of file DeclBase.cpp.

#define DECL (   NAME,
  BASE 
)

Definition at line 40 of file DeclBase.cpp.

#define DECL (   NAME,
  BASE 
)

Definition at line 40 of file DeclBase.cpp.

#define DECL (   NAME,
  BASE 
)

Definition at line 40 of file DeclBase.cpp.

#define DECL_CONTEXT (   NAME)
Value:
case Decl::NAME:       \
      return static_cast<NAME##Decl*>(const_cast<DeclContext*>(D));
#define DECL_CONTEXT (   NAME)
Value:
case Decl::NAME:       \
      return static_cast<NAME##Decl*>(const_cast<Decl*>(D));
#define DECL_CONTEXT (   NAME)    case Decl::NAME:
#define DECL_CONTEXT_BASE (   NAME)
#define DECL_CONTEXT_BASE (   NAME)
Value:
if (DK >= first##NAME && DK <= last##NAME) \
        return static_cast<NAME##Decl*>(const_cast<DeclContext*>(D));
#define DECL_CONTEXT_BASE (   NAME)
#define DECL_CONTEXT_BASE (   NAME)
Value:
if (DK >= first##NAME && DK <= last##NAME)                  \
        return static_cast<NAME##Decl*>(const_cast<Decl*>(D));
#define DECL_CONTEXT_BASE (   NAME)
#define DECL_CONTEXT_BASE (   NAME)
Value:
if (D->getKind() >= Decl::first##NAME &&  \
          D->getKind() <= Decl::last##NAME)     \
        return true;

Function Documentation

static AvailabilityResult CheckAvailability ( ASTContext Context,
const AvailabilityAttr *  A,
std::string *  Message 
) [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 336 of file DeclBase.cpp.

References clang::AR_Available, clang::AR_Deprecated, clang::AR_NotYetIntroduced, clang::AR_Unavailable, clang::VersionTuple::empty(), clang::TargetInfo::getPlatformMinVersion(), clang::TargetInfo::getPlatformName(), clang::ASTContext::getTargetInfo(), and clang::VersionTuple::UseDotAsSeparator().

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

static Decl::Kind getKind ( const Decl D) [static]
static Decl::Kind getKind ( const DeclContext DC) [static]

Definition at line 713 of file DeclBase.cpp.

References clang::DeclContext::getDeclKind().

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

Starting at a given context (a Decl or DeclContext), look for a code context that is not a closure (a lambda, block, etc.).

Definition at line 735 of file DeclBase.cpp.

References getKind(), clang::FunctionDecl::getOverloadedOperator(), clang::DeclContext::getParent(), clang::CXXMethodDecl::getParent(), and clang::CXXRecordDecl::isLambda().

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

static bool isLinkageSpecContext ( const DeclContext DC,
LinkageSpecDecl::LanguageIDs  ID 
) [static]
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 1212 of file DeclBase.cpp.

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