Re: r310158 - [ODRHash] Treat some non-templated classes as templated.

2017-08-07 Thread Hans Wennborg via cfe-commits
On Fri, Aug 4, 2017 at 5:54 PM, Richard Trieu via cfe-commits
 wrote:
> Author: rtrieu
> Date: Fri Aug  4 17:54:19 2017
> New Revision: 310158
>
> URL: http://llvm.org/viewvc/llvm-project?rev=310158=rev
> Log:
> [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.
>
> Modified:
> cfe/trunk/lib/AST/ODRHash.cpp

Merged to 5.0 in r310302.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r310158 - [ODRHash] Treat some non-templated classes as templated.

2017-08-04 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Fri Aug  4 17:54:19 2017
New Revision: 310158

URL: http://llvm.org/viewvc/llvm-project?rev=310158=rev
Log:
[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.

Modified:
cfe/trunk/lib/AST/ODRHash.cpp

Modified: cfe/trunk/lib/AST/ODRHash.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=310158=310157=310158=diff
==
--- cfe/trunk/lib/AST/ODRHash.cpp (original)
+++ cfe/trunk/lib/AST/ODRHash.cpp Fri Aug  4 17:54:19 2017
@@ -378,8 +378,12 @@ void ODRHash::AddCXXRecordDecl(const CXX
   assert(Record && Record->hasDefinition() &&
  "Expected non-null record to be a definition.");
 
-  if (isa(Record)) {
-return;
+  const DeclContext *DC = Record;
+  while (DC) {
+if (isa(DC)) {
+  return;
+}
+DC = DC->getParent();
   }
 
   AddDecl(Record);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits