llvm/clang/lib/AST/DeclBase.cpp

//===- DeclBase.cpp - Declaration AST Node Implementation -----------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements the Decl and DeclContext classes.
//
//===----------------------------------------------------------------------===//

#include "clang/AST/DeclBase.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTLambda.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/Module.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/TargetInfo.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/VersionTuple.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <string>
#include <tuple>
#include <utility>

usingnamespaceclang;

//===----------------------------------------------------------------------===//
//  Statistics
//===----------------------------------------------------------------------===//

#define DECL
#define ABSTRACT_DECL
#include "clang/AST/DeclNodes.inc"

void Decl::updateOutOfDate(IdentifierInfo &II) const {}

#define DECL
#define ABSTRACT_DECL
#include "clang/AST/DeclNodes.inc"

void *Decl::operator new(std::size_t Size, const ASTContext &Context,
                         GlobalDeclID ID, std::size_t Extra) {}

void *Decl::operator new(std::size_t Size, const ASTContext &Ctx,
                         DeclContext *Parent, std::size_t Extra) {}

GlobalDeclID Decl::getGlobalID() const {}

unsigned Decl::getOwningModuleID() const {}

void Decl::setOwningModuleID(unsigned ID) {}

Module *Decl::getOwningModuleSlow() const {}

bool Decl::hasLocalOwningModuleStorage() const {}

const char *Decl::getDeclKindName() const {}

void Decl::setInvalidDecl(bool Invalid) {}

bool DeclContext::hasValidDeclKind() const {}

const char *DeclContext::getDeclKindName() const {}

bool Decl::StatisticsEnabled =;
void Decl::EnableStatistics() {}

void Decl::PrintStats() {}

void Decl::add(Kind k) {}

bool Decl::isTemplateParameterPack() const {}

bool Decl::isParameterPack() const {}

FunctionDecl *Decl::getAsFunction() {}

bool Decl::isTemplateDecl() const {}

TemplateDecl *Decl::getDescribedTemplate() const {}

const TemplateParameterList *Decl::getDescribedTemplateParams() const {}

bool Decl::isTemplated() const {}

unsigned Decl::getTemplateDepth() const {}

const DeclContext *Decl::getParentFunctionOrMethod(bool LexicalParent) const {}

//===----------------------------------------------------------------------===//
// PrettyStackTraceDecl Implementation
//===----------------------------------------------------------------------===//

void PrettyStackTraceDecl::print(raw_ostream &OS) const {}

//===----------------------------------------------------------------------===//
// Decl Implementation
//===----------------------------------------------------------------------===//

// Out-of-line virtual method providing a home for Decl.
Decl::~Decl() = default;

void Decl::setDeclContext(DeclContext *DC) {}

void Decl::setLexicalDeclContext(DeclContext *DC) {}

void Decl::setDeclContextsImpl(DeclContext *SemaDC, DeclContext *LexicalDC,
                               ASTContext &Ctx) {}

bool Decl::isInLocalScopeForInstantiation() const {}

bool Decl::isInAnonymousNamespace() const {}

bool Decl::isInStdNamespace() const {}

bool Decl::isFileContextDecl() const {}

bool Decl::isFlexibleArrayMemberLike(
    ASTContext &Ctx, const Decl *D, QualType Ty,
    LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel,
    bool IgnoreTemplateOrMacroSubstitution) {}

TranslationUnitDecl *Decl::getTranslationUnitDecl() {}

ASTContext &Decl::getASTContext() const {}

/// Helper to get the language options from the ASTContext.
/// Defined out of line to avoid depending on ASTContext.h.
const LangOptions &Decl::getLangOpts() const {}

ASTMutationListener *Decl::getASTMutationListener() const {}

unsigned Decl::getMaxAlignment() const {}

bool Decl::isUsed(bool CheckUsedAttr) const {}

void Decl::markUsed(ASTContext &C) {}

bool Decl::isReferenced() const {}

ExternalSourceSymbolAttr *Decl::getExternalSourceSymbolAttr() const {}

bool Decl::hasDefiningAttr() const {}

