Thanks for the help tracking down the problem. I've committed a fixed test case at r136385. The test now does two FileCheck's to find the instantiations and will not be order dependent. Let me know if any more problems crop up.
On Thu, Jul 28, 2011 at 6:59 AM, Douglas Gregor <[email protected]> wrote: > > On Jul 27, 2011, at 5:19 PM, Richard Trieu wrote: > > > Author: rtrieu > > Date: Wed Jul 27 19:19:05 2011 > > New Revision: 136306 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=136306&view=rev > > Log: > > Add template instantiations to the output of -ast-dump. > > > > Added: > > cfe/trunk/test/Misc/ast-dump-templates.cpp > > Modified: > > cfe/trunk/include/clang/AST/DeclBase.h > > cfe/trunk/lib/AST/DeclPrinter.cpp > > cfe/trunk/lib/Frontend/ASTConsumers.cpp > > > > > > +void DeclPrinter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) { > > + if (PrintInstantiation) { > > + TemplateParameterList *Params = D->getTemplateParameters(); > > + for (FunctionTemplateDecl::spec_iterator I = D->spec_begin(), E = > D->spec_end(); > > + I != E; ++I) { > > + PrintTemplateParameters(Params, > (*I)->getTemplateSpecializationArgs()); > > + Visit(*I); > > + } > > + } > > + > > + return VisitRedeclarableTemplateDecl(D); > > +} > > + > > +void DeclPrinter::VisitClassTemplateDecl(ClassTemplateDecl *D) { > > + if (PrintInstantiation) { > > + TemplateParameterList *Params = D->getTemplateParameters(); > > + for (ClassTemplateDecl::spec_iterator I = D->spec_begin(), E = > D->spec_end(); > > + I != E; ++I) { > > + PrintTemplateParameters(Params, &(*I)->getTemplateArgs()); > > + Visit(*I); > > + Out << '\n'; > > + } > > + } > > + > > + return VisitRedeclarableTemplateDecl(D); > > +} > > + > > This is the reason for the instability in tests: spec_begin()/spec_end() > iterators over a FoldingSet, so the order will differ from one invocation of > Clang to the next. > > - Doug >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
