diff options
author | Reid Kleckner <rnk@google.com> | 2018-05-31 18:42:29 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-05-31 18:42:29 +0000 |
commit | 5498e63d06e8760e5d1d73754a919f4d6d19886c (patch) | |
tree | 4417287cd610842af743e75d8dc054b50841b970 /include/clang/AST/DeclTemplate.h | |
parent | fab03239bf29b5d5c1d9ecb7ccd8547d8f4ef659 (diff) |
Fix null MSInheritanceAttr deref in CXXRecordDecl::getMSInheritanceModel()
Ensure latest MPT decl has a MSInheritanceAttr when instantiating
templates, to avoid null MSInheritanceAttr deref in
CXXRecordDecl::getMSInheritanceModel().
See PR#37399 for repo / details.
Patch by Andrew Rogers!
Differential Revision: https://reviews.llvm.org/D46664
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/DeclTemplate.h')
-rw-r--r-- | include/clang/AST/DeclTemplate.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index e15fe822bb..a2f00ec9ff 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -1720,14 +1720,8 @@ public: // it's not clear that we should override that, because the most recent // declaration as a CXXRecordDecl sometimes is the injected-class-name. ClassTemplateSpecializationDecl *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()); - Recent = Recent->getPreviousDecl(); - } - return cast<ClassTemplateSpecializationDecl>(Recent); + return cast<ClassTemplateSpecializationDecl>( + getMostRecentNonInjectedDecl()); } /// Retrieve the template that this specialization specializes. |