const Attr *Decl::getDefiningAttr() const {}

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

/// Determine the availability of the given declaration based on
/// the target platform.
///
/// When it returns an availability result other than \c AR_Available,
/// if the \p 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.
static AvailabilityResult CheckAvailability(ASTContext &Context,
                                            const AvailabilityAttr *A,
                                            std::string *Message,
                                            VersionTuple EnclosingVersion) {}

AvailabilityResult Decl::getAvailability(std::string *Message,
                                         VersionTuple EnclosingVersion,
                                         StringRef *RealizedPlatform) const {}

VersionTuple Decl::getVersionIntroduced() const {}

bool Decl::canBeWeakImported(bool &IsDefinition) const {}

bool Decl::isWeakImported() const {}

unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) {}

void Decl::setAttrsImpl(const AttrVec &attrs, ASTContext &Ctx) {}

void Decl::dropAttrs() {}

void Decl::addAttr(Attr *A) {}

const AttrVec &Decl::getAttrs() const {}

Decl *Decl::castFromDeclContext (const DeclContext *D) {}

DeclContext *Decl::castToDeclContext(const Decl *D) {}

SourceLocation Decl::getBodyRBrace() const {}

bool Decl::AccessDeclContextCheck() const {}

bool Decl::isInExportDeclContext() const {}

bool Decl::isInAnotherModuleUnit() const {}

bool Decl::isInCurrentModuleUnit() const {}

bool Decl::shouldEmitInExternalSource() const {}

bool Decl::isFromExplicitGlobalModule() const {}

bool Decl::isFromGlobalModule() const {}

bool Decl::isInNamedModule() const {}

static Decl::Kind getKind(const Decl *D) {}
static Decl::Kind getKind(const DeclContext *DC) {}

int64_t Decl::getID() const {}

const FunctionType *Decl::getFunctionType(bool BlocksToo) const {}

bool Decl::isFunctionPointerType() const {}

DeclContext *Decl::getNonTransparentDeclContext() {}

/// Starting at a given context (a Decl or DeclContext), look for a
/// code context that is not a closure (a lambda, block, etc.).
template <class T> static Decl *getNonClosureContext(T *D) {}

Decl *Decl::getNonClosureContext() {}

Decl *DeclContext::getNonClosureAncestor() {}

//===----------------------------------------------------------------------===//
// DeclContext Implementation
//===----------------------------------------------------------------------===//

DeclContext::DeclContext(Decl::Kind K) {}

bool DeclContext::classof(const Decl *D) {}

DeclContext::~DeclContext() = default;

/// Find the parent context of this context that will be
/// used for unqualified name lookup.
///
/// Generally, the parent lookup context is the semantic context. However, for
/// a friend function the parent lookup context is the lexical context, which
/// is the class in which the friend is declared.
DeclContext *DeclContext::getLookupParent() {}

const BlockDecl *DeclContext::getInnermostBlockDecl() const {}

bool DeclContext::isInlineNamespace() const {}

bool DeclContext::isStdNamespace() const {}

bool DeclContext::isDependentContext() const {}

bool DeclContext::isTransparentContext() const {}

static bool isLinkageSpecContext(const DeclContext *DC,
                                 LinkageSpecLanguageIDs ID) {}

bool DeclContext::isExternCContext() const {}

const LinkageSpecDecl *DeclContext::getExternCContext() const {}

bool DeclContext::isExternCXXContext() const {}

bool DeclContext::Encloses(const DeclContext *DC) const {}

DeclContext *DeclContext::getNonTransparentContext() {}

DeclContext *DeclContext::getPrimaryContext() {}

template <typename T>
void collectAllContextsImpl(T *Self, SmallVectorImpl<DeclContext *> &Contexts) {}

void DeclContext::collectAllContexts(SmallVectorImpl<DeclContext *> &Contexts) {}

std::pair<Decl *, Decl *>
DeclContext::BuildDeclChain(ArrayRef<Decl *> Decls,
                            bool FieldsAlreadyLoaded) {}

