diff options
Diffstat (limited to 'clang/include')
-rw-r--r-- | clang/include/clang/AST/ASTContext.h | 15 | ||||
-rw-r--r-- | clang/include/clang/AST/Decl.h | 50 | ||||
-rw-r--r-- | clang/include/clang/AST/DeclCXX.h | 12 | ||||
-rw-r--r-- | clang/include/clang/AST/Stmt.h | 28 | ||||
-rw-r--r-- | clang/include/clang/AST/TemplateName.h | 49 |
5 files changed, 39 insertions, 115 deletions
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 44b5e3989b2..4a807773f2a 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -2256,9 +2256,7 @@ public: const FunctionProtoType *FromFunctionType, const FunctionProtoType *ToFunctionType); - void ResetObjCLayout(const ObjCContainerDecl *CD) { - ObjCLayouts[CD] = nullptr; - } + void ResetObjCLayout(const ObjCContainerDecl *CD); //===--------------------------------------------------------------------===// // Integer Predicates @@ -2309,16 +2307,11 @@ public: /// \brief Get the duplicate declaration of a ObjCMethod in the same /// interface, or null if none exists. - const ObjCMethodDecl *getObjCMethodRedeclaration( - const ObjCMethodDecl *MD) const { - return ObjCMethodRedecls.lookup(MD); - } + const ObjCMethodDecl * + getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const; void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, - const ObjCMethodDecl *Redecl) { - assert(!getObjCMethodRedeclaration(MD) && "MD already has a redeclaration"); - ObjCMethodRedecls[MD] = Redecl; - } + const ObjCMethodDecl *Redecl); /// \brief Returns the Objective-C interface that \p ND belongs to if it is /// an Objective-C method/property/ivar etc. that is part of an interface, diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index da4ceebe997..1b4e3731e15 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -464,25 +464,15 @@ public: } /// \brief Get the original (first) namespace declaration. - NamespaceDecl *getOriginalNamespace() { - if (isFirstDecl()) - return this; - - return AnonOrFirstNamespaceAndInline.getPointer(); - } + NamespaceDecl *getOriginalNamespace(); /// \brief Get the original (first) namespace declaration. - const NamespaceDecl *getOriginalNamespace() const { - if (isFirstDecl()) - return this; - - return AnonOrFirstNamespaceAndInline.getPointer(); - } + const NamespaceDecl *getOriginalNamespace() const; /// \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 isFirstDecl(); } + bool isOriginalNamespace() const; /// \brief Retrieve the anonymous namespace nested inside this namespace, /// if any. @@ -2053,9 +2043,7 @@ public: /// \brief If this function is an instantiation of a member function of a /// class template specialization, retrieves the member specialization /// information. - MemberSpecializationInfo *getMemberSpecializationInfo() const { - return TemplateOrSpecialization.dyn_cast<MemberSpecializationInfo*>(); - } + MemberSpecializationInfo *getMemberSpecializationInfo() const; /// \brief Specify that this record is an instantiation of the /// member function FD. @@ -2076,13 +2064,9 @@ public: /// FunctionDecl that describes the function template, /// getDescribedFunctionTemplate() retrieves the /// FunctionTemplateDecl from a FunctionDecl. - FunctionTemplateDecl *getDescribedFunctionTemplate() const { - return TemplateOrSpecialization.dyn_cast<FunctionTemplateDecl*>(); - } + FunctionTemplateDecl *getDescribedFunctionTemplate() const; - void setDescribedFunctionTemplate(FunctionTemplateDecl *Template) { - TemplateOrSpecialization = Template; - } + void setDescribedFunctionTemplate(FunctionTemplateDecl *Template); /// \brief Determine whether this function is a function template /// specialization. @@ -2097,10 +2081,7 @@ public: /// \brief If this function is actually a function template specialization, /// retrieve information about this function template specialization. /// Otherwise, returns NULL. - FunctionTemplateSpecializationInfo *getTemplateSpecializationInfo() const { - return TemplateOrSpecialization. - dyn_cast<FunctionTemplateSpecializationInfo*>(); - } + FunctionTemplateSpecializationInfo *getTemplateSpecializationInfo() const; /// \brief Determines whether this function is a function template /// specialization or a member of a class template specialization that can @@ -2177,10 +2158,7 @@ public: const TemplateArgumentListInfo &TemplateArgs); DependentFunctionTemplateSpecializationInfo * - getDependentSpecializationInfo() const { - return TemplateOrSpecialization. - dyn_cast<DependentFunctionTemplateSpecializationInfo*>(); - } + getDependentSpecializationInfo() const; /// \brief Determine what kind of template instantiation this function /// represents. @@ -3597,9 +3575,7 @@ private: /// \brief The body of the outlined function. llvm::PointerIntPair<Stmt *, 1, bool> BodyAndNothrow; - explicit CapturedDecl(DeclContext *DC, unsigned NumParams) - : Decl(Captured, DC, SourceLocation()), DeclContext(Captured), - NumParams(NumParams), ContextParam(0), BodyAndNothrow(nullptr, false) { } + explicit CapturedDecl(DeclContext *DC, unsigned NumParams); ImplicitParamDecl *const *getParams() const { return getTrailingObjects<ImplicitParamDecl *>(); @@ -3615,11 +3591,11 @@ public: static CapturedDecl *CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumParams); - Stmt *getBody() const override { return BodyAndNothrow.getPointer(); } - void setBody(Stmt *B) { BodyAndNothrow.setPointer(B); } + Stmt *getBody() const override; + void setBody(Stmt *B); - bool isNothrow() const { return BodyAndNothrow.getInt(); } - void setNothrow(bool Nothrow = true) { BodyAndNothrow.setInt(Nothrow); } + bool isNothrow() const; + void setNothrow(bool Nothrow = true); unsigned getNumParams() const { return NumParams; } diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index c24823f7f17..7c54901be3e 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -1344,9 +1344,7 @@ public: /// \brief If this class is an instantiation of a member class of a /// class template specialization, retrieves the member specialization /// information. - MemberSpecializationInfo *getMemberSpecializationInfo() const { - return TemplateOrInstantiation.dyn_cast<MemberSpecializationInfo *>(); - } + MemberSpecializationInfo *getMemberSpecializationInfo() const; /// \brief Specify that this record is an instantiation of the /// member class \p RD. @@ -1364,13 +1362,9 @@ public: /// CXXRecordDecl that from a ClassTemplateDecl, while /// getDescribedClassTemplate() retrieves the ClassTemplateDecl from /// a CXXRecordDecl. - ClassTemplateDecl *getDescribedClassTemplate() const { - return TemplateOrInstantiation.dyn_cast<ClassTemplateDecl*>(); - } + ClassTemplateDecl *getDescribedClassTemplate() const; - void setDescribedClassTemplate(ClassTemplateDecl *Template) { - TemplateOrInstantiation = Template; - } + void setDescribedClassTemplate(ClassTemplateDecl *Template); /// \brief Determine whether this particular class is a specialization or /// instantiation of a class template or member class of a class template, diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h index 1d1a99ed690..e48b7dcc28f 100644 --- a/clang/include/clang/AST/Stmt.h +++ b/clang/include/clang/AST/Stmt.h @@ -2011,7 +2011,7 @@ public: VarDecl *Var = nullptr); /// \brief Determine the kind of capture. - VariableCaptureKind getCaptureKind() const { return VarAndKind.getInt(); } + VariableCaptureKind getCaptureKind() const; /// \brief Retrieve the source location at which the variable or 'this' was /// first used. @@ -2037,11 +2037,8 @@ public: /// \brief Retrieve the declaration of the variable being captured. /// /// This operation is only valid if this capture captures a variable. - VarDecl *getCapturedVar() const { - assert((capturesVariable() || capturesVariableByCopy()) && - "No variable available for 'this' or VAT capture"); - return VarAndKind.getPointer(); - } + VarDecl *getCapturedVar() const; + friend class ASTStmtReader; }; @@ -2088,26 +2085,17 @@ public: const Stmt *getCapturedStmt() const { return getStoredStmts()[NumCaptures]; } /// \brief Retrieve the outlined function declaration. - CapturedDecl *getCapturedDecl() { return CapDeclAndKind.getPointer(); } - const CapturedDecl *getCapturedDecl() const { - return CapDeclAndKind.getPointer(); - } + CapturedDecl *getCapturedDecl(); + const CapturedDecl *getCapturedDecl() const; /// \brief Set the outlined function declaration. - void setCapturedDecl(CapturedDecl *D) { - assert(D && "null CapturedDecl"); - CapDeclAndKind.setPointer(D); - } + void setCapturedDecl(CapturedDecl *D); /// \brief Retrieve the captured region kind. - CapturedRegionKind getCapturedRegionKind() const { - return CapDeclAndKind.getInt(); - } + CapturedRegionKind getCapturedRegionKind() const; /// \brief Set the captured region kind. - void setCapturedRegionKind(CapturedRegionKind Kind) { - CapDeclAndKind.setInt(Kind); - } + void setCapturedRegionKind(CapturedRegionKind Kind); /// \brief Retrieve the record declaration for captured variables. const RecordDecl *getCapturedRecordDecl() const { return TheRecordDecl; } diff --git a/clang/include/clang/AST/TemplateName.h b/clang/include/clang/AST/TemplateName.h index f3d23b9260a..85304e9f953 100644 --- a/clang/include/clang/AST/TemplateName.h +++ b/clang/include/clang/AST/TemplateName.h @@ -207,17 +207,15 @@ public: }; TemplateName() : Storage() { } - explicit TemplateName(TemplateDecl *Template) : Storage(Template) { } - explicit TemplateName(OverloadedTemplateStorage *Storage) - : Storage(Storage) { } + explicit TemplateName(TemplateDecl *Template); + explicit TemplateName(OverloadedTemplateStorage *Storage); explicit TemplateName(SubstTemplateTemplateParmStorage *Storage); - explicit TemplateName(SubstTemplateTemplateParmPackStorage *Storage) - : Storage(Storage) { } - explicit TemplateName(QualifiedTemplateName *Qual) : Storage(Qual) { } - explicit TemplateName(DependentTemplateName *Dep) : Storage(Dep) { } + explicit TemplateName(SubstTemplateTemplateParmPackStorage *Storage); + explicit TemplateName(QualifiedTemplateName *Qual); + explicit TemplateName(DependentTemplateName *Dep); /// \brief Determine whether this template name is NULL. - bool isNull() const { return Storage.isNull(); } + bool isNull() const; // \brief Get the kind of name that is actually stored. NameKind getKind() const; @@ -238,26 +236,14 @@ public: /// name refers to, if known. If the template name does not refer to a /// specific set of function templates because it is a dependent name or /// refers to a single template, returns NULL. - OverloadedTemplateStorage *getAsOverloadedTemplate() const { - if (UncommonTemplateNameStorage *Uncommon = - Storage.dyn_cast<UncommonTemplateNameStorage *>()) - return Uncommon->getAsOverloadedStorage(); - - return nullptr; - } + OverloadedTemplateStorage *getAsOverloadedTemplate() const; /// \brief Retrieve the substituted template template parameter, if /// known. /// /// \returns The storage for the substituted template template parameter, /// if known. Otherwise, returns NULL. - SubstTemplateTemplateParmStorage *getAsSubstTemplateTemplateParm() const { - if (UncommonTemplateNameStorage *uncommon = - Storage.dyn_cast<UncommonTemplateNameStorage *>()) - return uncommon->getAsSubstTemplateTemplateParm(); - - return nullptr; - } + SubstTemplateTemplateParmStorage *getAsSubstTemplateTemplateParm() const; /// \brief Retrieve the substituted template template parameter pack, if /// known. @@ -265,25 +251,15 @@ public: /// \returns The storage for the substituted template template parameter pack, /// if known. Otherwise, returns NULL. SubstTemplateTemplateParmPackStorage * - getAsSubstTemplateTemplateParmPack() const { - if (UncommonTemplateNameStorage *Uncommon = - Storage.dyn_cast<UncommonTemplateNameStorage *>()) - return Uncommon->getAsSubstTemplateTemplateParmPack(); - - return nullptr; - } + getAsSubstTemplateTemplateParmPack() const; /// \brief Retrieve the underlying qualified template name /// structure, if any. - QualifiedTemplateName *getAsQualifiedTemplateName() const { - return Storage.dyn_cast<QualifiedTemplateName *>(); - } + QualifiedTemplateName *getAsQualifiedTemplateName() const; /// \brief Retrieve the underlying dependent template name /// structure, if any. - DependentTemplateName *getAsDependentTemplateName() const { - return Storage.dyn_cast<DependentTemplateName *>(); - } + DependentTemplateName *getAsDependentTemplateName() const; TemplateName getUnderlying() const; @@ -359,9 +335,6 @@ public: TemplateName replacement); }; -inline TemplateName::TemplateName(SubstTemplateTemplateParmStorage *Storage) - : Storage(Storage) { } - inline TemplateName TemplateName::getUnderlying() const { if (SubstTemplateTemplateParmStorage *subst = getAsSubstTemplateTemplateParm()) |