10#include "llvm/ADT/SmallString.h"
11#include "llvm/Support/Path.h"
12#include "llvm/Support/raw_ostream.h"
15 for (
unsigned i = 0, e =
Target.size(); i != e; ++i) {
20 for (
int j = i - 1; j >= 0 &&
Target[j] ==
'\\'; --j)
88static void printFilename(llvm::raw_ostream &OS, llvm::StringRef Filename,
92 llvm::sys::path::native(Filename, NativePath);
98 if (NativePath.find_first_of(
" #${}^!") != llvm::StringRef::npos)
99 OS <<
'\"' << NativePath <<
'\"';
105 for (
unsigned i = 0, e = NativePath.size(); i != e; ++i) {
106 if (NativePath[i] ==
'#')
108 else if (NativePath[i] ==
' ') {
111 while (j > 0 && NativePath[--j] ==
'\\')
113 }
else if (NativePath[i] ==
'$')
124 unsigned InputFileIndex) {
129 const unsigned MaxColumns = 75;
130 unsigned Columns = 0;
132 for (StringRef
Target : Targets) {
133 unsigned N =
Target.size();
136 }
else if (Columns + N + 2 > MaxColumns) {
152 for (StringRef
File : Files) {
153 if (
File ==
"<stdin>")
158 unsigned N =
File.size();
159 if (Columns + (N + 1) + 2 > MaxColumns) {
170 if (PhonyTargets && !Files.empty()) {
172 for (
auto I = Files.begin(), E = Files.end(); I != E; ++I) {
173 if (Index++ == InputFileIndex)
static void printFilename(llvm::raw_ostream &OS, llvm::StringRef Filename, clang::DependencyOutputFormat OutputFormat)
Print the filename, with escaping or quoting that accommodates the three most likely tools that use d...
void quoteMakeTarget(StringRef Target, SmallVectorImpl< char > &Res)
Quote target names for inclusion in GNU Make dependency files.
void printMakeDependencyFile(llvm::raw_ostream &OS, llvm::ArrayRef< std::string > Targets, llvm::ArrayRef< std::string > Files, DependencyOutputFormat Format=DependencyOutputFormat::Make, bool PhonyTargets=false, unsigned InputFileIndex=0)
Write Make-style dependency output to the output stream, in the form: target1 target2 ....
DependencyOutputFormat
DependencyOutputFormat - Format for the compiler dependency file.