llvm.org GIT mirror llvm / 67c5f45
Delete utils/FileUpdate. It is unused and it looks like it was never used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211508 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
6 changed file(s) with 2 addition(s) and 117 deletion(s). Raw diff Collapse all Expand all
498498
499499 if( LLVM_INCLUDE_UTILS )
500500 add_subdirectory(utils/FileCheck)
501 add_subdirectory(utils/FileUpdate)
502501 add_subdirectory(utils/PerfectShuffle)
503502 add_subdirectory(utils/count)
504503 add_subdirectory(utils/not)
242242 r"\bmacho-dump\b",
243243 NOJUNK + r"\bopt\b",
244244 r"\bFileCheck\b",
245 r"\bFileUpdate\b",
246245 r"\bobj2yaml\b",
247246 r"\byaml2obj\b",
248247 # Handle these specially as they are strings searched
+0
-5
utils/FileUpdate/CMakeLists.txt less more
None add_llvm_utility(FileUpdate
1 FileUpdate.cpp
2 )
3
4 target_link_libraries(FileUpdate LLVMSupport)
+0
-87
utils/FileUpdate/FileUpdate.cpp less more
None //===- FileUpdate.cpp - Conditionally update a file -----------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // FileUpdate is a utility for conditionally updating a file from its input
10 // based on whether the input differs from the output. It is used to avoid
11 // unnecessary modifications in a build system.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #include "llvm/Support/CommandLine.h"
16 #include "llvm/Support/FileSystem.h"
17 #include "llvm/Support/MemoryBuffer.h"
18 #include "llvm/Support/PrettyStackTrace.h"
19 #include "llvm/Support/Signals.h"
20 #include "llvm/Support/ToolOutputFile.h"
21 #include
22 using namespace llvm;
23
24 static cl::opt
25 Quiet("quiet", cl::desc("Don't print unnecessary status information"),
26 cl::init(false));
27
28 static cl::opt
29 InputFilename("input-file", cl::desc("Input file (defaults to stdin)"),
30 cl::init("-"), cl::value_desc("filename"));
31
32 static cl::opt
33 OutputFilename(cl::Positional, cl::desc(""), cl::Required);
34
35 int main(int argc, char **argv) {
36 sys::PrintStackTraceOnErrorSignal();
37 PrettyStackTraceProgram X(argc, argv);
38 cl::ParseCommandLineOptions(argc, argv);
39
40 if (OutputFilename == "-") {
41 errs() << argv[0] << ": error: Can't update standard output\n";
42 return 1;
43 }
44
45 // Get the input data.
46 std::unique_ptr In;
47 if (std::error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, In)) {
48 errs() << argv[0] << ": error: Unable to get input '"
49 << InputFilename << "': " << ec.message() << '\n';
50 return 1;
51 }
52
53 // Get the output data.
54 std::unique_ptr Out;
55 MemoryBuffer::getFile(OutputFilename.c_str(), Out);
56
57 // If the output exists and the contents match, we are done.
58 if (Out && In->getBufferSize() == Out->getBufferSize() &&
59 memcmp(In->getBufferStart(), Out->getBufferStart(),
60 Out->getBufferSize()) == 0) {
61 if (!Quiet)
62 errs() << argv[0] << ": Not updating '" << OutputFilename
63 << "', contents match input.\n";
64 return 0;
65 }
66
67 // Otherwise, overwrite the output.
68 if (!Quiet)
69 errs() << argv[0] << ": Updating '" << OutputFilename
70 << "', contents changed.\n";
71 std::string ErrorStr;
72 tool_output_file OutStream(OutputFilename.c_str(), ErrorStr,
73 sys::fs::F_None);
74 if (!ErrorStr.empty()) {
75 errs() << argv[0] << ": Unable to write output '"
76 << OutputFilename << "': " << ErrorStr << '\n';
77 return 1;
78 }
79
80 OutStream.os().write(In->getBufferStart(), In->getBufferSize());
81
82 // Declare success.
83 OutStream.keep();
84
85 return 0;
86 }
+0
-21
utils/FileUpdate/Makefile less more
None ##===- utils/FileUpdate/Makefile ---------------------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8
9 LEVEL = ../..
10 TOOLNAME = FileUpdate
11 USEDLIBS = LLVMSupport.a
12
13 # This tool has no plugins, optimize startup time.
14 TOOL_NO_EXPORTS = 1
15
16 # Don't install this utility
17 NO_INSTALL = 1
18
19 include $(LEVEL)/Makefile.common
20
77 ##===----------------------------------------------------------------------===##
88
99 LEVEL = ..
10 PARALLEL_DIRS := FileCheck FileUpdate TableGen PerfectShuffle \
11 count fpcmp llvm-lit not unittest
10 PARALLEL_DIRS := FileCheck TableGen PerfectShuffle count fpcmp llvm-lit not \
11 unittest
1212
1313 EXTRA_DIST := check-each-file codegen-diff countloc.sh \
1414 DSAclean.py DSAextract.py emacs findsym.pl GenLibDeps.pl \