This is an archive of the discontinued LLVM Phabricator instance.

[FileCheck] Move FileCheck implementation out of LLVMSupport into its own library
ClosedPublic

Authored by teemperor on Aug 21 2020, 5:20 AM.

Details

Summary

The actual FileCheck logic seems to be implemented in LLVMSupport. I don't see a good
reason for having FileCheck implemented there as it has a very specific use while LLVMSupport
is a dependency of pretty much every LLVM tool there is. In fact, the only use of FileCheck I
could find (outside the FileCheck tool and the FileCheck unit test) is a single call in GISelMITest.h.

This moves the FileCheck logic to its own LLVMFileCheck library. This way only FileCheck and
the GlobalISelTests now have a dependency on this code.

Diff Detail

Event Timeline

teemperor created this revision.Aug 21 2020, 5:20 AM
teemperor requested review of this revision.Aug 21 2020, 5:20 AM

A big thank you, it'll speed up incremental debug build considerably. LGTM but I'm not too well versed in the CMake aspects of making a LLVM libraries so I'll let someone else approve this change.

jhenderson accepted this revision.Aug 21 2020, 5:34 AM

All looks good to me, with the exception of a couple of inline nits, and the fact that I know nothing about the modulemap stuff (but the latter looks right, based on what is done elsewhere within it).

llvm/include/llvm/FileCheck/FileCheck.h
12–14

Include guards need updating.

llvm/lib/FileCheck/FileCheckImpl.h
14–16

Ditto.

This revision is now accepted and ready to land.Aug 21 2020, 5:34 AM
teemperor updated this revision to Diff 287016.Aug 21 2020, 5:59 AM
teemperor added a reviewer: thakis.
  • Fix header guards (thanks @jhenderson!)
  • Adapt GN build files too.
teemperor marked 2 inline comments as done.Aug 21 2020, 5:59 AM

Thanks for the quick review!

Thanks for updating the GN files! I just wanted to point out that updating them is completely optional.

Somewhat minor post-commit thought, but we now have both a library FileCheck and an executable binary FileCheck (not to mention the existing confusion of having two FileCheck.cpp files).

Might be nice to think about a naming scheme that would reduce these collisions?

Somewhat minor post-commit thought, but we now have both a library FileCheck and an executable binary FileCheck (not to mention the existing confusion of having two FileCheck.cpp files).

Might be nice to think about a naming scheme that would reduce these collisions?

It's kinda similar for tablegen, but there we don't have the problem of the executable having a upper camel case name (LLVMTableGen and llvm-tblgen). Here it's LLVMFileCheck and FileCheck. Renaming the library would be inconsistent with the other LLVM library names (which have an LLVM prefix) and I renaming FileCheck seems like a humongous task. We could rename the library to something else though...

For the file name, maybe FileCheckFrontend.cpp for the FileCheck executable source?