|
8 | 8 |
|
9 | 9 | #include "Generators.h" |
10 | 10 | #include "Representation.h" |
| 11 | +#include "support/File.h" |
11 | 12 | #include "clang/Basic/Version.h" |
12 | 13 | #include "llvm/ADT/StringExtras.h" |
13 | 14 | #include "llvm/ADT/StringRef.h" |
@@ -251,47 +252,6 @@ static void appendVector(std::vector<Derived> &&New, |
251 | 252 | std::move(New.begin(), New.end(), std::back_inserter(Original)); |
252 | 253 | } |
253 | 254 |
|
254 | | -// Compute the relative path from an Origin directory to a Destination directory |
255 | | -static SmallString<128> computeRelativePath(StringRef Destination, |
256 | | - StringRef Origin) { |
257 | | - // If Origin is empty, the relative path to the Destination is its complete |
258 | | - // path. |
259 | | - if (Origin.empty()) |
260 | | - return Destination; |
261 | | - |
262 | | - // The relative path is an empty path if both directories are the same. |
263 | | - if (Destination == Origin) |
264 | | - return {}; |
265 | | - |
266 | | - // These iterators iterate through each of their parent directories |
267 | | - llvm::sys::path::const_iterator FileI = llvm::sys::path::begin(Destination); |
268 | | - llvm::sys::path::const_iterator FileE = llvm::sys::path::end(Destination); |
269 | | - llvm::sys::path::const_iterator DirI = llvm::sys::path::begin(Origin); |
270 | | - llvm::sys::path::const_iterator DirE = llvm::sys::path::end(Origin); |
271 | | - // Advance both iterators until the paths differ. Example: |
272 | | - // Destination = A/B/C/D |
273 | | - // Origin = A/B/E/F |
274 | | - // FileI will point to C and DirI to E. The directories behind them is the |
275 | | - // directory they share (A/B). |
276 | | - while (FileI != FileE && DirI != DirE && *FileI == *DirI) { |
277 | | - ++FileI; |
278 | | - ++DirI; |
279 | | - } |
280 | | - SmallString<128> Result; // This will hold the resulting path. |
281 | | - // Result has to go up one directory for each of the remaining directories in |
282 | | - // Origin |
283 | | - while (DirI != DirE) { |
284 | | - llvm::sys::path::append(Result, ".."); |
285 | | - ++DirI; |
286 | | - } |
287 | | - // Result has to append each of the remaining directories in Destination |
288 | | - while (FileI != FileE) { |
289 | | - llvm::sys::path::append(Result, *FileI); |
290 | | - ++FileI; |
291 | | - } |
292 | | - return Result; |
293 | | -} |
294 | | - |
295 | 255 | // HTML generation |
296 | 256 |
|
297 | 257 | static std::vector<std::unique_ptr<TagNode>> |
@@ -1138,23 +1098,6 @@ static llvm::Error genIndex(const ClangDocContext &CDCtx) { |
1138 | 1098 | return llvm::Error::success(); |
1139 | 1099 | } |
1140 | 1100 |
|
1141 | | -static llvm::Error copyFile(StringRef FilePath, StringRef OutDirectory) { |
1142 | | - llvm::SmallString<128> PathWrite; |
1143 | | - llvm::sys::path::native(OutDirectory, PathWrite); |
1144 | | - llvm::sys::path::append(PathWrite, llvm::sys::path::filename(FilePath)); |
1145 | | - llvm::SmallString<128> PathRead; |
1146 | | - llvm::sys::path::native(FilePath, PathRead); |
1147 | | - std::error_code OK; |
1148 | | - std::error_code FileErr = llvm::sys::fs::copy_file(PathRead, PathWrite); |
1149 | | - if (FileErr != OK) { |
1150 | | - return llvm::createStringError(llvm::inconvertibleErrorCode(), |
1151 | | - "error creating file " + |
1152 | | - llvm::sys::path::filename(FilePath) + |
1153 | | - ": " + FileErr.message() + "\n"); |
1154 | | - } |
1155 | | - return llvm::Error::success(); |
1156 | | -} |
1157 | | - |
1158 | 1101 | llvm::Error HTMLGenerator::createResources(ClangDocContext &CDCtx) { |
1159 | 1102 | auto Err = serializeIndex(CDCtx); |
1160 | 1103 | if (Err) |
|
0 commit comments