Commit a18cc9c6 by Jim Stichnoth

Subzero: Change llvm::OwningPtr to C++11's std::unique_ptr.

While I'm at it, normalize the #include order: 1. C++ library headers 2. LLVM headers 3. Subzero headers A blank line between each group. Each group sorted alphabetically, case-insensitive. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3930 R=jfb@chromium.org, jvoung@chromium.org Review URL: https://codereview.chromium.org/622443002
parent c4554d78
......@@ -26,7 +26,7 @@ namespace Ice {
Cfg::Cfg(GlobalContext *Ctx)
: Ctx(Ctx), FunctionName(""), ReturnType(IceType_void),
IsInternalLinkage(false), HasError(false), ErrorMessage(""), Entry(NULL),
NextInstNumber(1), Live(NULL),
NextInstNumber(1), Live(nullptr),
Target(TargetLowering::createLowering(Ctx->getTargetArch(), this)),
VMetadata(new VariablesMetadata(this)),
TargetAssembler(
......
......@@ -15,15 +15,15 @@
#ifndef SUBZERO_SRC_ICECFG_H
#define SUBZERO_SRC_ICECFG_H
#include "IceDefs.h"
#include "IceTypes.h"
#include <memory>
#include "llvm/Support/Allocator.h"
#include "assembler.h"
#include "IceClFlags.h"
#include "IceDefs.h"
#include "IceGlobalContext.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/Allocator.h"
#include "IceTypes.h"
namespace Ice {
......@@ -172,10 +172,10 @@ private:
VarList Variables;
VarList Args; // subset of Variables, in argument order
VarList ImplicitArgs; // subset of Variables
llvm::OwningPtr<Liveness> Live;
llvm::OwningPtr<TargetLowering> Target;
llvm::OwningPtr<VariablesMetadata> VMetadata;
llvm::OwningPtr<Assembler> TargetAssembler;
std::unique_ptr<Liveness> Live;
std::unique_ptr<TargetLowering> Target;
std::unique_ptr<VariablesMetadata> VMetadata;
std::unique_ptr<Assembler> TargetAssembler;
// CurrentNode is maintained during dumping/emitting just for
// validating Variable::DefNode. Normally, a traversal over
......
......@@ -11,6 +11,16 @@
//
//===----------------------------------------------------------------------===//
#include <iostream>
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceClFlags.h"
......@@ -23,16 +33,6 @@
#include "IceTypes.h"
#include "IceTypeConverter.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include <iostream>
using namespace llvm;
namespace {
......
......@@ -16,9 +16,8 @@
#ifndef SUBZERO_SRC_ICEDEFS_H
#define SUBZERO_SRC_ICEDEFS_H
#include <stdint.h> // TODO: <cstdint> with C++11
#include <cassert>
#include <cstdint>
#include <cstdio> // snprintf
#include <functional> // std::less
#include <limits>
......
......@@ -15,14 +15,14 @@
#include <ctype.h> // isdigit(), isupper()
#include <locale> // locale
#include "IceDefs.h"
#include "IceTypes.h"
#include "IceCfg.h"
#include "IceClFlags.h"
#include "IceDefs.h"
#include "IceGlobalContext.h"
#include "IceOperand.h"
#include "IceTargetLowering.h"
#include "IceTimerTree.h"
#include "IceTypes.h"
namespace Ice {
......
......@@ -15,7 +15,8 @@
#ifndef SUBZERO_SRC_ICEGLOBALCONTEXT_H
#define SUBZERO_SRC_ICEGLOBALCONTEXT_H
#include "llvm/ADT/OwningPtr.h"
#include <memory>
#include "llvm/Support/Allocator.h"
#include "llvm/Support/raw_ostream.h"
......@@ -161,7 +162,7 @@ private:
llvm::BumpPtrAllocator Allocator;
VerboseMask VMask;
llvm::OwningPtr<class ConstantPool> ConstPool;
std::unique_ptr<class ConstantPool> ConstPool;
Intrinsics IntrinsicsInfo;
const TargetArch Arch;
const OptLevel Opt;
......@@ -171,7 +172,7 @@ private:
RandomNumberGenerator RNG;
CodeStats StatsFunction;
CodeStats StatsCumulative;
llvm::OwningPtr<class TimerStack> Timers;
std::unique_ptr<class TimerStack> Timers;
GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION;
GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION;
......
......@@ -19,9 +19,9 @@
//
//===----------------------------------------------------------------------===//
#include "IceDefs.h"
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceDefs.h"
#include "IceInst.h"
#include "IceLiveness.h"
#include "IceOperand.h"
......
......@@ -14,7 +14,8 @@
#ifndef SUBZERO_SRC_ICERNG_H
#define SUBZERO_SRC_ICERNG_H
#include <stdint.h>
#include <cstdint>
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Compiler.h"
......
......@@ -15,6 +15,8 @@
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/CommandLine.h"
#include "assembler_ia32.h"
#include "IceCfg.h" // setError()
#include "IceCfgNode.h"
......@@ -23,8 +25,6 @@
#include "IceTargetLowering.h"
#include "IceTargetLoweringX8632.h"
#include "llvm/Support/CommandLine.h"
namespace Ice {
namespace {
......
......@@ -19,9 +19,8 @@
#define SUBZERO_SRC_ICETARGETLOWERING_H
#include "IceDefs.h"
#include "IceTypes.h"
#include "IceInst.h" // for the names of the Inst subtypes
#include "IceTypes.h"
namespace Ice {
......
......@@ -15,19 +15,20 @@
//
//===----------------------------------------------------------------------===//
#include "IceDefs.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/MathExtras.h"
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceClFlags.h"
#include "IceDefs.h"
#include "IceInstX8632.h"
#include "IceOperand.h"
#include "IceRegistersX8632.h"
#include "IceTargetLoweringX8632.def"
#include "IceTargetLoweringX8632.h"
#include "IceUtils.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/CommandLine.h"
namespace Ice {
......
......@@ -16,11 +16,11 @@
#ifndef SUBZERO_SRC_ICETARGETLOWERINGX8632_H
#define SUBZERO_SRC_ICETARGETLOWERINGX8632_H
#include "IceDefs.h"
#include "IceTargetLowering.h"
#include "assembler_ia32.h"
#include "IceDefs.h"
#include "IceInstX8632.h"
#include "IceRegistersX8632.h"
#include "IceTargetLowering.h"
namespace Ice {
......
......@@ -12,16 +12,18 @@
//
//===----------------------------------------------------------------------===//
#include <iostream>
#include <memory>
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Module.h"
#include "IceCfg.h"
#include "IceClFlags.h"
#include "IceDefs.h"
#include "IceTargetLowering.h"
#include "IceTranslator.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include <iostream>
using namespace Ice;
......@@ -96,7 +98,7 @@ void Translator::emitConstants() {
}
void Translator::convertGlobals(llvm::Module *Mod) {
llvm::OwningPtr<TargetGlobalInitLowering> GlobalLowering(
std::unique_ptr<TargetGlobalInitLowering> GlobalLowering(
TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
for (llvm::Module::const_global_iterator I = Mod->global_begin(),
E = Mod->global_end();
......
......@@ -15,7 +15,7 @@
#ifndef SUBZERO_SRC_ICETRANSLATOR_H
#define SUBZERO_SRC_ICETRANSLATOR_H
#include "llvm/ADT/OwningPtr.h"
#include <memory>
namespace llvm {
class Module;
......@@ -75,7 +75,7 @@ protected:
// object, change all Constant related functions to use
// GlobalContext instead of Cfg, and then make emitConstantPool use
// that.
llvm::OwningPtr<Cfg> Func;
std::unique_ptr<Cfg> Func;
private:
Translator(const Translator &) LLVM_DELETED_FUNCTION;
......
......@@ -12,9 +12,10 @@
//
//===----------------------------------------------------------------------===//
#include "IceTypeConverter.h"
#include "llvm/Support/raw_ostream.h"
#include "IceTypeConverter.h"
namespace Ice {
TypeConverter::TypeConverter(llvm::LLVMContext &Context) {
......
......@@ -15,9 +15,10 @@
#ifndef SUBZERO_SRC_ICETYPECONVERTER_H
#define SUBZERO_SRC_ICETYPECONVERTER_H
#include "llvm/IR/DerivedTypes.h"
#include "IceDefs.h"
#include "IceTypes.h"
#include "llvm/IR/DerivedTypes.h"
namespace llvm {
class LLVMContext;
......
......@@ -12,14 +12,10 @@
//
//===----------------------------------------------------------------------===//
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceClFlags.h"
#include "IceDefs.h"
#include "IceInst.h"
#include "IceOperand.h"
#include "IceTypeConverter.h"
#include "PNaClTranslator.h"
#include <cassert>
#include <memory>
#include <vector>
#include "llvm/Analysis/NaCl/PNaClABIProps.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h"
......@@ -34,8 +30,14 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/ValueHandle.h"
#include <vector>
#include <cassert>
#include "IceCfg.h"
#include "IceCfgNode.h"
#include "IceClFlags.h"
#include "IceDefs.h"
#include "IceInst.h"
#include "IceOperand.h"
#include "IceTypeConverter.h"
#include "PNaClTranslator.h"
using namespace llvm;
......@@ -252,7 +254,7 @@ private:
// The translator associated with the parser.
Ice::Translator &Translator;
// The parsed module.
OwningPtr<Module> Mod;
std::unique_ptr<Module> Mod;
// The data layout to use.
DataLayout DL;
// The bitcode header.
......
......@@ -15,9 +15,10 @@
#ifndef SUBZERO_SRC_PNACLTRANSLATOR_H
#define SUBZERO_SRC_PNACLTRANSLATOR_H
#include "IceTranslator.h"
#include <string>
#include "IceTranslator.h"
namespace Ice {
class PNaClTranslator : public Translator {
......
......@@ -13,10 +13,8 @@
//
//===----------------------------------------------------------------------===//
#include "IceCfg.h"
#include "IceClFlags.h"
#include "IceConverter.h"
#include "PNaClTranslator.h"
#include <fstream>
#include <iostream>
#include "llvm/IR/LLVMContext.h"
#include "llvm/IRReader/IRReader.h"
......@@ -24,8 +22,10 @@
#include "llvm/Support/raw_os_ostream.h"
#include "llvm/Support/SourceMgr.h"
#include <fstream>
#include <iostream>
#include "IceCfg.h"
#include "IceClFlags.h"
#include "IceConverter.h"
#include "PNaClTranslator.h"
using namespace llvm;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment