Commit Graph

5 Commits

Author SHA1 Message Date
Sam McCall 59336a0a45 Compilation database test: don't try to output to CWD
Summary:
Write output from compilation database test to %T rather than the working dir.
Sometimes CWD isn't writable!
Also specify no-canonical-prefixes so that clang has 'clang' in the name.

Reviewers: bkramer

Subscribers: joerg, cfe-commits

Differential Revision: https://reviews.llvm.org/D27504

llvm-svn: 288892
2016-12-07 09:19:07 +00:00
Joerg Sonnenberger 3661087111 Fix FileCheck pattern.
llvm-svn: 288828
2016-12-06 17:06:33 +00:00
Joerg Sonnenberger a53561f60e Allow additional output since e.g. OSX appends flags like
"-mlinker-version=264.3.102" automatically. Wiring down a target on the
other hand is problematic as this actually needs to run codegen and
doesn't work with -###.

llvm-svn: 288827
2016-12-06 17:02:41 +00:00
Joerg Sonnenberger d4435e331a Make test case slightly more robust by explicitly passing --sysroot.
Otherwise it would change when DEFAULT_SYSROOT is provided.

llvm-svn: 288823
2016-12-06 16:47:00 +00:00
Joerg Sonnenberger cbc872549c Allow clang to write compilation database records.
When integrating compilation database output into existing build
systems, two approaches dominate so far. Ad-hoc implementation of the
JSON output rules or using compiler wrappers. This patch adds a new
option "-MJ foo.json" which gives a slightly cleaned up compilation
record. The output is a fragment, i.e. you still need to add the array
markers, but it allows multiple files to be easy merged.

This way the only change in a build system is adding the option with
potentially a per-target output file and merging the files with
something like
  (echo '['; cat *.o.json; echo ']' > compilation_database.json
or some additional filtering to remove the trailing comma for strict
JSON compliance.

Differential Revision: https://reviews.llvm.org/D27140

llvm-svn: 288821
2016-12-06 16:33:22 +00:00