]> granicus.if.org Git - clang/commitdiff
When computing the canonical profile of a DeclRefExpr or MemberExpr,
authorDouglas Gregor <dgregor@apple.com>
Tue, 13 Jul 2010 08:37:11 +0000 (08:37 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 13 Jul 2010 08:37:11 +0000 (08:37 +0000)
don't include the nested-name-specifier or template arguments: they
were only relevant when resolving the declaration. Fixes PR7460.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108235 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/StmtProfile.cpp
test/SemaTemplate/dependent-type-identity.cpp

index 2c6918677d0a9584f4a6f794086795c8a909a336..cff86a4e1cecea51b53f3fbb5ef34385ac951e00 100644 (file)
@@ -211,9 +211,11 @@ void StmtProfiler::VisitExpr(Expr *S) {
 
 void StmtProfiler::VisitDeclRefExpr(DeclRefExpr *S) {
   VisitExpr(S);
-  VisitNestedNameSpecifier(S->getQualifier());
+  if (!Canonical)
+    VisitNestedNameSpecifier(S->getQualifier());
   VisitDecl(S->getDecl());
-  VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
+  if (!Canonical)
+    VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());
 }
 
 void StmtProfiler::VisitPredefinedExpr(PredefinedExpr *S) {
@@ -307,7 +309,8 @@ void StmtProfiler::VisitCallExpr(CallExpr *S) {
 void StmtProfiler::VisitMemberExpr(MemberExpr *S) {
   VisitExpr(S);
   VisitDecl(S->getMemberDecl());
-  VisitNestedNameSpecifier(S->getQualifier());
+  if (!Canonical)
+    VisitNestedNameSpecifier(S->getQualifier());
   ID.AddBoolean(S->isArrow());
 }
 
index feffdcf369599ec62fda9068a42eacf175bb6287..731013c86387edc5d842b5def6d9ad3048a4342a 100644 (file)
@@ -86,3 +86,15 @@ namespace PR6851 {
   template <bool w>
   S< S<w>::cond && 1 > N::foo() { }
 }
+
+namespace PR7460 {
+  template <typename T>
+  struct TemplateClass2
+  {
+    enum { SIZE = 100 };
+    static T member[SIZE];
+  };
+
+  template <typename T>
+  T TemplateClass2<T>::member[TemplateClass2<T>::SIZE];
+}