diff options
Diffstat (limited to 'include/clang/AST/ASTContext.h')
-rw-r--r-- | include/clang/AST/ASTContext.h | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 2ed9fd7..6767f52 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -67,6 +67,28 @@ namespace clang { namespace Builtin { class Context; } +/// \brief A vector of C++ member functions that is optimized for +/// storing a single method. +class CXXMethodVector { + /// \brief Storage for the vector. + /// + /// When the low bit is zero, this is a const CXXMethodDecl *. When the + /// low bit is one, this is a std::vector<const CXXMethodDecl *> *. + mutable uintptr_t Storage; + + typedef std::vector<const CXXMethodDecl *> vector_type; + +public: + CXXMethodVector() : Storage(0) { } + + typedef const CXXMethodDecl **iterator; + iterator begin() const; + iterator end() const; + + void push_back(const CXXMethodDecl *Method); + void Destroy(); +}; + /// ASTContext - This class holds long-lived AST nodes (such as types and /// decls) that can be referred to throughout the semantic analysis of a file. class ASTContext { @@ -219,6 +241,14 @@ class ASTContext { llvm::DenseMap<FieldDecl *, FieldDecl *> InstantiatedFromUnnamedFieldDecl; + /// \brief Mapping that stores the methods overridden by a given C++ + /// member function. + /// + /// Since most C++ member functions aren't virtual and therefore + /// don't override anything, we store the overridden functions in + /// this map on the side rather than within the CXXMethodDecl structure. + llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector> OverriddenMethods; + TranslationUnitDecl *TUDecl; /// SourceMgr - The associated SourceManager object. @@ -310,6 +340,19 @@ public: void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl); + // Access to the set of methods overridden by the given C++ method. + typedef CXXMethodVector::iterator overridden_cxx_method_iterator; + overridden_cxx_method_iterator + overridden_methods_begin(const CXXMethodDecl *Method) const; + + overridden_cxx_method_iterator + overridden_methods_end(const CXXMethodDecl *Method) const; + + /// \brief Note that the given C++ \p Method overrides the given \p + /// Overridden method. + void addOverriddenMethod(const CXXMethodDecl *Method, + const CXXMethodDecl *Overridden); + TranslationUnitDecl *getTranslationUnitDecl() const { return TUDecl; } @@ -529,11 +572,11 @@ public: /// list. isVariadic indicates whether the argument list includes '...'. QualType getFunctionType(QualType ResultTy, const QualType *ArgArray, unsigned NumArgs, bool isVariadic, - unsigned TypeQuals, bool hasExceptionSpec = false, - bool hasAnyExceptionSpec = false, - unsigned NumExs = 0, const QualType *ExArray = 0, - bool NoReturn = false, - CallingConv CallConv = CC_Default); + unsigned TypeQuals, bool hasExceptionSpec, + bool hasAnyExceptionSpec, + unsigned NumExs, const QualType *ExArray, + bool NoReturn, + CallingConv CallConv); /// getTypeDeclType - Return the unique reference to the type for /// the specified type declaration. @@ -882,9 +925,8 @@ public: llvm::SmallVectorImpl<FieldDecl*> &Fields); void ShallowCollectObjCIvars(const ObjCInterfaceDecl *OI, - llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars, - bool CollectSynthesized = true); - void CollectSynthesizedIvars(const ObjCInterfaceDecl *OI, + llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars); + void CollectNonClassIvars(const ObjCInterfaceDecl *OI, llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars); void CollectProtocolSynthesizedIvars(const ObjCProtocolDecl *PD, llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars); |