11#include "llvm/ADT/SmallString.h"
12#include "llvm/Support/Path.h"
13#include "llvm/Support/raw_ostream.h"
16 for (
unsigned i = 0, e =
Target.size(); i != e; ++i) {
21 for (
int j = i - 1; j >= 0 &&
Target[j] ==
'\\'; --j)
89static void printFilename(llvm::raw_ostream &OS, llvm::StringRef Filename,
93 llvm::sys::path::native(Filename, NativePath);
99 if (NativePath.find_first_of(
" #${}^!") != llvm::StringRef::npos)
100 OS <<
'\"' << NativePath <<
'\"';
106 for (
unsigned i = 0, e = NativePath.size(); i != e; ++i) {
107 if (NativePath[i] ==
'#')
109 else if (NativePath[i] ==
' ') {
112 while (j > 0 && NativePath[--j] ==
'\\')
114 }
else if (NativePath[i] ==
'$')
125 unsigned InputFileIndex) {
130 const unsigned MaxColumns = 75;
131 unsigned Columns = 0;
133 for (StringRef
Target : Targets) {
134 unsigned N =
Target.size();
137 }
else if (Columns + N + 2 > MaxColumns) {
153 for (StringRef
File : Files) {
154 if (
File ==
"<stdin>")
159 unsigned N =
File.size();
160 if (Columns + (N + 1) + 2 > MaxColumns) {
171 if (PhonyTargets && !Files.empty()) {
173 for (
auto I = Files.begin(), E = Files.end(); I != E; ++I) {
174 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.