diff options
Diffstat (limited to 'clang/include/clang')
-rw-r--r-- | clang/include/clang/AST/Decl.h | 38 | ||||
-rw-r--r-- | clang/include/clang/AST/DeclCXX.h | 6 | ||||
-rw-r--r-- | clang/include/clang/AST/DeclObjC.h | 16 | ||||
-rw-r--r-- | clang/include/clang/AST/DeclTemplate.h | 30 | ||||
-rw-r--r-- | clang/include/clang/AST/Redeclarable.h | 24 |
5 files changed, 43 insertions, 71 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 9d2a747ca30..c9b86565367 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -394,7 +394,7 @@ public: /// \brief Get the original (first) namespace declaration. NamespaceDecl *getOriginalNamespace() { - if (isFirstDeclaration()) + if (isFirstDecl()) return this; return AnonOrFirstNamespaceAndInline.getPointer(); @@ -402,7 +402,7 @@ public: /// \brief Get the original (first) namespace declaration. const NamespaceDecl *getOriginalNamespace() const { - if (isFirstDeclaration()) + if (isFirstDecl()) return this; return AnonOrFirstNamespaceAndInline.getPointer(); @@ -411,9 +411,7 @@ public: /// \brief Return true if this declaration is an original (first) declaration /// of the namespace. This is false for non-original (subsequent) namespace /// declarations and anonymous namespaces. - bool isOriginalNamespace() const { - return isFirstDeclaration(); - } + bool isOriginalNamespace() const { return isFirstDecl(); } /// \brief Retrieve the anonymous namespace nested inside this namespace, /// if any. @@ -2223,12 +2221,8 @@ public: SourceRange getSourceRange() const LLVM_READONLY; /// Retrieves the canonical declaration of this field. - FieldDecl *getCanonicalDecl() { - return getFirstDeclaration(); - } - const FieldDecl *getCanonicalDecl() const { - return getFirstDeclaration(); - } + FieldDecl *getCanonicalDecl() { return getFirstDecl(); } + const FieldDecl *getCanonicalDecl() const { return getFirstDecl(); } // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } @@ -2269,12 +2263,8 @@ public: SourceRange getSourceRange() const LLVM_READONLY; /// Retrieves the canonical declaration of this enumerator. - EnumConstantDecl *getCanonicalDecl() { - return getFirstDeclaration(); - } - const EnumConstantDecl *getCanonicalDecl() const { - return getFirstDeclaration(); - } + EnumConstantDecl *getCanonicalDecl() { return getFirstDecl(); } + const EnumConstantDecl *getCanonicalDecl() const { return getFirstDecl(); } // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } @@ -2421,12 +2411,8 @@ public: } /// Retrieves the canonical declaration of this typedef-name. - TypedefNameDecl *getCanonicalDecl() { - return getFirstDeclaration(); - } - const TypedefNameDecl *getCanonicalDecl() const { - return getFirstDeclaration(); - } + TypedefNameDecl *getCanonicalDecl() { return getFirstDecl(); } + const TypedefNameDecl *getCanonicalDecl() const { return getFirstDecl(); } // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } @@ -2565,7 +2551,7 @@ protected: NamedDeclOrQualifier((NamedDecl *)0) { assert((DK != Enum || TK == TTK_Enum) && "EnumDecl not matched with TTK_Enum"); - setPreviousDeclaration(PrevDecl); + setPreviousDecl(PrevDecl); } typedef Redeclarable<TagDecl> redeclarable_base; @@ -3487,7 +3473,7 @@ inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD, } template<typename decl_type> -void Redeclarable<decl_type>::setPreviousDeclaration(decl_type *PrevDecl) { +void Redeclarable<decl_type>::setPreviousDecl(decl_type *PrevDecl) { // Note: This routine is implemented here because we need both NamedDecl // and Redeclarable to be defined. @@ -3497,7 +3483,7 @@ void Redeclarable<decl_type>::setPreviousDeclaration(decl_type *PrevDecl) { // Point to previous. Make sure that this is actually the most recent // redeclaration, or we can build invalid chains. If the most recent // redeclaration is invalid, it won't be PrevDecl, but we want it anyway. - First = PrevDecl->getFirstDeclaration(); + First = PrevDecl->getFirstDecl(); assert(First->RedeclLink.NextIsLatest() && "Expected first"); decl_type *MostRecent = First->RedeclLink.getNext(); RedeclLink = PreviousDeclLink(cast<decl_type>(MostRecent)); diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index effe58eac99..7b5e0cbb4ac 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -2111,8 +2111,7 @@ public: /// \brief Determine whether this constructor was marked "explicit" or not. bool isExplicit() const { - return cast<CXXConstructorDecl>(getFirstDeclaration()) - ->isExplicitSpecified(); + return cast<CXXConstructorDecl>(getFirstDecl())->isExplicitSpecified(); } /// \brief Iterates through the member/base initializer list. @@ -2352,8 +2351,7 @@ public: /// Explicit conversion operators are only considered for direct /// initialization, e.g., when the user has explicitly written a cast. bool isExplicit() const { - return cast<CXXConversionDecl>(getFirstDeclaration()) - ->isExplicitSpecified(); + return cast<CXXConversionDecl>(getFirstDecl())->isExplicitSpecified(); } /// \brief Returns the type that this conversion function is converting to. diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h index 1e7a0d7a9a9..ee204a6bbff 100644 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -1203,12 +1203,8 @@ public: using redeclarable_base::getMostRecentDecl; /// Retrieves the canonical declaration of this Objective-C class. - ObjCInterfaceDecl *getCanonicalDecl() { - return getFirstDeclaration(); - } - const ObjCInterfaceDecl *getCanonicalDecl() const { - return getFirstDeclaration(); - } + ObjCInterfaceDecl *getCanonicalDecl() { return getFirstDecl(); } + const ObjCInterfaceDecl *getCanonicalDecl() const { return getFirstDecl(); } // Low-level accessor const Type *getTypeForDecl() const { return TypeForDecl; } @@ -1509,12 +1505,8 @@ public: using redeclarable_base::getMostRecentDecl; /// Retrieves the canonical declaration of this Objective-C protocol. - ObjCProtocolDecl *getCanonicalDecl() { - return getFirstDeclaration(); - } - const ObjCProtocolDecl *getCanonicalDecl() const { - return getFirstDeclaration(); - } + ObjCProtocolDecl *getCanonicalDecl() { return getFirstDecl(); } + const ObjCProtocolDecl *getCanonicalDecl() const { return getFirstDecl(); } virtual void collectPropertiesToImplement(PropertyMap &PM, PropertyDeclOrder &PO) const; diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index f92c283f29d..a663823a13a 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -631,9 +631,9 @@ public: template <class decl_type> friend class RedeclarableTemplate; /// \brief Retrieves the canonical declaration of this template. - RedeclarableTemplateDecl *getCanonicalDecl() { return getFirstDeclaration(); } - const RedeclarableTemplateDecl *getCanonicalDecl() const { - return getFirstDeclaration(); + RedeclarableTemplateDecl *getCanonicalDecl() { return getFirstDecl(); } + const RedeclarableTemplateDecl *getCanonicalDecl() const { + return getFirstDecl(); } /// \brief Determines whether this template was a specialization of a @@ -1725,15 +1725,15 @@ public: /// \c Outer<float>::Inner<U*>, this function would return /// \c Outer<T>::Inner<U*>. ClassTemplatePartialSpecializationDecl *getInstantiatedFromMember() { - ClassTemplatePartialSpecializationDecl *First - = cast<ClassTemplatePartialSpecializationDecl>(getFirstDeclaration()); + ClassTemplatePartialSpecializationDecl *First = + cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl()); return First->InstantiatedFromMember.getPointer(); } void setInstantiatedFromMember( ClassTemplatePartialSpecializationDecl *PartialSpec) { - ClassTemplatePartialSpecializationDecl *First - = cast<ClassTemplatePartialSpecializationDecl>(getFirstDeclaration()); + ClassTemplatePartialSpecializationDecl *First = + cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl()); First->InstantiatedFromMember.setPointer(PartialSpec); } @@ -1754,15 +1754,15 @@ public: /// struct X<int>::Inner<T*> { /* ... */ }; /// \endcode bool isMemberSpecialization() { - ClassTemplatePartialSpecializationDecl *First - = cast<ClassTemplatePartialSpecializationDecl>(getFirstDeclaration()); + ClassTemplatePartialSpecializationDecl *First = + cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl()); return First->InstantiatedFromMember.getInt(); } /// \brief Note that this member template is a specialization. void setMemberSpecialization() { - ClassTemplatePartialSpecializationDecl *First - = cast<ClassTemplatePartialSpecializationDecl>(getFirstDeclaration()); + ClassTemplatePartialSpecializationDecl *First = + cast<ClassTemplatePartialSpecializationDecl>(getFirstDecl()); assert(First->InstantiatedFromMember.getPointer() && "Only member templates can be member template specializations"); return First->InstantiatedFromMember.setInt(true); @@ -2574,14 +2574,14 @@ public: /// \c Outer<T>::Inner<U*>. VarTemplatePartialSpecializationDecl *getInstantiatedFromMember() { VarTemplatePartialSpecializationDecl *First = - cast<VarTemplatePartialSpecializationDecl>(getFirstDeclaration()); + cast<VarTemplatePartialSpecializationDecl>(getFirstDecl()); return First->InstantiatedFromMember.getPointer(); } void setInstantiatedFromMember(VarTemplatePartialSpecializationDecl *PartialSpec) { VarTemplatePartialSpecializationDecl *First = - cast<VarTemplatePartialSpecializationDecl>(getFirstDeclaration()); + cast<VarTemplatePartialSpecializationDecl>(getFirstDecl()); First->InstantiatedFromMember.setPointer(PartialSpec); } @@ -2603,14 +2603,14 @@ public: /// \endcode bool isMemberSpecialization() { VarTemplatePartialSpecializationDecl *First = - cast<VarTemplatePartialSpecializationDecl>(getFirstDeclaration()); + cast<VarTemplatePartialSpecializationDecl>(getFirstDecl()); return First->InstantiatedFromMember.getInt(); } /// \brief Note that this member template is a specialization. void setMemberSpecialization() { VarTemplatePartialSpecializationDecl *First = - cast<VarTemplatePartialSpecializationDecl>(getFirstDeclaration()); + cast<VarTemplatePartialSpecializationDecl>(getFirstDecl()); assert(First->InstantiatedFromMember.getPointer() && "Only member templates can be member template specializations"); return First->InstantiatedFromMember.setInt(true); diff --git a/clang/include/clang/AST/Redeclarable.h b/clang/include/clang/AST/Redeclarable.h index fbf89963ef4..912fc456a8f 100644 --- a/clang/include/clang/AST/Redeclarable.h +++ b/clang/include/clang/AST/Redeclarable.h @@ -75,7 +75,7 @@ public: /// \brief Return the first declaration of this declaration or itself if this /// is the only declaration. - decl_type *getFirstDeclaration() { + decl_type *getFirstDecl() { decl_type *D = static_cast<decl_type*>(this); while (D->getPreviousDecl()) D = D->getPreviousDecl(); @@ -84,7 +84,7 @@ public: /// \brief Return the first declaration of this declaration or itself if this /// is the only declaration. - const decl_type *getFirstDeclaration() const { + const decl_type *getFirstDecl() const { const decl_type *D = static_cast<const decl_type*>(this); while (D->getPreviousDecl()) D = D->getPreviousDecl(); @@ -92,23 +92,21 @@ public: } /// \brief Returns true if this is the first declaration. - bool isFirstDeclaration() const { - return RedeclLink.NextIsLatest(); - } + bool isFirstDecl() const { return RedeclLink.NextIsLatest(); } /// \brief Returns the most recent (re)declaration of this declaration. decl_type *getMostRecentDecl() { - return getFirstDeclaration()->RedeclLink.getNext(); + return getFirstDecl()->RedeclLink.getNext(); } /// \brief Returns the most recent (re)declaration of this declaration. const decl_type *getMostRecentDecl() const { - return getFirstDeclaration()->RedeclLink.getNext(); + return getFirstDecl()->RedeclLink.getNext(); } /// \brief Set the previous declaration. If PrevDecl is NULL, set this as the /// first and only declaration. - void setPreviousDeclaration(decl_type *PrevDecl); + void setPreviousDecl(decl_type *PrevDecl); /// \brief Iterates through all the redeclarations of the same decl. class redecl_iterator { @@ -134,7 +132,7 @@ public: redecl_iterator& operator++() { assert(Current && "Advancing while iterator has reached end"); // Sanity check to avoid infinite loop on invalid redecl chain. - if (Current->isFirstDeclaration()) { + if (Current->isFirstDecl()) { if (PassedFirst) { assert(0 && "Passed first decl twice, invalid redecl chain!"); Current = 0; @@ -189,7 +187,7 @@ public: /// \brief Return the first declaration of this declaration or itself if this /// is the only declaration. - decl_type *getFirstDeclaration() { + decl_type *getFirstDecl() { decl_type *D = static_cast<decl_type*>(this); if (!D->isFromASTFile()) return D; @@ -198,7 +196,7 @@ public: /// \brief Return the first declaration of this declaration or itself if this /// is the only declaration. - const decl_type *getFirstDeclaration() const { + const decl_type *getFirstDecl() const { const decl_type *D = static_cast<const decl_type*>(this); if (!D->isFromASTFile()) return D; @@ -206,9 +204,7 @@ public: } /// \brief Returns true if this is the first declaration. - bool isFirstDeclaration() const { - return getFirstDeclaration() == this; - } + bool isFirstDecl() const { return getFirstDecl() == this; } }; } |