mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -13,7 +13,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Disassembler.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/MC/MCAsmBackend.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
@ -320,9 +319,9 @@ static int AsLexInput(SourceMgr &SrcMgr, MCAsmInfo &MAI, tool_output_file *Out)
|
||||
static int AssembleInput(const char *ProgName, const Target *TheTarget,
|
||||
SourceMgr &SrcMgr, MCContext &Ctx, MCStreamer &Str,
|
||||
MCAsmInfo &MAI, MCSubtargetInfo &STI, MCInstrInfo &MCII) {
|
||||
OwningPtr<MCAsmParser> Parser(createMCAsmParser(SrcMgr, Ctx,
|
||||
Str, MAI));
|
||||
OwningPtr<MCTargetAsmParser> TAP(TheTarget->createMCAsmParser(STI, *Parser, MCII));
|
||||
std::unique_ptr<MCAsmParser> Parser(createMCAsmParser(SrcMgr, Ctx, Str, MAI));
|
||||
std::unique_ptr<MCTargetAsmParser> TAP(
|
||||
TheTarget->createMCAsmParser(STI, *Parser, MCII));
|
||||
if (!TAP) {
|
||||
errs() << ProgName
|
||||
<< ": error: this target does not support assembly parsing.\n";
|
||||
@ -363,7 +362,7 @@ int main(int argc, char **argv) {
|
||||
if (!TheTarget)
|
||||
return 1;
|
||||
|
||||
OwningPtr<MemoryBuffer> BufferPtr;
|
||||
std::unique_ptr<MemoryBuffer> BufferPtr;
|
||||
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr)) {
|
||||
errs() << ProgName << ": " << ec.message() << '\n';
|
||||
return 1;
|
||||
@ -379,15 +378,15 @@ int main(int argc, char **argv) {
|
||||
// it later.
|
||||
SrcMgr.setIncludeDirs(IncludeDirs);
|
||||
|
||||
llvm::OwningPtr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TripleName));
|
||||
std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TripleName));
|
||||
assert(MRI && "Unable to create target register info!");
|
||||
|
||||
llvm::OwningPtr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(*MRI, TripleName));
|
||||
std::unique_ptr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(*MRI, TripleName));
|
||||
assert(MAI && "Unable to create target asm info!");
|
||||
|
||||
// FIXME: This is not pretty. MCContext has a ptr to MCObjectFileInfo and
|
||||
// MCObjectFileInfo needs a MCContext reference in order to initialize itself.
|
||||
OwningPtr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
|
||||
std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
|
||||
MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr);
|
||||
MOFI->InitMCObjectFileInfo(TripleName, RelocModel, CMModel, Ctx);
|
||||
|
||||
@ -413,16 +412,16 @@ int main(int argc, char **argv) {
|
||||
FeaturesStr = Features.getString();
|
||||
}
|
||||
|
||||
OwningPtr<tool_output_file> Out(GetOutputStream());
|
||||
std::unique_ptr<tool_output_file> Out(GetOutputStream());
|
||||
if (!Out)
|
||||
return 1;
|
||||
|
||||
formatted_raw_ostream FOS(Out->os());
|
||||
OwningPtr<MCStreamer> Str;
|
||||
std::unique_ptr<MCStreamer> Str;
|
||||
|
||||
OwningPtr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo());
|
||||
OwningPtr<MCSubtargetInfo>
|
||||
STI(TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
|
||||
std::unique_ptr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo());
|
||||
std::unique_ptr<MCSubtargetInfo> STI(
|
||||
TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
|
||||
|
||||
MCInstPrinter *IP = NULL;
|
||||
if (FileType == OFT_AssemblyFile) {
|
||||
|
Reference in New Issue
Block a user