summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-12-16 23:49:14 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-12-16 23:49:14 +0000
commitc49ac5e7c2e7b7d750b264b8e54dc6248474442d (patch)
tree8d5c863d20e4df3c5a63bb0552ae2a9b1f3bbda3 /llvm/lib/MC
parent6627c70df7b1e124d716503c3d2ebeb8ce9d07a9 (diff)
downloadbcm5719-llvm-c49ac5e7c2e7b7d750b264b8e54dc6248474442d.tar.gz
bcm5719-llvm-c49ac5e7c2e7b7d750b264b8e54dc6248474442d.zip
Use std::unique_ptr. NFC.
llvm-svn: 255852
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCContext.cpp3
-rw-r--r--llvm/lib/MC/MCParser/DarwinAsmParser.cpp14
2 files changed, 7 insertions, 10 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 383540a7a8f..b5ad518d033 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -63,9 +63,6 @@ MCContext::~MCContext() {
// NOTE: The symbols are all allocated out of a bump pointer allocator,
// we don't need to free them here.
-
- // If the stream for the .secure_log_unique directive was created free it.
- delete (raw_ostream *)SecureLog;
}
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
index b3bb3cc4e16..73e068a3439 100644
--- a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCParser/MCAsmParserExtension.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
@@ -666,17 +667,16 @@ bool DarwinAsmParser::parseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) {
"environment variable unset.");
// Open the secure log file if we haven't already.
- raw_ostream *OS = getContext().getSecureLog();
+ raw_fd_ostream *OS = getContext().getSecureLog();
if (!OS) {
std::error_code EC;
- OS = new raw_fd_ostream(SecureLogFile, EC,
- sys::fs::F_Append | sys::fs::F_Text);
- if (EC) {
- delete OS;
+ auto NewOS = llvm::make_unique<raw_fd_ostream>(
+ SecureLogFile, EC, sys::fs::F_Append | sys::fs::F_Text);
+ if (EC)
return Error(IDLoc, Twine("can't open secure log file: ") +
SecureLogFile + " (" + EC.message() + ")");
- }
- getContext().setSecureLog(OS);
+ OS = NewOS.get();
+ getContext().setSecureLog(std::move(NewOS));
}
// Write the message.
OpenPOWER on IntegriCloud