Home | History | Annotate | Download | only in AST

Lines Matching defs:Decl

10 // This file implements the Decl and DeclContext classes.
15 #include "clang/AST/Decl.h"
38 #define DECL(DERIVED, BASE) static int n##DERIVED##s = 0;
39 #define ABSTRACT_DECL(DECL)
42 void *Decl::AllocateDeserializedDecl(const ASTContext &Context,
61 const char *Decl::getDeclKindName() const {
64 #define DECL(DERIVED, BASE) case DERIVED: return #DERIVED;
65 #define ABSTRACT_DECL(DECL)
70 void Decl::setInvalidDecl(bool Invalid) {
83 #define DECL(DERIVED, BASE) case Decl::DERIVED: return #DERIVED;
84 #define ABSTRACT_DECL(DECL)
89 bool Decl::StatisticsEnabled = false;
90 void Decl::EnableStatistics() {
94 void Decl::PrintStats() {
95 llvm::errs() << "\n*** Decl Stats:\n";
98 #define DECL(DERIVED, BASE) totalDecls += n##DERIVED##s;
99 #define ABSTRACT_DECL(DECL)
104 #define DECL(DERIVED, BASE) \
106 totalBytes += (int)(n##DERIVED##s * sizeof(DERIVED##Decl)); \
108 << sizeof(DERIVED##Decl) << " each (" \
109 << n##DERIVED##s * sizeof(DERIVED##Decl) \
112 #define ABSTRACT_DECL(DECL)
118 void Decl::add(Kind k) {
120 #define DECL(DERIVED, BASE) case DERIVED: ++n##DERIVED##s; break;
121 #define ABSTRACT_DECL(DECL)
126 bool Decl::isTemplateParameterPack() const {
138 bool Decl::isParameterPack() const {
145 bool Decl::isFunctionOrFunctionTemplate() const {
152 bool Decl::isTemplateDecl() const {
156 const DeclContext *Decl::getParentFunctionOrMethod() const {
189 // Decl Implementation
192 // Out-of-line virtual method providing a home for Decl.
193 Decl::~Decl() { }
195 void Decl::setDeclContext(DeclContext *DC) {
199 void Decl::setLexicalDeclContext(DeclContext *DC) {
210 void Decl::setDeclContextsImpl(DeclContext *SemaDC, DeclContext *LexicalDC,
215 Decl::MultipleDC *MDC = new (Ctx) Decl::MultipleDC();
222 bool Decl::isInAnonymousNamespace() const {
233 TranslationUnitDecl *Decl::getTranslationUnitDecl() {
238 assert(DC && "This decl is not contained in a translation unit!");
242 assert(DC && "This decl is not contained in a translation unit!");
248 ASTContext &Decl::getASTContext() const {
252 ASTMutationListener *Decl::getASTMutationListener() const {
256 bool Decl::isUsed(bool CheckUsedAttr) const {
273 bool Decl::isReferenced() const {
369 AvailabilityResult Decl::getAvailability(std::string *Message) const {
412 bool Decl::canBeWeakImported(bool &IsDefinition) const {
442 bool Decl::isWeakImported() const {
461 unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) {
551 void Decl::setAttrsImpl(const AttrVec &attrs, ASTContext &Ctx) {
552 assert(!HasAttrs && "Decl already contains attrs.");
561 void Decl::dropAttrs() {
568 const AttrVec &Decl::getAttrs() const {
573 void Decl::swapAttrs(Decl *RHS) {
577 // Usually, neither decl has attrs, nothing to do.
599 Decl *Decl::castFromDeclContext (const DeclContext *D) {
600 Decl::Kind DK = D->getDeclKind();
602 #define DECL(NAME, BASE)
604 case Decl::NAME: \
605 return static_cast<NAME##Decl*>(const_cast<DeclContext*>(D));
609 #define DECL(NAME, BASE)
612 return static_cast<NAME##Decl*>(const_cast<DeclContext*>(D));
614 llvm_unreachable("a decl that inherits DeclContext isn't handled");
618 DeclContext *Decl::castToDeclContext(const Decl *D) {
619 Decl::Kind DK = D->getKind();
621 #define DECL(NAME, BASE)
623 case Decl::NAME: \
624 return static_cast<NAME##Decl*>(const_cast<Decl*>(D));
628 #define DECL(NAME, BASE)
631 return static_cast<NAME##Decl*>(const_cast<Decl*>(D));
633 llvm_unreachable("a decl that inherits DeclContext isn't handled");
637 SourceLocation Decl::getBodyRBrace() const {
653 void Decl::CheckAccessDeclContext() const {
678 "Access specifier is AS_none inside a record decl");
682 DeclContext *Decl::getNonClosureContext() {
691 // decl type and call getDeclContext() than to call getParent().
703 bool DeclContext::classof(const Decl *D) {
705 #define DECL(NAME, BASE)
706 #define DECL_CONTEXT(NAME) case Decl::NAME:
711 #define DECL(NAME, BASE)
713 if (D->getKind() >= Decl::first##NAME && \
714 D->getKind() <= Decl::last##NAME) \
765 if (cast<Decl>(this)->getFriendObjectKind())
773 if (DeclKind == Decl::Enum)
775 else if (DeclKind == Decl::LinkageSpec)
783 while (DC->DeclKind != Decl::TranslationUnit) {
784 if (DC->DeclKind == Decl::LinkageSpec)
804 case Decl::TranslationUnit:
805 case Decl::LinkageSpec:
806 case Decl::Block:
810 case Decl::Namespace:
814 case Decl::ObjCMethod:
817 case Decl::ObjCInterface:
823 case Decl::ObjCProtocol:
829 case Decl::ObjCCategory:
832 case Decl::ObjCImplementation:
833 case Decl::ObjCCategoryImpl:
837 if (DeclKind >= Decl::firstTag && DeclKind <= Decl::lastTag) {
850 // FIXME: is it necessarily being defined in the decl
858 assert(DeclKind >= Decl::firstFunction && DeclKind <= Decl::lastFunction &&
868 if (DeclKind != Decl::Namespace) {
881 std::pair<Decl *, Decl *>
882 DeclContext::BuildDeclChain(ArrayRef<Decl*> Decls,
884 // Build up a chain of declarations via the Decl::NextInContextAndBits field.
885 Decl *FirstNewDecl = 0;
886 Decl *PrevDecl = 0;
891 Decl *D = Decls[I];
914 SmallVector<Decl*, 64> Decls;
936 Decl *ExternalFirst, *ExternalLast;
1000 void DeclContext::removeDecl(Decl *D) {
1002 "decl being removed from non-lexical context");
1004 "decl is not in decls list");
1006 // Remove D from the decl chain. This is O(n) but hopefully rare.
1013 for (Decl *I = FirstDecl; true; I = I->NextInContextAndBits.getPointer()) {
1014 assert(I && "decl not found in linked list");
1023 // Mark that D is no longer in the decl chain.
1037 assert(Pos != Map->end() && "no lookup entry for decl");
1043 void DeclContext::addHiddenDecl(Decl *D) {
1045 "Decl inserted into wrong lexical context");
1047 "Decl already inserted into a DeclContext");
1069 void DeclContext::addDecl(Decl *D) {
1077 void DeclContext::addDeclInternal(Decl *D) {
1137 Decl *D = *I;
1140 // it's semantically within its decl context. Any other decls which
1157 assert(DeclKind != Decl::LinkageSpec &&
1220 for (Decl *D = FirstDecl; D; D = D->getNextDeclInContext()) {
1264 // If the decl is being added outside of its semantic decl context, we
1290 // up and perform the insertion. If this decl was declared outside its
1301 // the decl which we are adding, so build a full lookup table before adding
1302 // this decl.
1315 Decl *DCAsDecl = cast<Decl>(this);
1316 // Notify that a decl was made visible unless we are a Tag being defined.