diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:39 +0300 |
commit | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch) | |
tree | 64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/libs/llvm12/lib/TableGen/Main.cpp | |
parent | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff) | |
download | ydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/TableGen/Main.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/TableGen/Main.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/contrib/libs/llvm12/lib/TableGen/Main.cpp b/contrib/libs/llvm12/lib/TableGen/Main.cpp index b20c794f4c..0ace5363dd 100644 --- a/contrib/libs/llvm12/lib/TableGen/Main.cpp +++ b/contrib/libs/llvm12/lib/TableGen/Main.cpp @@ -52,9 +52,9 @@ MacroNames("D", cl::desc("Name of the macro to be defined"), static cl::opt<bool> WriteIfChanged("write-if-changed", cl::desc("Only write output if it changed")); -static cl::opt<bool> -TimePhases("time-phases", cl::desc("Time phases of parser and backend")); - +static cl::opt<bool> +TimePhases("time-phases", cl::desc("Time phases of parser and backend")); + static int reportError(const char *ProgName, Twine Msg) { errs() << ProgName << ": " << Msg; errs().flush(); @@ -86,20 +86,20 @@ static int createDependencyFile(const TGParser &Parser, const char *argv0) { int llvm::TableGenMain(const char *argv0, TableGenMainFn *MainFn) { RecordKeeper Records; - if (TimePhases) - Records.startPhaseTiming(); - + if (TimePhases) + Records.startPhaseTiming(); + // Parse the input file. - - Records.startTimer("Parse, build records"); + + Records.startTimer("Parse, build records"); ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr = MemoryBuffer::getFileOrSTDIN(InputFilename); if (std::error_code EC = FileOrErr.getError()) return reportError(argv0, "Could not open input file '" + InputFilename + "': " + EC.message() + "\n"); - Records.saveInputFilename(InputFilename); - + Records.saveInputFilename(InputFilename); + // Tell SrcMgr about this buffer, which is what TGParser will pick up. SrcMgr.AddNewSourceBuffer(std::move(*FileOrErr), SMLoc()); @@ -111,15 +111,15 @@ int llvm::TableGenMain(const char *argv0, TableGenMainFn *MainFn) { if (Parser.ParseFile()) return 1; - Records.stopTimer(); + Records.stopTimer(); // Write output to memory. - Records.startBackendTimer("Backend overall"); + Records.startBackendTimer("Backend overall"); std::string OutString; raw_string_ostream Out(OutString); - unsigned status = MainFn(Out, Records); - Records.stopBackendTimer(); - if (status) + unsigned status = MainFn(Out, Records); + Records.stopBackendTimer(); + if (status) return 1; // Always write the depfile, even if the main output hasn't changed. @@ -131,29 +131,29 @@ int llvm::TableGenMain(const char *argv0, TableGenMainFn *MainFn) { return Ret; } - Records.startTimer("Write output"); - bool WriteFile = true; + Records.startTimer("Write output"); + bool WriteFile = true; if (WriteIfChanged) { // Only updates the real output file if there are any differences. // This prevents recompilation of all the files depending on it if there // aren't any. if (auto ExistingOrErr = MemoryBuffer::getFile(OutputFilename)) if (std::move(ExistingOrErr.get())->getBuffer() == Out.str()) - WriteFile = false; + WriteFile = false; + } + if (WriteFile) { + std::error_code EC; + ToolOutputFile OutFile(OutputFilename, EC, sys::fs::OF_None); + if (EC) + return reportError(argv0, "error opening " + OutputFilename + ": " + + EC.message() + "\n"); + OutFile.os() << Out.str(); + if (ErrorsPrinted == 0) + OutFile.keep(); } - if (WriteFile) { - std::error_code EC; - ToolOutputFile OutFile(OutputFilename, EC, sys::fs::OF_None); - if (EC) - return reportError(argv0, "error opening " + OutputFilename + ": " + - EC.message() + "\n"); - OutFile.os() << Out.str(); - if (ErrorsPrinted == 0) - OutFile.keep(); - } - - Records.stopTimer(); - Records.stopPhaseTiming(); + + Records.stopTimer(); + Records.stopPhaseTiming(); if (ErrorsPrinted > 0) return reportError(argv0, Twine(ErrorsPrinted) + " errors.\n"); |