Home | History | Annotate | Download | only in AST

Lines Matching refs:Decl

10 // This file implements the Decl and DeclContext classes.
18 #include "clang/AST/Decl.h"
40 #define DECL(DERIVED, BASE) static int n##DERIVED##s = 0;
41 #define ABSTRACT_DECL(DECL)
44 void Decl::updateOutOfDate(IdentifierInfo &II) const {
48 void *Decl::operator new(std::size_t Size, const ASTContext &Context,
66 void *Decl::operator new(std::size_t Size, const ASTContext &Ctx,
72 Module *Decl::getOwningModuleSlow() const {
77 const char *Decl::getDeclKindName() const {
80 #define DECL(DERIVED, BASE) case DERIVED: return #DERIVED;
81 #define ABSTRACT_DECL(DECL)
86 void Decl::setInvalidDecl(bool Invalid) {
100 #define DECL(DERIVED, BASE) case Decl::DERIVED: return #DERIVED;
101 #define ABSTRACT_DECL(DECL)
106 bool Decl::StatisticsEnabled = false;
107 void Decl::EnableStatistics() {
111 void Decl::PrintStats() {
112 llvm::errs() << "\n*** Decl Stats:\n";
115 #define DECL(DERIVED, BASE) totalDecls += n##DERIVED##s;
116 #define ABSTRACT_DECL(DECL)
121 #define DECL(DERIVED, BASE) \
123 totalBytes += (int)(n##DERIVED##s * sizeof(DERIVED##Decl)); \
125 << sizeof(DERIVED##Decl) << " each (" \
126 << n##DERIVED##s * sizeof(DERIVED##Decl) \
129 #define ABSTRACT_DECL(DECL)
135 void Decl::add(Kind k) {
137 #define DECL(DERIVED, BASE) case DERIVED: ++n##DERIVED##s; break;
138 #define ABSTRACT_DECL(DECL)
143 bool Decl::isTemplateParameterPack() const {
155 bool Decl::isParameterPack() const {
162 FunctionDecl *Decl::getAsFunction() {
170 bool Decl::isTemplateDecl() const {
174 const DeclContext *Decl::getParentFunctionOrMethod() const {
210 // Decl Implementation
213 // Out-of-line virtual method providing a home for Decl.
214 Decl::~Decl() { }
216 void Decl::setDeclContext(DeclContext *DC) {
220 void Decl::setLexicalDeclContext(DeclContext *DC) {
231 void Decl::setDeclContextsImpl(DeclContext *SemaDC, DeclContext *LexicalDC,
236 Decl::MultipleDC *MDC = new (Ctx) Decl::MultipleDC();
243 bool Decl::isInAnonymousNamespace() const {
254 bool Decl::isInStdNamespace() const {
258 TranslationUnitDecl *Decl::getTranslationUnitDecl() {
263 assert(DC && "This decl is not contained in a translation unit!");
267 assert(DC && "This decl is not contained in a translation unit!");
273 ASTContext &Decl::getASTContext() const {
277 ASTMutationListener *Decl::getASTMutationListener() const {
281 unsigned Decl::getMaxAlignment() const {
294 bool Decl::isUsed(bool CheckUsedAttr) const {
305 void Decl::markUsed(ASTContext &C) {
315 bool Decl::isReferenced() const {
411 AvailabilityResult Decl::getAvailability(std::string *Message) const {
454 bool Decl::canBeWeakImported(bool &IsDefinition) const {
484 bool Decl::isWeakImported() const {
503 unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) {
600 void Decl::setAttrsImpl(const AttrVec &attrs, ASTContext &Ctx) {
601 assert(!HasAttrs && "Decl already contains attrs.");
610 void Decl::dropAttrs() {
617 const AttrVec &Decl::getAttrs() const {
622 Decl *Decl::castFromDeclContext (const DeclContext *D) {
623 Decl::Kind DK = D->getDeclKind();
625 #define DECL(NAME, BASE)
627 case Decl::NAME: \
628 return static_cast<NAME##Decl*>(const_cast<DeclContext*>(D));
632 #define DECL(NAME, BASE)
635 return static_cast<NAME##Decl*>(const_cast<DeclContext*>(D));
637 llvm_unreachable("a decl that inherits DeclContext isn't handled");
641 DeclContext *Decl::castToDeclContext(const Decl *D) {
642 Decl::Kind DK = D->getKind();
644 #define DECL(NAME, BASE)
646 case Decl::NAME: \
647 return static_cast<NAME##Decl*>(const_cast<Decl*>(D));
651 #define DECL(NAME, BASE)
654 return static_cast<NAME##Decl*>(const_cast<Decl*>(D));
656 llvm_unreachable("a decl that inherits DeclContext isn't handled");
660 SourceLocation Decl::getBodyRBrace() const {
676 bool Decl::AccessDeclContextSanity() const {
701 "Access specifier is AS_none inside a record decl");
706 static Decl::Kind getKind(const Decl *D) { return D->getKind(); }
707 static Decl::Kind getKind(const DeclContext *DC) { return DC->getDeclKind(); }
709 const FunctionType *Decl::getFunctionType(bool BlocksToo) const {
727 /// Starting at a given context (a Decl or DeclContext), look for a
729 template <class T> static Decl *getNonClosureContext(T *D) {
730 if (getKind(D) == Decl::CXXMethod) {
749 Decl *Decl::getNonClosureContext() {
753 Decl *DeclContext::getNonClosureAncestor() {
761 bool DeclContext::classof(const Decl *D) {
763 #define DECL(NAME, BASE)
764 #define DECL_CONTEXT(NAME) case Decl::NAME:
769 #define DECL(NAME, BASE)
771 if (D->getKind() >= Decl::first##NAME && \
772 D->getKind() <= Decl::last##NAME) \
839 if (cast<Decl>(this)->getFriendObjectKind())
847 if (DeclKind == Decl::Enum)
849 else if (DeclKind == Decl::LinkageSpec)
857 while (DC->getDeclKind() != Decl::TranslationUnit) {
858 if (DC->getDeclKind() == Decl::LinkageSpec)
885 case Decl::TranslationUnit:
886 case Decl::LinkageSpec:
887 case Decl::Block:
888 case Decl::Captured:
892 case Decl::Namespace:
896 case Decl::ObjCMethod:
899 case Decl::ObjCInterface:
905 case Decl::ObjCProtocol:
911 case Decl::ObjCCategory:
914 case Decl::ObjCImplementation:
915 case Decl::ObjCCategoryImpl:
919 if (DeclKind >= Decl::firstTag && DeclKind <= Decl::lastTag) {
939 assert(DeclKind >= Decl::firstFunction && DeclKind <= Decl::lastFunction &&
949 if (DeclKind != Decl::Namespace) {
962 std::pair<Decl *, Decl *>
963 DeclContext::BuildDeclChain(ArrayRef<Decl*> Decls,
965 // Build up a chain of declarations via the Decl::NextInContextAndBits field.
966 Decl *FirstNewDecl = nullptr;
967 Decl *PrevDecl = nullptr;
972 Decl *D = Decls[I];
1006 SmallVector<Decl*, 64> Decls;
1028 Decl *ExternalFirst, *ExternalLast;
1114 bool DeclContext::containsDecl(Decl *D) const {
1119 void DeclContext::removeDecl(Decl *D) {
1121 "decl
1123 "decl is not in decls list");
1125 // Remove D from the decl chain. This is O(n) but hopefully rare.
1132 for (Decl *I = FirstDecl; true; I = I->NextInContextAndBits.getPointer()) {
1133 assert(I && "decl not found in linked list");
1142 // Mark that D is no longer in the decl chain.
1156 assert(Pos != Map->end() && "no lookup entry for decl");
1162 void DeclContext::addHiddenDecl(Decl *D) {
1164 "Decl inserted into wrong lexical context");
1166 "Decl already inserted into a DeclContext");
1188 void DeclContext::addDecl(Decl *D) {
1196 void DeclContext::addDeclInternal(Decl *D) {
1264 Decl *D = *I;
1267 // it's semantically within its decl context. Any other decls which
1292 assert(DeclKind != Decl::LinkageSpec &&
1345 assert(DeclKind != Decl::LinkageSpec &&
1410 for (Decl *D = FirstDecl; D; D = D->getNextDeclInContext()) {
1454 // If the decl is being added outside of its semantic decl context, we
1473 // up and perform the insertion. If this decl was declared outside its
1484 // the decl which we are adding, so build a full lookup table before adding
1485 // this decl.
1498 Decl *DCAsDecl = cast<Decl>(this);
1499 // Notify that a decl was made visible unless we are a Tag being defined.