[cfe-commits] r77321 - /cfe/trunk/lib/AST/StmtProfile.cpp
Douglas Gregor
dgregor at apple.com
Tue Jul 28 08:32:17 PDT 2009
Author: dgregor
Date: Tue Jul 28 10:32:17 2009
New Revision: 77321
URL: http://llvm.org/viewvc/llvm-project?rev=77321&view=rev
Log:
Profiling the pointer of a canonical type is sufficient to uniquely identify the type
Modified:
cfe/trunk/lib/AST/StmtProfile.cpp
Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=77321&r1=77320&r2=77321&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Tue Jul 28 10:32:17 2009
@@ -272,21 +272,6 @@
ID.AddBoolean(S->isFileScope());
}
-void StmtProfiler::VisitDecl(Decl *D) {
- if (Canonical) {
- if (NonTypeTemplateParmDecl *NTTP
- = dyn_cast_or_null<NonTypeTemplateParmDecl>(D)) {
- ID.AddInteger(NTTP->getDepth());
- ID.AddInteger(NTTP->getIndex());
- return;
- }
-
- // FIXME: Other template template parameters?
- }
-
- ID.AddPointer(D? D->getCanonicalDecl() : 0);
-}
-
void StmtProfiler::VisitCastExpr(CastExpr *S) {
VisitExpr(S);
}
@@ -604,17 +589,25 @@
ID.AddBoolean(S->isArrow());
}
-void StmtProfiler::VisitType(QualType T) {
+void StmtProfiler::VisitDecl(Decl *D) {
if (Canonical) {
- if (const TemplateTypeParmType *TTP = T->getAs<TemplateTypeParmType>()) {
- ID.AddInteger(TTP->getDepth());
- ID.AddInteger(TTP->getIndex());
+ if (NonTypeTemplateParmDecl *NTTP
+ = dyn_cast_or_null<NonTypeTemplateParmDecl>(D)) {
+ ID.AddInteger(NTTP->getDepth());
+ ID.AddInteger(NTTP->getIndex());
return;
}
- T = Context.getCanonicalType(T);
+ // FIXME: Template template parameters?
}
+ ID.AddPointer(D? D->getCanonicalDecl() : 0);
+}
+
+void StmtProfiler::VisitType(QualType T) {
+ if (Canonical)
+ T = Context.getCanonicalType(T);
+
ID.AddPointer(T.getAsOpaquePtr());
}
More information about the cfe-commits
mailing list