diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-07-28 15:32:17 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-07-28 15:32:17 +0000 |
| commit | d9aedfaa5a25e1ebd093bdc6764e054b09a4151f (patch) | |
| tree | 2571fe37ae02d14c50985e78163eeae18aff8fce | |
| parent | 4488259d404d2edcc494ac6e0259a93d1de43df7 (diff) | |
| download | bcm5719-llvm-d9aedfaa5a25e1ebd093bdc6764e054b09a4151f.tar.gz bcm5719-llvm-d9aedfaa5a25e1ebd093bdc6764e054b09a4151f.zip | |
Profiling the pointer of a canonical type is sufficient to uniquely identify the type
llvm-svn: 77321
| -rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index fe8d1b716bc..af2b934125d 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -272,21 +272,6 @@ void StmtProfiler::VisitCompoundLiteralExpr(CompoundLiteralExpr *S) { 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 @@ void StmtProfiler::VisitObjCIsaExpr(ObjCIsaExpr *S) { 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()); } |

