r194226 - Adds the ability to inject a DiagnosticConsumer into ClangTools.
Peter Collingbourne
peter at pcc.me.uk
Thu Nov 7 17:17:26 PST 2013
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
More information about the cfe-commits
mailing list