llvm.org GIT mirror llvm / f44533c
Revert "llvm-cov: Added command-line option to change dir." This reverts commit d8acf0078cf363252727acff00f85ae8074f95b3. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194040 91177308-0d34-0410-b5e6-96231b3b80d8 Yuchen Wu 6 years ago
2 changed file(s) with 7 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
265265 for (StringMap::iterator I = LineInfo.begin(), E = LineInfo.end();
266266 I != E; ++I) {
267267 StringRef Filename = I->first();
268 OwningPtr Buff;
269 if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, Buff)) {
270 errs() << Filename << ": " << ec.message() << "\n";
271 return;
272 }
273 StringRef AllLines = Buff.take()->getBuffer();
274
275268 OS << " -: 0:Source:" << Filename << "\n";
276269 OS << " -: 0:Graph:" << gcnoFile << "\n";
277270 OS << " -: 0:Data:" << gcdaFile << "\n";
278271 OS << " -: 0:Runs:" << RunCount << "\n";
279272 OS << " -: 0:Programs:" << ProgramCount << "\n";
280
281273 LineCounts &L = LineInfo[Filename];
274 OwningPtr Buff;
275 if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, Buff)) {
276 errs() << Filename << ": " << ec.message() << "\n";
277 return;
278 }
279 StringRef AllLines = Buff.take()->getBuffer();
282280 uint32_t i = 0;
283281 while (!AllLines.empty()) {
284282 if (L.find(i) != L.end()) {
1919 #include "llvm/Support/raw_ostream.h"
2020 #include "llvm/Support/Signals.h"
2121 #include "llvm/Support/system_error.h"
22 #include
2322 using namespace llvm;
2423
2524 static cl::opt
3433 static cl::opt
3534 OutputFile("o", cl::desc(""), cl::init("-"));
3635
37 static cl::opt
38 WorkingDir("C", cl::desc("change path of working directory"),
39 cl::init(""));
4036
4137 //===----------------------------------------------------------------------===//
4238 int main(int argc, char **argv) {
4642 llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
4743
4844 cl::ParseCommandLineOptions(argc, argv, "llvm coverage tool\n");
49
50 if (!WorkingDir.empty()) {
51 if (chdir(WorkingDir.c_str()) == -1) {
52 errs() << "Cannot change to directory: " << WorkingDir << ".\n";
53 return 1;
54 }
55 }
5645
5746 std::string ErrorInfo;
5847 raw_fd_ostream OS(OutputFile.c_str(), ErrorInfo);
8776 }
8877 }
8978
79
9080 if (DumpGCOV)
9181 GF.dump();
9282