diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-08-07 20:45:55 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-08-07 20:45:55 +0000 |
commit | 8df2b6dec1451e65ab500939da3e9bf394236a42 (patch) | |
tree | 333b88afbfc2bec1fc57f7dc7498d0b9c2856e3b | |
parent | ef9c5ea4c7fced70a44b90887b90f72e45441802 (diff) | |
download | clang-8df2b6dec1451e65ab500939da3e9bf394236a42.tar.gz |
Merging r310158:
------------------------------------------------------------------------
r310158 | rtrieu | 2017-08-04 17:54:19 -0700 (Fri, 04 Aug 2017) | 8 lines
[ODRHash] Treat some non-templated classes as templated.
When using nested classes, if the inner class is not templated, but the outer
class is templated, the inner class will not be templated, but may have some
traits as if it were. This is particularly evident if the inner class
refers to the outer class in some fashion. Treat any class that is in the
context of a templated class as also a templated class.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@310302 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ODRHash.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/AST/ODRHash.cpp b/lib/AST/ODRHash.cpp index b19135384c..121724a731 100644 --- a/lib/AST/ODRHash.cpp +++ b/lib/AST/ODRHash.cpp @@ -378,8 +378,12 @@ void ODRHash::AddCXXRecordDecl(const CXXRecordDecl *Record) { assert(Record && Record->hasDefinition() && "Expected non-null record to be a definition."); - if (isa<ClassTemplateSpecializationDecl>(Record)) { - return; + const DeclContext *DC = Record; + while (DC) { + if (isa<ClassTemplateSpecializationDecl>(DC)) { + return; + } + DC = DC->getParent(); } AddDecl(Record); |