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.

llvm-svn: 108235
This commit is contained in:
Douglas Gregor 2010-07-13 08:37:11 +00:00
parent 603d81bf8d
commit f5b160f89c
2 changed files with 18 additions and 3 deletions

View 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());
}

View 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];
}