[PATCH] D21810: Don't instantiate a full host toolchain in ASTMatchersTest.

Chandler Carruth via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 28 13:12:45 PDT 2016

chandlerc added inline comments.

Comment at: unittests/ASTMatchers/ASTMatchersTest.h:81-83
@@ +80,5 @@
+  //
+  // FIXME: This is a hack to work around the fact that there's no way to do the
+  // equivalent of runToolOnCodeWithArgs without instantiating a full Driver.
+  // We should consider having a function, at least for tests, that invokes cc1.
+  std::vector<std::string> Args = {CompileArg, "-frtti", "-fexceptions",
jlebar wrote:
> klimek wrote:
> > Couldn't we use -ccc-install-dir to prevent toolchain search?
> > Couldn't we use -ccc-install-dir to prevent toolchain search?
> I tried -ccc-install-dir /does/not/exist and it had no speedup relative to the original.
Yea, that just won't help sadly.

As I indicated to Justin, I think the correct fix long-term is to expose a routine that uses CC1 flags directly for use in unittests. That will completely eliminate the need for this. Fundamentally, the unittests shouldn't be reaching through the entire driver, they should be directly running the frontend. There should be specific and dedicated unittests for the driver bits that point the driver at a fake tree instead of the real tree as well.

But I think this is a reasonable workaround until such an API can be provided.


More information about the cfe-commits mailing list