diff options
| author | Craig Silverstein <csilvers2000@yahoo.com> | 2010-06-28 23:42:10 +0000 |
|---|---|---|
| committer | Craig Silverstein <csilvers2000@yahoo.com> | 2010-06-28 23:42:10 +0000 |
| commit | a37aa88e62db7f67dad8f81725c4b9abaeb2f1c6 (patch) | |
| tree | c026b490ed0930e457cd2aa0c58290bc18a8b6dc /clang | |
| parent | 269a89fd3af2e7332e99e8aae695633bd98c3ab8 (diff) | |
| download | bcm5719-llvm-a37aa88e62db7f67dad8f81725c4b9abaeb2f1c6.tar.gz bcm5719-llvm-a37aa88e62db7f67dad8f81725c4b9abaeb2f1c6.zip | |
Fix up ClassTemplateSpecializationDecl: For implicit instantiations
("set<int> x;"), we don't want to recurse at all, since the
instatiated class isn't written in the source code anywhere. (Note
the instatiated *type* -- set<int> -- is written, and will still get a
callback of TemplateSpecializationType). For explicit instantiations
("template set<int>;"), we do need a callback, since this is the only
callback that's made for this instantiation. We use
getTypeAsWritten() to distinguish.
We will still need to figure out how to handle template
specializations, which probably are still not quite correct.
Reviewed by chandlerc
llvm-svn: 107098
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/AST/RecursiveASTVisitor.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index 8512ccda281..7a2a044c5f6 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -890,16 +890,19 @@ DEF_TRAVERSE_DECL(CXXRecordDecl, { }) DEF_TRAVERSE_DECL(ClassTemplateSpecializationDecl, { - // FIXME: we probably want to traverse the TemplateArgumentLoc for - // explicitly-written specializations and instantiations, rather - // than the computed template arguments. - const TemplateArgumentList &TAL = D->getTemplateArgs(); - for (unsigned I = 0; I < TAL.size(); ++I) { - TRY_TO(TraverseTemplateArgument(TAL.get(I))); - } - // FIXME: I think we only want to traverse this if it's an explicit - // specialization. - TRY_TO(TraverseCXXRecordHelper(D)); + // For implicit instantiations ("set<int> x;"), we don't want to + // recurse at all, since the instatiated class isn't written in + // the source code anywhere. (Note the instatiated *type* -- + // set<int> -- is written, and will still get a callback of + // TemplateSpecializationType). For explicit instantiations + // ("template set<int>;"), we do need a callback, since this + // is the only callback that's made for this instantiation. + // We use getTypeAsWritten() to distinguish. + // FIXME: see how we want to handle template specializations. + TypeSourceInfo* TSI = D->getTypeAsWritten(); + if (TSI) + TRY_TO(TraverseType(TSI->getType())); + return true; }) template <typename Derived> |