/// We have just acquired external visible storage, and we already have
/// built a lookup map. For every name in the map, pull in the new names from
/// the external storage.
void DeclContext::reconcileExternalVisibleStorage() const {}

/// Load the declarations within this lexical storage from an
/// external source.
/// \return \c true if any declarations were added.
bool
DeclContext::LoadLexicalDeclsFromExternalStorage() const {}

DeclContext::lookup_result
ExternalASTSource::SetNoExternalVisibleDeclsForName(const DeclContext *DC,
                                                    DeclarationName Name) {}

DeclContext::lookup_result
ExternalASTSource::SetExternalVisibleDeclsForName(const DeclContext *DC,
                                                  DeclarationName Name,
                                                  ArrayRef<NamedDecl*> Decls) {}

DeclContext::decl_iterator DeclContext::decls_begin() const {}

bool DeclContext::decls_empty() const {}

bool DeclContext::containsDecl(Decl *D) const {}

bool DeclContext::containsDeclAndLoad(Decl *D) const {}

/// shouldBeHidden - Determine whether a declaration which was declared
/// within its semantic context should be invisible to qualified name lookup.
static bool shouldBeHidden(NamedDecl *D) {}

void DeclContext::removeDecl(Decl *D) {}

void DeclContext::addHiddenDecl(Decl *D) {}

void DeclContext::addDecl(Decl *D) {}

void DeclContext::addDeclInternal(Decl *D) {}

/// buildLookup - Build the lookup data structure with all of the
/// declarations in this DeclContext (and any other contexts linked
/// to it or transparent contexts nested within it) and return it.
///
/// Note that the produced map may miss out declarations from an
/// external source. If it does, those entries will be marked with
/// the 'hasExternalDecls' flag.
StoredDeclsMap *DeclContext::buildLookup() {}

/// buildLookupImpl - Build part of the lookup data structure for the
/// declarations contained within DCtx, which will either be this
/// DeclContext, a DeclContext linked to it, or a transparent context
/// nested within it.
void DeclContext::buildLookupImpl(DeclContext *DCtx, bool Internal) {}

DeclContext::lookup_result
DeclContext::lookup(DeclarationName Name) const {}

DeclContext::lookup_result
DeclContext::noload_lookup(DeclarationName Name) {}

// If we have any lazy lexical declarations not in our lookup map, add them
// now. Don't import any external declarations, not even if we know we have
// some missing from the external visible lookups.
void DeclContext::loadLazyLocalLexicalLookups() {}

void DeclContext::localUncachedLookup(DeclarationName Name,
                                      SmallVectorImpl<NamedDecl *> &Results) {}

DeclContext *DeclContext::getRedeclContext() {}

DeclContext *DeclContext::getEnclosingNamespaceContext() {}

RecordDecl *DeclContext::getOuterLexicalRecordContext() {}

bool DeclContext::InEnclosingNamespaceSetOf(const DeclContext *O) const {}

void DeclContext::makeDeclVisibleInContext(NamedDecl *D) {}

void DeclContext::makeDeclVisibleInContextWithFlags(NamedDecl *D, bool Internal,
                                                    bool Recoverable) {}

void DeclContext::makeDeclVisibleInContextImpl(NamedDecl *D, bool Internal) {}

UsingDirectiveDecl *DeclContext::udir_iterator::operator*() const {}

/// Returns iterator range [First, Last) of UsingDirectiveDecls stored within
/// this context.
DeclContext::udir_range DeclContext::using_directives() const {}

//===----------------------------------------------------------------------===//
// Creation and Destruction of StoredDeclsMaps.                               //
//===----------------------------------------------------------------------===//

StoredDeclsMap *DeclContext::CreateStoredDeclsMap(ASTContext &C) const {}

void ASTContext::ReleaseDeclContextMaps() {}

void StoredDeclsMap::DestroyAll(StoredDeclsMap *Map, bool Dependent) {}

DependentDiagnostic *DependentDiagnostic::Create(ASTContext &C,
                                                 DeclContext *Parent,
                                           const PartialDiagnostic &PDiag) {}

unsigned DeclIDBase::getLocalDeclIndex() const {}