[cfe-commits] r108235 - in /cfe/trunk: lib/AST/StmtProfile.cpp test/SemaTemplate/dependent-type-identity.cpp
Douglas Gregor
dgregor at apple.com
Tue Jul 13 01:37:11 PDT 2010
Author: dgregor
Date: Tue Jul 13 03:37:11 2010
New Revision: 108235
URL: http://llvm.org/viewvc/llvm-project?rev=108235&view=rev
Log:
When computing the canonical profile of a DeclRefExpr or MemberExpr,
don't include the nested-name-specifier or template arguments: they
were only relevant when resolving the declaration. Fixes PR7460.
Modified:
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp
Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=108235&r1=108234&r2=108235&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Tue Jul 13 03:37:11 2010
@@ -211,9 +211,11 @@
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::VisitMemberExpr(MemberExpr *S) {
VisitExpr(S);
VisitDecl(S->getMemberDecl());
- VisitNestedNameSpecifier(S->getQualifier());
+ if (!Canonical)
+ VisitNestedNameSpecifier(S->getQualifier());
ID.AddBoolean(S->isArrow());
}
Modified: cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp?rev=108235&r1=108234&r2=108235&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp (original)
+++ cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp Tue Jul 13 03:37:11 2010
@@ -86,3 +86,15 @@
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];
+}
More information about the cfe-commits
mailing list