/// specializations are printed with their template arguments.
///
/// TODO: use an API that doesn't require so many temporary strings
- void getNameForDiagnostic(std::string &S,
- const PrintingPolicy &Policy,
- bool Qualified) const;
+ virtual void getNameForDiagnostic(std::string &S,
+ const PrintingPolicy &Policy,
+ bool Qualified) const {
+ if (Qualified)
+ S += getQualifiedNameAsString(Policy);
+ else
+ S += getNameAsString();
+ }
/// declarationReplaces - Determine whether this declaration, if
/// known to be well-formed within its context, will replace the
getOriginalNamespace()->OrigOrAnonNamespace.setPointer(D);
}
- NamespaceDecl *getCanonicalDecl() { return getOriginalNamespace(); }
+ virtual NamespaceDecl *getCanonicalDecl() { return getOriginalNamespace(); }
const NamespaceDecl *getCanonicalDecl() const {
return getOriginalNamespace();
}
- SourceRange getSourceRange() const {
+ virtual SourceRange getSourceRange() const {
return SourceRange(getLocation(), RBracLoc);
}
/// getInnerLocStart - Return SourceLocation representing start of source
/// range ignoring outer template declarations.
- SourceLocation getInnerLocStart() const;
+ virtual SourceLocation getInnerLocStart() const { return getLocation(); }
/// getOuterLocStart - Return SourceLocation representing start of source
/// range taking into account any outer template declarations.
}
typedef Redeclarable<VarDecl> redeclarable_base;
- VarDecl *getNextRedeclaration() { return RedeclLink.getNext(); }
- friend class Decl;
-
+ virtual VarDecl *getNextRedeclaration() { return RedeclLink.getNext(); }
+
public:
typedef redeclarable_base::redecl_iterator redecl_iterator;
redecl_iterator redecls_begin() const {
QualType T, TypeSourceInfo *TInfo, StorageClass S,
StorageClass SCAsWritten);
- SourceRange getSourceRange() const;
+ virtual SourceLocation getInnerLocStart() const;
+ virtual SourceRange getSourceRange() const;
StorageClass getStorageClass() const { return (StorageClass)SClass; }
StorageClass getStorageClassAsWritten() const {
return getKind() != Decl::ParmVar && getDeclContext()->isRecord();
}
- VarDecl *getCanonicalDecl();
+ virtual VarDecl *getCanonicalDecl();
const VarDecl *getCanonicalDecl() const {
return const_cast<VarDecl*>(this)->getCanonicalDecl();
}
/// \brief Determine whether this is or was instantiated from an out-of-line
/// definition of a static data member.
- bool isOutOfLine() const;
+ virtual bool isOutOfLine() const;
/// \brief If this is a static data member, find its out-of-line definition.
VarDecl *getOutOfLineDefinition();
DNLoc(NameInfo.getInfo()) {}
typedef Redeclarable<FunctionDecl> redeclarable_base;
- FunctionDecl *getNextRedeclaration() { return RedeclLink.getNext(); }
+ virtual FunctionDecl *getNextRedeclaration() { return RedeclLink.getNext(); }
- friend class Decl;
-
public:
-
typedef redeclarable_base::redecl_iterator redecl_iterator;
redecl_iterator redecls_begin() const {
return redeclarable_base::redecls_begin();
return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc);
}
- SourceRange getSourceRange() const {
+ virtual void getNameForDiagnostic(std::string &S,
+ const PrintingPolicy &Policy,
+ bool Qualified) const;
+
+ virtual SourceRange getSourceRange() const {
return SourceRange(getOuterLocStart(), EndRangeLoc);
}
void setLocEnd(SourceLocation E) {
/// containing the body (if there is one).
bool hasBody(const FunctionDecl *&Definition) const;
- bool hasBody() const {
+ virtual bool hasBody() const {
const FunctionDecl* Definition;
return hasBody(Definition);
}
/// unnecessary AST de-serialization of the body.
Stmt *getBody(const FunctionDecl *&Definition) const;
- Stmt *getBody() const {
+ virtual Stmt *getBody() const {
const FunctionDecl* Definition;
return getBody(Definition);
}
void setPreviousDeclaration(FunctionDecl * PrevDecl);
- const FunctionDecl *getCanonicalDecl() const;
- FunctionDecl *getCanonicalDecl();
+ virtual const FunctionDecl *getCanonicalDecl() const;
+ virtual FunctionDecl *getCanonicalDecl();
unsigned getBuiltinID() const;
/// \brief Determine whether this is or was instantiated from an out-of-line
/// definition of a member function.
- bool isOutOfLine() const;
+ virtual bool isOutOfLine() const;
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
protected:
typedef Redeclarable<TypedefDecl> redeclarable_base;
- TypedefDecl *getNextRedeclaration() { return RedeclLink.getNext(); }
+ virtual TypedefDecl *getNextRedeclaration() { return RedeclLink.getNext(); }
- friend class Decl;
-
public:
typedef redeclarable_base::redecl_iterator redecl_iterator;
redecl_iterator redecls_begin() const {
}
typedef Redeclarable<TagDecl> redeclarable_base;
- TagDecl *getNextRedeclaration() { return RedeclLink.getNext(); }
+ virtual TagDecl *getNextRedeclaration() { return RedeclLink.getNext(); }
/// @brief Completes the definition of this tag declaration.
///
/// This is a helper function for derived classes.
void completeDefinition();
-
- friend class Decl;
public:
typedef redeclarable_base::redecl_iterator redecl_iterator;
/// getInnerLocStart - Return SourceLocation representing start of source
/// range ignoring outer template declarations.
- SourceLocation getInnerLocStart() const;
+ virtual SourceLocation getInnerLocStart() const { return TagKeywordLoc; }
/// getOuterLocStart - Return SourceLocation representing start of source
/// range taking into account any outer template declarations.
SourceLocation getOuterLocStart() const;
- SourceRange getSourceRange() const;
+ virtual SourceRange getSourceRange() const;
- TagDecl* getCanonicalDecl();
+ virtual TagDecl* getCanonicalDecl();
const TagDecl* getCanonicalDecl() const {
return const_cast<TagDecl*>(this)->getCanonicalDecl();
}
return field_begin() == field_end();
}
- /// \brief Indicates that the definition of this class is now complete.
- void completeDefinition();
+ /// completeDefinition - Notes that the definition of this type is
+ /// now complete.
+ virtual void completeDefinition();
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const RecordDecl *D) { return true; }
const Capture *end,
bool capturesCXXThis);
- SourceRange getSourceRange() const;
+ virtual SourceRange getSourceRange() const;
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
if (Decl::CollectingStats()) add(DK);
}
+ virtual ~Decl();
+
public:
/// \brief Source range that this declaration covers.
- SourceRange getSourceRange() const;
+ virtual SourceRange getSourceRange() const {
+ return SourceRange(getLocation(), getLocation());
+ }
SourceLocation getLocStart() const { return getSourceRange().getBegin(); }
SourceLocation getLocEnd() const { return getSourceRange().getEnd(); }
return const_cast<Decl*>(this)->getLexicalDeclContext();
}
- /// \brief Determine whether this declaration was written out-of-line, which
- /// typically indicates that it was written with a qualified name in a scope
- /// outside of its semantic scope.
- bool isOutOfLine() const;
+ virtual bool isOutOfLine() const {
+ return getLexicalDeclContext() != getDeclContext();
+ }
/// setDeclContext - Set both the semantic and lexical DeclContext
/// to DC.
bool isDefinedOutsideFunctionOrMethod() const;
/// \brief Retrieves the "canonical" declaration of the given declaration.
- Decl *getCanonicalDecl();
+ virtual Decl *getCanonicalDecl() { return this; }
const Decl *getCanonicalDecl() const {
return const_cast<Decl*>(this)->getCanonicalDecl();
}
///
/// Decl subclasses that can be redeclared should override this method so that
/// Decl::redecl_iterator can iterate over them.
- Decl *getNextRedeclaration();
+ virtual Decl *getNextRedeclaration() { return this; }
public:
/// \brief Iterates through all the redeclarations of the same decl.
/// getBody - If this Decl represents a declaration for a body of code,
/// such as a function or method definition, this method returns the
/// top-level Stmt* of that body. Otherwise this method returns null.
- Stmt* getBody() const;
+ virtual Stmt* getBody() const { return 0; }
/// \brief Returns true if this Decl represents a declaration for a body of
/// code, such as a function or method definition.
- bool hasBody() const;
+ virtual bool hasBody() const { return getBody() != 0; }
/// getBodyRBrace - Gets the right brace of the body, if a body exists.
/// This works whether the body is a CompoundStmt or a CXXTryStmt.
void markedVirtualFunctionPure();
friend void FunctionDecl::setPure(bool);
- void completeDefinitionImpl(CXXFinalOverriderMap *FinalOverriders);
- friend class RecordDecl;
-
protected:
CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
typedef std::reverse_iterator<base_class_const_iterator>
reverse_base_class_const_iterator;
- CXXRecordDecl *getCanonicalDecl() {
+ virtual CXXRecordDecl *getCanonicalDecl() {
return cast<CXXRecordDecl>(RecordDecl::getCanonicalDecl());
}
- const CXXRecordDecl *getCanonicalDecl() const {
+ virtual const CXXRecordDecl *getCanonicalDecl() const {
return cast<CXXRecordDecl>(RecordDecl::getCanonicalDecl());
}
return (PathAccess > DeclAccess ? PathAccess : DeclAccess);
}
+ /// \brief Indicates that the definition of this class is now complete.
+ virtual void completeDefinition();
+
/// \brief Indicates that the definition of this class is now complete,
/// and provides a final overrider map to help determine
///
SourceLocation IdentLoc,
NamedDecl *Namespace);
- SourceRange getSourceRange() const {
+ virtual SourceRange getSourceRange() const {
return SourceRange(NamespaceLoc, IdentLoc);
}
/// \brief A definition will return its interface declaration.
/// An interface declaration will return its definition.
/// Otherwise it will return itself.
- ObjCMethodDecl *getNextRedeclaration();
- friend class Decl;
-
+ virtual ObjCMethodDecl *getNextRedeclaration();
+
public:
static ObjCMethodDecl *Create(ASTContext &C,
SourceLocation beginLoc,
ImplementationControl impControl = None,
unsigned numSelectorArgs = 0);
- ObjCMethodDecl *getCanonicalDecl();
+ virtual ObjCMethodDecl *getCanonicalDecl();
const ObjCMethodDecl *getCanonicalDecl() const {
return const_cast<ObjCMethodDecl*>(this)->getCanonicalDecl();
}
SourceLocation getLocStart() const { return getLocation(); }
SourceLocation getLocEnd() const { return EndLoc; }
void setEndLoc(SourceLocation Loc) { EndLoc = Loc; }
- SourceRange getSourceRange() const {
+ virtual SourceRange getSourceRange() const {
return SourceRange(getLocation(), EndLoc);
}
return ImplementationControl(DeclImplementation);
}
- Stmt *getBody() const {
+ virtual Stmt *getBody() const {
return (Stmt*) Body;
}
CompoundStmt *getCompoundBody() { return (CompoundStmt*)Body; }
AtEnd = atEnd;
}
- SourceRange getSourceRange() const {
+ virtual SourceRange getSourceRange() const {
return SourceRange(getLocation(), getAtEndRange().getEnd());
}
const SourceLocation *Locs = 0,
unsigned nElts = 0);
- SourceRange getSourceRange() const;
+ virtual SourceRange getSourceRange() const;
typedef const ObjCClassRef* iterator;
iterator begin() const { return ForwardDecls; }
SourceLocation getCategoryNameLoc() const { return CategoryNameLoc; }
void setCategoryNameLoc(SourceLocation Loc) { CategoryNameLoc = Loc; }
- SourceRange getSourceRange() const {
+ virtual SourceRange getSourceRange() const {
return SourceRange(AtLoc, getAtEndRange().getEnd());
}
return PropertyIvarDecl;
}
- SourceRange getSourceRange() const {
+ virtual SourceRange getSourceRange() const {
return SourceRange(AtLoc, getLocation());
}
ObjCIvarDecl *ivarDecl,
SourceLocation ivarLoc);
- SourceRange getSourceRange() const;
+ virtual SourceRange getSourceRange() const;
SourceLocation getLocStart() const { return AtLoc; }
void setAtLoc(SourceLocation Loc) { AtLoc = Loc; }
/// for the common pointer.
CommonBase *getCommonPtr();
- CommonBase *newCommon(ASTContext &C);
+ virtual CommonBase *newCommon(ASTContext &C) = 0;
// Construct a template decl with name, parameters, and templated element.
RedeclarableTemplateDecl(Kind DK, DeclContext *DC, SourceLocation L,
return getInstantiatedFromMemberTemplateImpl();
}
- RedeclarableTemplateDecl *getNextRedeclaration();
+ virtual RedeclarableTemplateDecl *getNextRedeclaration();
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
}
friend class FunctionDecl;
- friend class RedeclarableTemplateDecl;
-
+
/// \brief Retrieve the set of function template specializations of this
/// function template.
llvm::FoldingSet<FunctionTemplateSpecializationInfo> &getSpecializations() {
using TemplateParmPosition::setPosition;
using TemplateParmPosition::getIndex;
+ SourceLocation getInnerLocStart() const;
SourceRange getSourceRange() const;
/// \brief Determine whether this template parameter has a default
static ClassTemplateSpecializationDecl *
Create(ASTContext &Context, EmptyShell Empty);
+ virtual void getNameForDiagnostic(std::string &S,
+ const PrintingPolicy &Policy,
+ bool Qualified) const;
+
ClassTemplateSpecializationDecl *getMostRecentDeclaration() {
CXXRecordDecl *Recent
= cast<CXXRecordDecl>(CXXRecordDecl::getMostRecentDeclaration());
return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc : SourceLocation();
}
+ SourceLocation getInnerLocStart() const { return getTemplateKeywordLoc(); }
+
void Profile(llvm::FoldingSetNodeID &ID) const {
Profile(ID, TemplateArgs->data(), TemplateArgs->size(), getASTContext());
}
return static_cast<Common *>(RedeclarableTemplateDecl::getCommonPtr());
}
- friend class RedeclarableTemplateDecl;
-
public:
/// Get the underlying class declarations of the template.
CXXRecordDecl *getTemplatedDecl() const {
}
}
-void NamedDecl::getNameForDiagnostic(std::string &S,
- const PrintingPolicy &Policy,
- bool Qualified) const {
- if (Qualified)
- S += getQualifiedNameAsString(Policy);
- else
- S += getNameAsString();
-
- const TemplateArgumentList *TemplateArgs = 0;
-
- if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(this))
- TemplateArgs = FD->getTemplateSpecializationArgs();
- else if (const ClassTemplateSpecializationDecl *Spec
- = dyn_cast<ClassTemplateSpecializationDecl>(this))
- TemplateArgs = &Spec->getTemplateArgs();
-
-
- if (TemplateArgs)
- S += TemplateSpecializationType::PrintTemplateArgumentList(
- TemplateArgs->data(),
- TemplateArgs->size(),
- Policy);
-}
-
void NamedDecl::ClearLinkageCache() {
// Note that we can't skip clearing the linkage of children just
// because the parent doesn't have cached linkage: we don't cache
}
}
-SourceLocation DeclaratorDecl::getInnerLocStart() const {
- if (const VarDecl *Var = dyn_cast<VarDecl>(this)) {
- SourceLocation Start = Var->getTypeSpecStartLoc();
- if (Start.isValid())
- return Start;
- } else if (const NonTypeTemplateParmDecl *NTTP
- = dyn_cast<NonTypeTemplateParmDecl>(this)) {
- SourceLocation Start = NTTP->getTypeSpecStartLoc();
- if (Start.isValid())
- return Start;
- }
- return getLocation();
-}
-
SourceLocation DeclaratorDecl::getOuterLocStart() const {
return getTemplateOrInnerLocStart(this);
}
SClass = SC;
}
+SourceLocation VarDecl::getInnerLocStart() const {
+ SourceLocation Start = getTypeSpecStartLoc();
+ if (Start.isInvalid())
+ Start = getLocation();
+ return Start;
+}
+
SourceRange VarDecl::getSourceRange() const {
if (getInit())
return SourceRange(getOuterLocStart(), getInit()->getLocEnd());
}
bool VarDecl::isOutOfLine() const {
- if (getLexicalDeclContext() != getDeclContext())
+ if (Decl::isOutOfLine())
return true;
if (!isStaticDataMember())
// FunctionDecl Implementation
//===----------------------------------------------------------------------===//
+void FunctionDecl::getNameForDiagnostic(std::string &S,
+ const PrintingPolicy &Policy,
+ bool Qualified) const {
+ NamedDecl::getNameForDiagnostic(S, Policy, Qualified);
+ const TemplateArgumentList *TemplateArgs = getTemplateSpecializationArgs();
+ if (TemplateArgs)
+ S += TemplateSpecializationType::PrintTemplateArgumentList(
+ TemplateArgs->data(),
+ TemplateArgs->size(),
+ Policy);
+
+}
+
bool FunctionDecl::isVariadic() const {
if (const FunctionProtoType *FT = getType()->getAs<FunctionProtoType>())
return FT->isVariadic();
}
bool FunctionDecl::isOutOfLine() const {
- if (getLexicalDeclContext() != getDeclContext())
+ if (Decl::isOutOfLine())
return true;
// If this function was instantiated from a member function of a
// TagDecl Implementation
//===----------------------------------------------------------------------===//
-SourceLocation TagDecl::getInnerLocStart() const {
- if (const ClassTemplateSpecializationDecl *Spec
- = dyn_cast<ClassTemplateSpecializationDecl>(this)) {
- SourceLocation Start = Spec->getTemplateKeywordLoc();
- if (Start.isValid())
- return Start;
- }
-
- return getTagKeywordLoc();
-}
-
SourceLocation TagDecl::getOuterLocStart() const {
return getTemplateOrInnerLocStart(this);
}
return field_iterator(decl_iterator(FirstDecl));
}
+/// completeDefinition - Notes that the definition of this type is now
+/// complete.
+void RecordDecl::completeDefinition() {
+ assert(!isDefinition() && "Cannot redefine record!");
+ TagDecl::completeDefinition();
+}
+
void RecordDecl::LoadFieldsFromExternalStorage() const {
ExternalASTSource *Source = getASTContext().getExternalSource();
assert(hasExternalLexicalStorage() && Source && "No external storage?");
llvm::tie(FirstDecl, LastDecl) = BuildDeclChain(Decls);
}
-void RecordDecl::completeDefinition() {
- assert(!isDefinition() && "Cannot redefine record!");
- TagDecl::completeDefinition();
- if (CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(this))
- CXXRecord->completeDefinitionImpl(0);
-}
-
//===----------------------------------------------------------------------===//
// BlockDecl Implementation
//===----------------------------------------------------------------------===//
static bool StatSwitch = false;
-namespace {
- template<typename Class>
- inline SourceRange getSourceRangeImpl(const Decl *D,
- SourceRange (Class::*)() const) {
- return static_cast<const Class *>(D)->getSourceRange();
- }
-
- inline SourceRange getSourceRangeImpl(const Decl *D,
- SourceRange (Decl::*)() const) {
- return D->getLocation();
- }
-}
-
-SourceRange Decl::getSourceRange() const {
- switch (getKind()) {
-#define ABSTRACT_DECL(Type)
-#define DECL(Type, Base) \
- case Type: return getSourceRangeImpl(this, &Type##Decl::getSourceRange);
-#include "clang/AST/DeclNodes.inc"
- }
-
- return getLocation();
-}
-
const char *Decl::getDeclKindName() const {
switch (DeclKind) {
default: assert(0 && "Declaration not in DeclNodes.inc!");
return true;
}
-namespace {
- template<typename Class, typename Result>
- inline Result *getCanonicalDeclImpl(Decl *D, Result *(Class::*)()) {
- return static_cast<Class *>(D)->getCanonicalDecl();
- }
-
- inline Decl *getCanonicalDeclImpl(Decl *D, Decl *(Decl::*)()) {
- // No specific implementation.
- return D;
- }
-}
-
-Decl *Decl::getCanonicalDecl() {
- switch (getKind()) {
-#define ABSTRACT_DECL(Type)
-#define DECL(Type, Base) \
- case Type: \
- return getCanonicalDeclImpl(this, &Type##Decl::getCanonicalDecl);
-#include "clang/AST/DeclNodes.inc"
- }
-
- return this;
-}
-
-Decl *Decl::getNextRedeclaration() {
- switch (getKind()) {
- case Var:
- return static_cast<VarDecl *>(this)->getNextRedeclaration();
-
- case Function:
- case CXXMethod:
- case CXXConstructor:
- case CXXDestructor:
- case CXXConversion:
- return static_cast<FunctionDecl *>(this)->getNextRedeclaration();
-
- case Typedef:
- return static_cast<TypedefDecl *>(this)->getNextRedeclaration();
-
- case Enum:
- case Record:
- case CXXRecord:
- case ClassTemplateSpecialization:
- case ClassTemplatePartialSpecialization:
- return static_cast<TagDecl *>(this)->getNextRedeclaration();
-
- case ObjCMethod:
- return static_cast<ObjCMethodDecl *>(this)->getNextRedeclaration();
-
- case FunctionTemplate:
- case ClassTemplate:
- return static_cast<RedeclarableTemplateDecl *>(this)
- ->getNextRedeclaration();
-
- case Namespace:
- case UsingDirective:
- case NamespaceAlias:
- case Label:
- case UnresolvedUsingTypename:
- case TemplateTypeParm:
- case EnumConstant:
- case UnresolvedUsingValue:
- case IndirectField:
- case Field:
- case ObjCIvar:
- case ObjCAtDefsField:
- case ImplicitParam:
- case ParmVar:
- case NonTypeTemplateParm:
- case TemplateTemplateParm:
- case Using:
- case UsingShadow:
- case ObjCCategory:
- case ObjCProtocol:
- case ObjCInterface:
- case ObjCCategoryImpl:
- case ObjCImplementation:
- case ObjCProperty:
- case ObjCCompatibleAlias:
- case LinkageSpec:
- case ObjCPropertyImpl:
- case ObjCForwardProtocol:
- case ObjCClass:
- case FileScopeAsm:
- case AccessSpec:
- case Friend:
- case FriendTemplate:
- case StaticAssert:
- case Block:
- case TranslationUnit:
- return this;
- }
-
- return this;
-}
//===----------------------------------------------------------------------===//
// PrettyStackTraceDecl Implementation
// Decl Implementation
//===----------------------------------------------------------------------===//
-bool Decl::isOutOfLine() const {
- if (const VarDecl *VD = dyn_cast<VarDecl>(this))
- return VD->isOutOfLine();
- if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(this))
- return FD->isOutOfLine();
-
- return getLexicalDeclContext() != getDeclContext();
-}
+// Out-of-line virtual method providing a home for Decl.
+Decl::~Decl() { }
void Decl::setDeclContext(DeclContext *DC) {
if (isOutOfSemaDC())
}
}
-Stmt *Decl::getBody() const {
- if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(this))
- return FD->getBody();
- if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(this))
- return MD->getBody();
- if (const BlockDecl *BD = dyn_cast<BlockDecl>(this))
- return BD->getBody();
-
- return 0;
-}
-
-bool Decl::hasBody() const {
- if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(this))
- return FD->hasBody();
-
- return getBody() != 0;
-}
-
SourceLocation Decl::getBodyRBrace() const {
// Special handling of FunctionDecl to avoid de-serializing the body from PCH.
// FunctionDecl stores EndRangeLoc for this purpose.
return Dtor;
}
-void
-CXXRecordDecl::completeDefinitionImpl(CXXFinalOverriderMap *FinalOverriders) {
+void CXXRecordDecl::completeDefinition() {
+ completeDefinition(0);
+}
+
+void CXXRecordDecl::completeDefinition(CXXFinalOverriderMap *FinalOverriders) {
+ RecordDecl::completeDefinition();
+
// If the class may be abstract (but hasn't been marked as such), check for
// any pure final overriders.
if (mayBeAbstract()) {
data().Conversions.setAccess(I, (*I)->getAccess());
}
-void
-CXXRecordDecl::completeDefinition(CXXFinalOverriderMap *FinalOverriders) {
- TagDecl::completeDefinition();
- completeDefinitionImpl(FinalOverriders);
-}
-
bool CXXRecordDecl::mayBeAbstract() const {
if (data().Abstract || isInvalidDecl() || !data().Polymorphic ||
isDependentContext())
}
-RedeclarableTemplateDecl::CommonBase *
-RedeclarableTemplateDecl::newCommon(ASTContext &C) {
- if (FunctionTemplateDecl *FunTmpl = dyn_cast<FunctionTemplateDecl>(this))
- return FunTmpl->newCommon(C);
-
- return cast<ClassTemplateDecl>(this)->newCommon(C);
-}
-
RedeclarableTemplateDecl *RedeclarableTemplateDecl::getCanonicalDeclImpl() {
RedeclarableTemplateDecl *Tmpl = this;
while (Tmpl->getPreviousDeclaration())
ExpandedTInfos);
}
+SourceLocation NonTypeTemplateParmDecl::getInnerLocStart() const {
+ SourceLocation Start = getTypeSpecStartLoc();
+ if (Start.isInvalid())
+ Start = getLocation();
+ return Start;
+}
+
SourceRange NonTypeTemplateParmDecl::getSourceRange() const {
return SourceRange(getOuterLocStart(), getLocation());
}
new (Context)ClassTemplateSpecializationDecl(ClassTemplateSpecialization);
}
+void
+ClassTemplateSpecializationDecl::getNameForDiagnostic(std::string &S,
+ const PrintingPolicy &Policy,
+ bool Qualified) const {
+ NamedDecl::getNameForDiagnostic(S, Policy, Qualified);
+
+ const TemplateArgumentList &TemplateArgs = getTemplateArgs();
+ S += TemplateSpecializationType::PrintTemplateArgumentList(
+ TemplateArgs.data(),
+ TemplateArgs.size(),
+ Policy);
+}
+
ClassTemplateDecl *
ClassTemplateSpecializationDecl::getSpecializedTemplate() const {
if (SpecializedPartialSpecialization *PartialSpec