diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2013-11-06 22:39:46 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2013-11-06 22:39:46 +0000 |
| commit | 5116a8e7391d68a16f8854bc1dda68722e2d8f6a (patch) | |
| tree | a763ca5eb3a5d10fccc9607c05508315c78e75e1 | |
| parent | 74d31faa4eca242e3a7d419f22d4fd83ba6e0927 (diff) | |
| download | bcm5719-llvm-5116a8e7391d68a16f8854bc1dda68722e2d8f6a.tar.gz bcm5719-llvm-5116a8e7391d68a16f8854bc1dda68722e2d8f6a.zip | |
Work around an MSVC 2013 miscompile with the Redeclarable class. Fixes PR16606
llvm-svn: 194176
| -rw-r--r-- | clang/include/clang/AST/Decl.h | 12 | ||||
| -rw-r--r-- | clang/include/clang/AST/DeclCXX.h | 9 | ||||
| -rw-r--r-- | clang/include/clang/AST/DeclTemplate.h | 32 |
3 files changed, 32 insertions, 21 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index eefc15e3997..244a7b8d400 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -274,7 +274,7 @@ public: } NamedDecl *getMostRecentDecl() { - return cast<NamedDecl>(Decl::getMostRecentDecl()); + return cast<NamedDecl>(static_cast<Decl *>(this)->getMostRecentDecl()); } const NamedDecl *getMostRecentDecl() const { return const_cast<NamedDecl*>(this)->getMostRecentDecl(); @@ -2827,14 +2827,15 @@ public: } EnumDecl *getPreviousDecl() { - return cast_or_null<EnumDecl>(TagDecl::getPreviousDecl()); + return cast_or_null<EnumDecl>( + static_cast<TagDecl *>(this)->getPreviousDecl()); } const EnumDecl *getPreviousDecl() const { return const_cast<EnumDecl*>(this)->getPreviousDecl(); } EnumDecl *getMostRecentDecl() { - return cast<EnumDecl>(TagDecl::getMostRecentDecl()); + return cast<EnumDecl>(static_cast<TagDecl *>(this)->getMostRecentDecl()); } const EnumDecl *getMostRecentDecl() const { return const_cast<EnumDecl*>(this)->getMostRecentDecl(); @@ -3034,14 +3035,15 @@ public: static RecordDecl *CreateDeserialized(const ASTContext &C, unsigned ID); RecordDecl *getPreviousDecl() { - return cast_or_null<RecordDecl>(TagDecl::getPreviousDecl()); + return cast_or_null<RecordDecl>( + static_cast<TagDecl *>(this)->getPreviousDecl()); } const RecordDecl *getPreviousDecl() const { return const_cast<RecordDecl*>(this)->getPreviousDecl(); } RecordDecl *getMostRecentDecl() { - return cast<RecordDecl>(TagDecl::getMostRecentDecl()); + return cast<RecordDecl>(static_cast<TagDecl *>(this)->getMostRecentDecl()); } const RecordDecl *getMostRecentDecl() const { return const_cast<RecordDecl*>(this)->getMostRecentDecl(); diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index 4e27dbd1ff1..dbc41320bd7 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -639,14 +639,16 @@ public: } CXXRecordDecl *getPreviousDecl() { - return cast_or_null<CXXRecordDecl>(RecordDecl::getPreviousDecl()); + return cast_or_null<CXXRecordDecl>( + static_cast<RecordDecl *>(this)->getPreviousDecl()); } const CXXRecordDecl *getPreviousDecl() const { return const_cast<CXXRecordDecl*>(this)->getPreviousDecl(); } CXXRecordDecl *getMostRecentDecl() { - return cast<CXXRecordDecl>(RecordDecl::getMostRecentDecl()); + return cast<CXXRecordDecl>( + static_cast<RecordDecl *>(this)->getMostRecentDecl()); } const CXXRecordDecl *getMostRecentDecl() const { @@ -1709,7 +1711,8 @@ public: } CXXMethodDecl *getMostRecentDecl() { - return cast<CXXMethodDecl>(FunctionDecl::getMostRecentDecl()); + return cast<CXXMethodDecl>( + static_cast<FunctionDecl *>(this)->getMostRecentDecl()); } const CXXMethodDecl *getMostRecentDecl() const { return const_cast<CXXMethodDecl*>(this)->getMostRecentDecl(); diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index d2984fe42ac..24bd28a75aa 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -826,14 +826,14 @@ public: /// NULL if no such declaration exists. FunctionTemplateDecl *getPreviousDecl() { return cast_or_null<FunctionTemplateDecl>( - RedeclarableTemplateDecl::getPreviousDecl()); + static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl()); } /// \brief Retrieve the previous declaration of this function template, or /// NULL if no such declaration exists. const FunctionTemplateDecl *getPreviousDecl() const { return cast_or_null<FunctionTemplateDecl>( - RedeclarableTemplateDecl::getPreviousDecl()); + static_cast<const RedeclarableTemplateDecl *>(this)->getPreviousDecl()); } FunctionTemplateDecl *getInstantiatedFromMemberTemplate() { @@ -1449,7 +1449,8 @@ public: bool Qualified) const; ClassTemplateSpecializationDecl *getMostRecentDecl() { - CXXRecordDecl *Recent = CXXRecordDecl::getMostRecentDecl(); + CXXRecordDecl *Recent = static_cast<CXXRecordDecl *>( + this)->getMostRecentDecl(); while (!isa<ClassTemplateSpecializationDecl>(Recent)) { // FIXME: Does injected class name need to be in the redeclarations chain? assert(Recent->isInjectedClassName() && Recent->getPreviousDecl()); @@ -1691,7 +1692,8 @@ public: ClassTemplatePartialSpecializationDecl *getMostRecentDecl() { return cast<ClassTemplatePartialSpecializationDecl>( - ClassTemplateSpecializationDecl::getMostRecentDecl()); + static_cast<ClassTemplateSpecializationDecl *>( + this)->getMostRecentDecl()); } /// Get the list of template parameters @@ -1890,19 +1892,20 @@ public: /// NULL if no such declaration exists. ClassTemplateDecl *getPreviousDecl() { return cast_or_null<ClassTemplateDecl>( - RedeclarableTemplateDecl::getPreviousDecl()); + static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl()); } /// \brief Retrieve the previous declaration of this class template, or /// NULL if no such declaration exists. const ClassTemplateDecl *getPreviousDecl() const { return cast_or_null<ClassTemplateDecl>( - RedeclarableTemplateDecl::getPreviousDecl()); + static_cast<const RedeclarableTemplateDecl *>( + this)->getPreviousDecl()); } ClassTemplateDecl *getMostRecentDecl() { return cast<ClassTemplateDecl>( - RedeclarableTemplateDecl::getMostRecentDecl()); + static_cast<RedeclarableTemplateDecl *>(this)->getMostRecentDecl()); } const ClassTemplateDecl *getMostRecentDecl() const { return const_cast<ClassTemplateDecl*>(this)->getMostRecentDecl(); @@ -2132,14 +2135,15 @@ public: /// NULL if no such declaration exists. TypeAliasTemplateDecl *getPreviousDecl() { return cast_or_null<TypeAliasTemplateDecl>( - RedeclarableTemplateDecl::getPreviousDecl()); + static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl()); } /// \brief Retrieve the previous declaration of this function template, or /// NULL if no such declaration exists. const TypeAliasTemplateDecl *getPreviousDecl() const { return cast_or_null<TypeAliasTemplateDecl>( - RedeclarableTemplateDecl::getPreviousDecl()); + static_cast<const RedeclarableTemplateDecl *>( + this)->getPreviousDecl()); } TypeAliasTemplateDecl *getInstantiatedFromMemberTemplate() { @@ -2317,7 +2321,7 @@ public: bool Qualified) const; VarTemplateSpecializationDecl *getMostRecentDecl() { - VarDecl *Recent = VarDecl::getMostRecentDecl(); + VarDecl *Recent = static_cast<VarDecl *>(this)->getMostRecentDecl(); return cast<VarTemplateSpecializationDecl>(Recent); } @@ -2547,7 +2551,8 @@ public: VarTemplatePartialSpecializationDecl *getMostRecentDecl() { return cast<VarTemplatePartialSpecializationDecl>( - VarTemplateSpecializationDecl::getMostRecentDecl()); + static_cast<VarTemplateSpecializationDecl *>( + this)->getMostRecentDecl()); } /// Get the list of template parameters @@ -2730,14 +2735,15 @@ public: /// NULL if no such declaration exists. VarTemplateDecl *getPreviousDecl() { return cast_or_null<VarTemplateDecl>( - RedeclarableTemplateDecl::getPreviousDecl()); + static_cast<RedeclarableTemplateDecl *>(this)->getPreviousDecl()); } /// \brief Retrieve the previous declaration of this variable template, or /// NULL if no such declaration exists. const VarTemplateDecl *getPreviousDecl() const { return cast_or_null<VarTemplateDecl>( - RedeclarableTemplateDecl::getPreviousDecl()); + static_cast<const RedeclarableTemplateDecl *>( + this)->getPreviousDecl()); } VarTemplateDecl *getInstantiatedFromMemberTemplate() { |

