llvm.org GIT mirror llvm / d2fb7bd
[dsymutil] Introduce exit helper. NFC. llvm-dsymutil will start creating temporary files in a followup commit. To ease the correct cleanup of this files, introduce a helper called to exit dsymutil. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244086 91177308-0d34-0410-b5e6-96231b3b80d8 Frederic Riss 5 years ago
2 changed file(s) with 12 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
7676 return OutputFileOpt;
7777 }
7878
79 void llvm::dsymutil::exitDsymutil(int ExitStatus) {
80 exit(ExitStatus);
81 }
82
7983 int main(int argc, char **argv) {
8084 llvm::sys::PrintStackTraceOnErrorSignal();
8185 llvm::PrettyStackTraceProgram StackPrinter(argc, argv);
119123 if (auto EC = DebugMapPtrOrErr.getError()) {
120124 llvm::errs() << "error: cannot parse the debug map for \"" << InputFile
121125 << "\": " << EC.message() << '\n';
122 return 1;
126 exitDsymutil(1);
123127 }
124128
125129 if (Verbose || DumpDebugMap)
130134
131135 std::string OutputFile = getOutputFileName(InputFile);
132136 if (!linkDwarf(OutputFile, **DebugMapPtrOrErr, Options))
133 return 1;
137 exitDsymuti(1);
134138 }
135139
136 return 0;
140 exitDsymutil(0);
137141 }
4343 /// \returns false if the link failed.
4444 bool linkDwarf(StringRef OutputFilename, const DebugMap &DM,
4545 const LinkOptions &Options);
46
47 /// \brief Exit the dsymutil process, cleaning up every temporary
48 /// files that we created.
49 LLVM_ATTRIBUTE_NORETURN void exitDsymutil(int ExitStatus);
50
4651 }
4752 }
4853 #endif // LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H