r194226 - Adds the ability to inject a DiagnosticConsumer into ClangTools.

Manuel Klimek klimek at google.com
Tue Nov 12 09:57:42 PST 2013


Done in r194494.


On Fri, Nov 8, 2013 at 2:17 AM, Peter Collingbourne <peter at pcc.me.uk> wrote:

> On Thu, Nov 07, 2013 at 11:18:05PM -0000, Manuel Klimek wrote:
> > +TEST(ClangToolTest, InjectDiagnosticConsumer) {
> > +  FixedCompilationDatabase Compilations("/",
> std::vector<std::string>());
> > +  ClangTool Tool(Compilations, std::vector<std::string>(1, "/a.cc"));
> > +  Tool.mapVirtualFile("/a.cc", "int x = undeclared;");
> > +  TestDiagnosticConsumer Consumer;
> > +  Tool.setDiagnosticConsumer(&Consumer);
> > +  Tool.run(newFrontendActionFactory<SyntaxOnlyAction>());
> > +  EXPECT_EQ(1u, Consumer.NumDiagnosticsSeen);
> > +}
>
> Should this also be testing buildASTs?  (I guess you could use a #warning
> directive in order to ensure ASTUnit returns an AST).
>
> Thanks,
> --
> Peter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131112/acdb9e32/attachment.html>


More information about the cfe-commits mailing list