summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ODRHash.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2017-08-05 00:54:19 +0000
committerRichard Trieu <rtrieu@google.com>2017-08-05 00:54:19 +0000
commit5fb82efebf66400f40f5e4745f64537ee7a66c74 (patch)
tree4eda2675556641ba5c2463e7f8dd96637e4e0155 /clang/lib/AST/ODRHash.cpp
parentc099010ed7f7e25e743d3e8c5a081f063b570f8e (diff)
downloadbcm5719-llvm-5fb82efebf66400f40f5e4745f64537ee7a66c74.tar.gz
bcm5719-llvm-5fb82efebf66400f40f5e4745f64537ee7a66c74.zip
[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. llvm-svn: 310158
Diffstat (limited to 'clang/lib/AST/ODRHash.cpp')
-rw-r--r--clang/lib/AST/ODRHash.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index b19135384cf..121724a7315 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud