summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2015-08-05 18:27:38 +0000
committerFrederic Riss <friss@apple.com>2015-08-05 18:27:38 +0000
commit05761673ef773bfae48bb3760e24c21a4cf3e85b (patch)
treebc4d3e12135ac9f57683dbc9445770af12873865 /llvm/tools
parentb22dd100160ffc97932ae97ce3368d205f351dea (diff)
downloadbcm5719-llvm-05761673ef773bfae48bb3760e24c21a4cf3e85b.tar.gz
bcm5719-llvm-05761673ef773bfae48bb3760e24c21a4cf3e85b.zip
[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. llvm-svn: 244086
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/dsymutil/dsymutil.cpp10
-rw-r--r--llvm/tools/dsymutil/dsymutil.h5
2 files changed, 12 insertions, 3 deletions
diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp
index 54a4b5b3332..07fdf314c44 100644
--- a/llvm/tools/dsymutil/dsymutil.cpp
+++ b/llvm/tools/dsymutil/dsymutil.cpp
@@ -77,6 +77,10 @@ static std::string getOutputFileName(llvm::StringRef InputFile) {
return OutputFileOpt;
}
+void llvm::dsymutil::exitDsymutil(int ExitStatus) {
+ exit(ExitStatus);
+}
+
int main(int argc, char **argv) {
llvm::sys::PrintStackTraceOnErrorSignal();
llvm::PrettyStackTraceProgram StackPrinter(argc, argv);
@@ -120,7 +124,7 @@ int main(int argc, char **argv) {
if (auto EC = DebugMapPtrOrErr.getError()) {
llvm::errs() << "error: cannot parse the debug map for \"" << InputFile
<< "\": " << EC.message() << '\n';
- return 1;
+ exitDsymutil(1);
}
if (Verbose || DumpDebugMap)
@@ -131,8 +135,8 @@ int main(int argc, char **argv) {
std::string OutputFile = getOutputFileName(InputFile);
if (!linkDwarf(OutputFile, **DebugMapPtrOrErr, Options))
- return 1;
+ exitDsymuti(1);
}
- return 0;
+ exitDsymutil(0);
}
diff --git a/llvm/tools/dsymutil/dsymutil.h b/llvm/tools/dsymutil/dsymutil.h
index cd530a1177a..7c1810f4fad 100644
--- a/llvm/tools/dsymutil/dsymutil.h
+++ b/llvm/tools/dsymutil/dsymutil.h
@@ -44,6 +44,11 @@ llvm::ErrorOr<std::unique_ptr<DebugMap>> parseDebugMap(StringRef InputFile,
/// \returns false if the link failed.
bool linkDwarf(StringRef OutputFilename, const DebugMap &DM,
const LinkOptions &Options);
+
+/// \brief Exit the dsymutil process, cleaning up every temporary
+/// files that we created.
+LLVM_ATTRIBUTE_NORETURN void exitDsymutil(int ExitStatus);
+
}
}
#endif // LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
OpenPOWER on IntegriCloud