aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/CodeGenTarget.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2014-12-10 06:18:57 +0000
committerCraig Topper <craig.topper@gmail.com>2014-12-10 06:18:57 +0000
commit48a8e641e228f7aec182db4a4a469d9cdd41e8b9 (patch)
tree908eff6be567d098a2fb507077eea891db43bf9b /llvm/utils/TableGen/CodeGenTarget.cpp
parent04da06ccee2b15b131efd26d69401112d21e5d48 (diff)
downloadllvm-48a8e641e228f7aec182db4a4a469d9cdd41e8b9.zip
llvm-48a8e641e228f7aec182db4a4a469d9cdd41e8b9.tar.gz
llvm-48a8e641e228f7aec182db4a4a469d9cdd41e8b9.tar.bz2
Use unique_ptr instead of DeleteContainerSeconds.
llvm-svn: 223918
Diffstat (limited to 'llvm/utils/TableGen/CodeGenTarget.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenTarget.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp
index 1cb66a8..1f13a20 100644
--- a/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -143,7 +143,6 @@ CodeGenTarget::CodeGenTarget(RecordKeeper &records)
}
CodeGenTarget::~CodeGenTarget() {
- DeleteContainerSeconds(Instructions);
}
const std::string &CodeGenTarget::getName() const {
@@ -270,20 +269,20 @@ void CodeGenTarget::ReadInstructions() const {
// Parse the instructions defined in the .td file.
for (unsigned i = 0, e = Insts.size(); i != e; ++i)
- Instructions[Insts[i]] = new CodeGenInstruction(Insts[i]);
+ Instructions[Insts[i]] = llvm::make_unique<CodeGenInstruction>(Insts[i]);
}
static const CodeGenInstruction *
GetInstByName(const char *Name,
- const DenseMap<const Record*, CodeGenInstruction*> &Insts,
+ const DenseMap<const Record*,
+ std::unique_ptr<CodeGenInstruction>> &Insts,
RecordKeeper &Records) {
const Record *Rec = Records.getDef(Name);
- DenseMap<const Record*, CodeGenInstruction*>::const_iterator
- I = Insts.find(Rec);
+ const auto I = Insts.find(Rec);
if (!Rec || I == Insts.end())
PrintFatalError(Twine("Could not find '") + Name + "' instruction!");
- return I->second;
+ return I->second.get();
}
/// \brief Return all of the instructions defined by the target, ordered by
@@ -298,7 +297,7 @@ void CodeGenTarget::ComputeInstrsByEnum() const {
"LIFETIME_END", "STACKMAP", "PATCHPOINT", "LOAD_STACK_GUARD",
"STATEPOINT",
nullptr};
- const DenseMap<const Record*, CodeGenInstruction*> &Insts = getInstructions();
+ const auto &Insts = getInstructions();
for (const char *const *p = FixedInstrs; *p; ++p) {
const CodeGenInstruction *Instr = GetInstByName(*p, Insts, Records);
assert(Instr && "Missing target independent instruction");
@@ -308,7 +307,7 @@ void CodeGenTarget::ComputeInstrsByEnum() const {
unsigned EndOfPredefines = InstrsByEnum.size();
for (const auto &I : Insts) {
- const CodeGenInstruction *CGI = I.second;
+ const CodeGenInstruction *CGI = I.second.get();
if (CGI->Namespace != "TargetOpcode")
InstrsByEnum.push_back(CGI);
}