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 { ...@@ -26,7 +26,7 @@ namespace Ice {
Cfg::Cfg(GlobalContext *Ctx) Cfg::Cfg(GlobalContext *Ctx)
: Ctx(Ctx), FunctionName(""), ReturnType(IceType_void), : Ctx(Ctx), FunctionName(""), ReturnType(IceType_void),
IsInternalLinkage(false), HasError(false), ErrorMessage(""), Entry(NULL), IsInternalLinkage(false), HasError(false), ErrorMessage(""), Entry(NULL),
NextInstNumber(1), Live(NULL), NextInstNumber(1), Live(nullptr),
Target(TargetLowering::createLowering(Ctx->getTargetArch(), this)), Target(TargetLowering::createLowering(Ctx->getTargetArch(), this)),
VMetadata(new VariablesMetadata(this)), VMetadata(new VariablesMetadata(this)),
TargetAssembler( TargetAssembler(
......
...@@ -15,15 +15,15 @@ ...@@ -15,15 +15,15 @@
#ifndef SUBZERO_SRC_ICECFG_H #ifndef SUBZERO_SRC_ICECFG_H
#define SUBZERO_SRC_ICECFG_H #define SUBZERO_SRC_ICECFG_H
#include "IceDefs.h" #include <memory>
#include "IceTypes.h"
#include "llvm/Support/Allocator.h"
#include "assembler.h" #include "assembler.h"
#include "IceClFlags.h" #include "IceClFlags.h"
#include "IceDefs.h"
#include "IceGlobalContext.h" #include "IceGlobalContext.h"
#include "IceTypes.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/Allocator.h"
namespace Ice { namespace Ice {
...@@ -172,10 +172,10 @@ private: ...@@ -172,10 +172,10 @@ private:
VarList Variables; VarList Variables;
VarList Args; // subset of Variables, in argument order VarList Args; // subset of Variables, in argument order
VarList ImplicitArgs; // subset of Variables VarList ImplicitArgs; // subset of Variables
llvm::OwningPtr<Liveness> Live; std::unique_ptr<Liveness> Live;
llvm::OwningPtr<TargetLowering> Target; std::unique_ptr<TargetLowering> Target;
llvm::OwningPtr<VariablesMetadata> VMetadata; std::unique_ptr<VariablesMetadata> VMetadata;
llvm::OwningPtr<Assembler> TargetAssembler; std::unique_ptr<Assembler> TargetAssembler;
// CurrentNode is maintained during dumping/emitting just for // CurrentNode is maintained during dumping/emitting just for
// validating Variable::DefNode. Normally, a traversal over // validating Variable::DefNode. Normally, a traversal over
......
...@@ -11,6 +11,16 @@ ...@@ -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 "IceCfg.h"
#include "IceCfgNode.h" #include "IceCfgNode.h"
#include "IceClFlags.h" #include "IceClFlags.h"
...@@ -23,16 +33,6 @@ ...@@ -23,16 +33,6 @@
#include "IceTypes.h" #include "IceTypes.h"
#include "IceTypeConverter.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; using namespace llvm;
namespace { namespace {
......
...@@ -16,9 +16,8 @@ ...@@ -16,9 +16,8 @@
#ifndef SUBZERO_SRC_ICEDEFS_H #ifndef SUBZERO_SRC_ICEDEFS_H
#define SUBZERO_SRC_ICEDEFS_H #define SUBZERO_SRC_ICEDEFS_H
#include <stdint.h> // TODO: <cstdint> with C++11
#include <cassert> #include <cassert>
#include <cstdint>
#include <cstdio> // snprintf #include <cstdio> // snprintf
#include <functional> // std::less #include <functional> // std::less
#include <limits> #include <limits>
......
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
#include <ctype.h> // isdigit(), isupper() #include <ctype.h> // isdigit(), isupper()
#include <locale> // locale #include <locale> // locale
#include "IceDefs.h"
#include "IceTypes.h"
#include "IceCfg.h" #include "IceCfg.h"
#include "IceClFlags.h" #include "IceClFlags.h"
#include "IceDefs.h"
#include "IceGlobalContext.h" #include "IceGlobalContext.h"
#include "IceOperand.h" #include "IceOperand.h"
#include "IceTargetLowering.h" #include "IceTargetLowering.h"
#include "IceTimerTree.h" #include "IceTimerTree.h"
#include "IceTypes.h"
namespace Ice { namespace Ice {
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
#ifndef SUBZERO_SRC_ICEGLOBALCONTEXT_H #ifndef SUBZERO_SRC_ICEGLOBALCONTEXT_H
#define SUBZERO_SRC_ICEGLOBALCONTEXT_H #define SUBZERO_SRC_ICEGLOBALCONTEXT_H
#include "llvm/ADT/OwningPtr.h" #include <memory>
#include "llvm/Support/Allocator.h" #include "llvm/Support/Allocator.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
...@@ -161,7 +162,7 @@ private: ...@@ -161,7 +162,7 @@ private:
llvm::BumpPtrAllocator Allocator; llvm::BumpPtrAllocator Allocator;
VerboseMask VMask; VerboseMask VMask;
llvm::OwningPtr<class ConstantPool> ConstPool; std::unique_ptr<class ConstantPool> ConstPool;
Intrinsics IntrinsicsInfo; Intrinsics IntrinsicsInfo;
const TargetArch Arch; const TargetArch Arch;
const OptLevel Opt; const OptLevel Opt;
...@@ -171,7 +172,7 @@ private: ...@@ -171,7 +172,7 @@ private:
RandomNumberGenerator RNG; RandomNumberGenerator RNG;
CodeStats StatsFunction; CodeStats StatsFunction;
CodeStats StatsCumulative; CodeStats StatsCumulative;
llvm::OwningPtr<class TimerStack> Timers; std::unique_ptr<class TimerStack> Timers;
GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION;
GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION;
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "IceDefs.h"
#include "IceCfg.h" #include "IceCfg.h"
#include "IceCfgNode.h" #include "IceCfgNode.h"
#include "IceDefs.h"
#include "IceInst.h" #include "IceInst.h"
#include "IceLiveness.h" #include "IceLiveness.h"
#include "IceOperand.h" #include "IceOperand.h"
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
#ifndef SUBZERO_SRC_ICERNG_H #ifndef SUBZERO_SRC_ICERNG_H
#define SUBZERO_SRC_ICERNG_H #define SUBZERO_SRC_ICERNG_H
#include <stdint.h> #include <cstdint>
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/Support/CommandLine.h"
#include "assembler_ia32.h" #include "assembler_ia32.h"
#include "IceCfg.h" // setError() #include "IceCfg.h" // setError()
#include "IceCfgNode.h" #include "IceCfgNode.h"
...@@ -23,8 +25,6 @@ ...@@ -23,8 +25,6 @@
#include "IceTargetLowering.h" #include "IceTargetLowering.h"
#include "IceTargetLoweringX8632.h" #include "IceTargetLoweringX8632.h"
#include "llvm/Support/CommandLine.h"
namespace Ice { namespace Ice {
namespace { namespace {
......
...@@ -19,9 +19,8 @@ ...@@ -19,9 +19,8 @@
#define SUBZERO_SRC_ICETARGETLOWERING_H #define SUBZERO_SRC_ICETARGETLOWERING_H
#include "IceDefs.h" #include "IceDefs.h"
#include "IceTypes.h"
#include "IceInst.h" // for the names of the Inst subtypes #include "IceInst.h" // for the names of the Inst subtypes
#include "IceTypes.h"
namespace Ice { namespace Ice {
......
...@@ -15,19 +15,20 @@ ...@@ -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 "IceCfg.h"
#include "IceCfgNode.h" #include "IceCfgNode.h"
#include "IceClFlags.h" #include "IceClFlags.h"
#include "IceDefs.h"
#include "IceInstX8632.h" #include "IceInstX8632.h"
#include "IceOperand.h" #include "IceOperand.h"
#include "IceRegistersX8632.h" #include "IceRegistersX8632.h"
#include "IceTargetLoweringX8632.def" #include "IceTargetLoweringX8632.def"
#include "IceTargetLoweringX8632.h" #include "IceTargetLoweringX8632.h"
#include "IceUtils.h" #include "IceUtils.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/CommandLine.h"
namespace Ice { namespace Ice {
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
#ifndef SUBZERO_SRC_ICETARGETLOWERINGX8632_H #ifndef SUBZERO_SRC_ICETARGETLOWERINGX8632_H
#define SUBZERO_SRC_ICETARGETLOWERINGX8632_H #define SUBZERO_SRC_ICETARGETLOWERINGX8632_H
#include "IceDefs.h"
#include "IceTargetLowering.h"
#include "assembler_ia32.h" #include "assembler_ia32.h"
#include "IceDefs.h"
#include "IceInstX8632.h" #include "IceInstX8632.h"
#include "IceRegistersX8632.h" #include "IceRegistersX8632.h"
#include "IceTargetLowering.h"
namespace Ice { namespace Ice {
......
...@@ -12,16 +12,18 @@ ...@@ -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 "IceCfg.h"
#include "IceClFlags.h" #include "IceClFlags.h"
#include "IceDefs.h" #include "IceDefs.h"
#include "IceTargetLowering.h" #include "IceTargetLowering.h"
#include "IceTranslator.h" #include "IceTranslator.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include <iostream>
using namespace Ice; using namespace Ice;
...@@ -96,7 +98,7 @@ void Translator::emitConstants() { ...@@ -96,7 +98,7 @@ void Translator::emitConstants() {
} }
void Translator::convertGlobals(llvm::Module *Mod) { void Translator::convertGlobals(llvm::Module *Mod) {
llvm::OwningPtr<TargetGlobalInitLowering> GlobalLowering( std::unique_ptr<TargetGlobalInitLowering> GlobalLowering(
TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx)); TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
for (llvm::Module::const_global_iterator I = Mod->global_begin(), for (llvm::Module::const_global_iterator I = Mod->global_begin(),
E = Mod->global_end(); E = Mod->global_end();
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#ifndef SUBZERO_SRC_ICETRANSLATOR_H #ifndef SUBZERO_SRC_ICETRANSLATOR_H
#define SUBZERO_SRC_ICETRANSLATOR_H #define SUBZERO_SRC_ICETRANSLATOR_H
#include "llvm/ADT/OwningPtr.h" #include <memory>
namespace llvm { namespace llvm {
class Module; class Module;
...@@ -75,7 +75,7 @@ protected: ...@@ -75,7 +75,7 @@ protected:
// object, change all Constant related functions to use // object, change all Constant related functions to use
// GlobalContext instead of Cfg, and then make emitConstantPool use // GlobalContext instead of Cfg, and then make emitConstantPool use
// that. // that.
llvm::OwningPtr<Cfg> Func; std::unique_ptr<Cfg> Func;
private: private:
Translator(const Translator &) LLVM_DELETED_FUNCTION; Translator(const Translator &) LLVM_DELETED_FUNCTION;
......
...@@ -12,9 +12,10 @@ ...@@ -12,9 +12,10 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "IceTypeConverter.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include "IceTypeConverter.h"
namespace Ice { namespace Ice {
TypeConverter::TypeConverter(llvm::LLVMContext &Context) { TypeConverter::TypeConverter(llvm::LLVMContext &Context) {
......
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
#ifndef SUBZERO_SRC_ICETYPECONVERTER_H #ifndef SUBZERO_SRC_ICETYPECONVERTER_H
#define SUBZERO_SRC_ICETYPECONVERTER_H #define SUBZERO_SRC_ICETYPECONVERTER_H
#include "llvm/IR/DerivedTypes.h"
#include "IceDefs.h" #include "IceDefs.h"
#include "IceTypes.h" #include "IceTypes.h"
#include "llvm/IR/DerivedTypes.h"
namespace llvm { namespace llvm {
class LLVMContext; class LLVMContext;
......
...@@ -12,14 +12,10 @@ ...@@ -12,14 +12,10 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "IceCfg.h" #include <cassert>
#include "IceCfgNode.h" #include <memory>
#include "IceClFlags.h" #include <vector>
#include "IceDefs.h"
#include "IceInst.h"
#include "IceOperand.h"
#include "IceTypeConverter.h"
#include "PNaClTranslator.h"
#include "llvm/Analysis/NaCl/PNaClABIProps.h" #include "llvm/Analysis/NaCl/PNaClABIProps.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h" #include "llvm/Bitcode/NaCl/NaClBitcodeDecoders.h"
#include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h" #include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h"
...@@ -34,8 +30,14 @@ ...@@ -34,8 +30,14 @@
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include "llvm/Support/ValueHandle.h" #include "llvm/Support/ValueHandle.h"
#include <vector> #include "IceCfg.h"
#include <cassert> #include "IceCfgNode.h"
#include "IceClFlags.h"
#include "IceDefs.h"
#include "IceInst.h"
#include "IceOperand.h"
#include "IceTypeConverter.h"
#include "PNaClTranslator.h"
using namespace llvm; using namespace llvm;
...@@ -252,7 +254,7 @@ private: ...@@ -252,7 +254,7 @@ private:
// The translator associated with the parser. // The translator associated with the parser.
Ice::Translator &Translator; Ice::Translator &Translator;
// The parsed module. // The parsed module.
OwningPtr<Module> Mod; std::unique_ptr<Module> Mod;
// The data layout to use. // The data layout to use.
DataLayout DL; DataLayout DL;
// The bitcode header. // The bitcode header.
......
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
#ifndef SUBZERO_SRC_PNACLTRANSLATOR_H #ifndef SUBZERO_SRC_PNACLTRANSLATOR_H
#define SUBZERO_SRC_PNACLTRANSLATOR_H #define SUBZERO_SRC_PNACLTRANSLATOR_H
#include "IceTranslator.h"
#include <string> #include <string>
#include "IceTranslator.h"
namespace Ice { namespace Ice {
class PNaClTranslator : public Translator { class PNaClTranslator : public Translator {
......
...@@ -13,10 +13,8 @@ ...@@ -13,10 +13,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "IceCfg.h" #include <fstream>
#include "IceClFlags.h" #include <iostream>
#include "IceConverter.h"
#include "PNaClTranslator.h"
#include "llvm/IR/LLVMContext.h" #include "llvm/IR/LLVMContext.h"
#include "llvm/IRReader/IRReader.h" #include "llvm/IRReader/IRReader.h"
...@@ -24,8 +22,10 @@ ...@@ -24,8 +22,10 @@
#include "llvm/Support/raw_os_ostream.h" #include "llvm/Support/raw_os_ostream.h"
#include "llvm/Support/SourceMgr.h" #include "llvm/Support/SourceMgr.h"
#include <fstream> #include "IceCfg.h"
#include <iostream> #include "IceClFlags.h"
#include "IceConverter.h"
#include "PNaClTranslator.h"
using namespace llvm; 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