This is an archive of the discontinued LLVM Phabricator instance.

Driver tests: don't assume the clang binary is called 'clang'
Needs ReviewPublic

Authored by kjcamann on Apr 20 2015, 4:45 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

There are approximately 20 tests in tests/Driver that assume the clang binary is called "clang(.*)"; I would like to remove that assumption

Why is this a good idea?

Several modifications to clang require changing in-tree source files, for example, the clang internals manual has a section on how to add a new expressions and statements (http://clang.llvm.org/docs/InternalsManual.html#how-to-add-an-expression-or-statement).

Not everyone who wants to do this is making a change that can be contributed back upstream. I maintain a code generator which works by adding extensions to the language. This isn't the kind of thing either party would want in the official LLVM, so it is best implemented as a fork of clang (sadly it can't be a libtooling plugin, because in-tree files like StmtNodes.def need to be changed).

So that users can install such tools safely alongside clang, I think its a good idea to change the name of the executables and the intrinsics header directory. To avoid confusion, I think calling any such tool "clang" anywhere in the file name is a bad idea. I was pleasently surprised by how little of the build system I needed to change to get this to work. The system is pretty flexible, except for this part:

There are quite a few driver test files that assume a "%clang" driver invocation's -### printout expands into calls to "{{[^"]*}}clang{{[^"]*}}" "-cc1" or something similar. However, that's not the case in some other driver tests, where it just starts matching at "-cc1". For example, in test/Driver/freebsd.c:5 we just try to match "-cc1" <other stuff>, whereas in test/Driver/netbsd.c:102, we try to match a clang substring, then "-cc1", then <other stuff>. This patch would introduce a single way of doing it, one which is also friendlier to "renamed clang" tools. Changing these tests will ensure that this behavior doesn't get copy-and-pasted back, as people write new driver tests.

Diff Detail

Repository
rL LLVM

Event Timeline

kjcamann updated this revision to Diff 24076.Apr 20 2015, 4:45 PM
kjcamann retitled this revision from to Driver tests: don't assume the clang binary is called 'clang'.
kjcamann updated this object.
kjcamann edited the test plan for this revision. (Show Details)
kjcamann added a reviewer: mcrosier.
kjcamann set the repository for this revision to rL LLVM.
kjcamann added a subscriber: Unknown Object (MLST).
mcrosier accepted this revision.Apr 22 2015, 8:20 AM
mcrosier added a reviewer: ddunbar.
mcrosier edited edge metadata.

Sounds reasonable.

This revision is now accepted and ready to land.Apr 22 2015, 8:21 AM
mcrosier resigned from this revision.Aug 26 2015, 2:49 PM
mcrosier removed a reviewer: mcrosier.
This revision now requires review to proceed.Aug 26 2015, 2:49 PM
ddunbar resigned from this revision.Sep 1 2016, 8:22 PM
ddunbar removed a reviewer: ddunbar.