diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-02-17 08:47:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-02-17 08:47:29 +0000 |
commit | 4c3e0ee8e6208eb42c4adb78a7d35b641fd85ae9 (patch) | |
tree | d22914af2d81f16a59bd50e0d5166bcd1d934db2 /lib/AST/DeclBase.cpp | |
parent | 543cb655b174087f6c2d22009934c9fed6c32114 (diff) |
Devirtualize Decl::getNextRedeclaration().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125740 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r-- | lib/AST/DeclBase.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 5a117ebbf2..437089a415 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -191,6 +191,78 @@ Decl *Decl::getCanonicalDecl() { 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 //===----------------------------------------------------------------------===// |