Commit 8e8042c4 by Jim Stichnoth

Subzero: Enable the C++11 build.

This just adds -std=c++11 to the compiler flags and fixes the resulting errors/warnings. Later CLs can fix things related to the LLVM 3.5 merge. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3930 R=jfb@chromium.org, kschimpf@google.com Review URL: https://codereview.chromium.org/607443003
parent f0657dd8
...@@ -54,7 +54,7 @@ OPTLEVEL := -O0 ...@@ -54,7 +54,7 @@ OPTLEVEL := -O0
CCACHE := `command -v ccache` CCACHE := `command -v ccache`
CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++
CXXFLAGS := $(LLVM_CXXFLAGS) -Wall -Wextra -Werror -fno-rtti \ CXXFLAGS := $(LLVM_CXXFLAGS) -std=c++11 -Wall -Wextra -Werror -fno-rtti \
-fno-exceptions $(OPTLEVEL) -g $(HOST_FLAGS) \ -fno-exceptions $(OPTLEVEL) -g $(HOST_FLAGS) \
-Wno-error=unused-parameter -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 -Wno-error=unused-parameter -I$(LIBCXX_INSTALL_PATH)/include/c++/v1
LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib
......
...@@ -77,6 +77,7 @@ public: ...@@ -77,6 +77,7 @@ public:
protected: protected:
Operand(OperandKind Kind, Type Ty) Operand(OperandKind Kind, Type Ty)
: Ty(Ty), Kind(Kind), NumVars(0), Vars(NULL) {} : Ty(Ty), Kind(Kind), NumVars(0), Vars(NULL) {}
Operand(Operand &&O) = default;
const Type Ty; const Type Ty;
const OperandKind Kind; const OperandKind Kind;
...@@ -345,6 +346,7 @@ Ostream &operator<<(Ostream &Str, const LiveRange &L); ...@@ -345,6 +346,7 @@ Ostream &operator<<(Ostream &Str, const LiveRange &L);
class Variable : public Operand { class Variable : public Operand {
Variable(const Variable &) LLVM_DELETED_FUNCTION; Variable(const Variable &) LLVM_DELETED_FUNCTION;
Variable &operator=(const Variable &) LLVM_DELETED_FUNCTION; Variable &operator=(const Variable &) LLVM_DELETED_FUNCTION;
Variable(Variable &&V) = default;
public: public:
static Variable *create(Cfg *Func, Type Ty, SizeT Index, static Variable *create(Cfg *Func, Type Ty, SizeT Index,
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
namespace Ice { namespace Ice {
TypeConverter::TypeConverter(llvm::LLVMContext &Context) : Context(Context) { TypeConverter::TypeConverter(llvm::LLVMContext &Context) {
AddLLVMType(IceType_void, llvm::Type::getVoidTy(Context)); AddLLVMType(IceType_void, llvm::Type::getVoidTy(Context));
AddLLVMType(IceType_i1, llvm::IntegerType::get(Context, 1)); AddLLVMType(IceType_i1, llvm::IntegerType::get(Context, 1));
AddLLVMType(IceType_i8, llvm::IntegerType::get(Context, 8)); AddLLVMType(IceType_i8, llvm::IntegerType::get(Context, 8));
......
...@@ -61,8 +61,6 @@ public: ...@@ -61,8 +61,6 @@ public:
llvm::Type *getLLVMVectorType(unsigned Size, Type Ty) const; llvm::Type *getLLVMVectorType(unsigned Size, Type Ty) const;
private: private:
// The LLVM context to use to build LLVM types.
llvm::LLVMContext &Context;
// The list of allowable LLVM types. Indexed by ICE type. // The list of allowable LLVM types. Indexed by ICE type.
std::vector<llvm::Type *> LLVMTypes; std::vector<llvm::Type *> LLVMTypes;
// The inverse mapping of LLVMTypes. // The inverse mapping of LLVMTypes.
......
...@@ -66,13 +66,12 @@ public: ...@@ -66,13 +66,12 @@ public:
setErrStream(Translator.getContext()->getStrDump()); setErrStream(Translator.getContext()->getStrDump());
} }
virtual ~TopLevelParser() {} ~TopLevelParser() override {}
LLVM_OVERRIDE;
Ice::Translator &getTranslator() { return Translator; } Ice::Translator &getTranslator() { return Translator; }
// Generates error with given Message. Always returns true. // Generates error with given Message. Always returns true.
virtual bool Error(const std::string &Message) LLVM_OVERRIDE { bool Error(const std::string &Message) override {
ErrorStatus = true; ErrorStatus = true;
++NumErrors; ++NumErrors;
NaClBitcodeParser::Error(Message); NaClBitcodeParser::Error(Message);
...@@ -281,7 +280,7 @@ private: ...@@ -281,7 +280,7 @@ private:
// references to global variable addresses. // references to global variable addresses.
Type *GlobalVarPlaceHolderType; Type *GlobalVarPlaceHolderType;
virtual bool ParseBlock(unsigned BlockID) LLVM_OVERRIDE; bool ParseBlock(unsigned BlockID) override;
/// Reports that type ID is undefined, and then returns /// Reports that type ID is undefined, and then returns
/// the void type. /// the void type.
...@@ -339,7 +338,7 @@ public: ...@@ -339,7 +338,7 @@ public:
BlockParserBaseClass(unsigned BlockID, TopLevelParser *Context) BlockParserBaseClass(unsigned BlockID, TopLevelParser *Context)
: NaClBitcodeParser(BlockID, Context), Context(Context) {} : NaClBitcodeParser(BlockID, Context), Context(Context) {}
virtual ~BlockParserBaseClass() LLVM_OVERRIDE {} ~BlockParserBaseClass() override {}
protected: protected:
// The context parser that contains the decoded state. // The context parser that contains the decoded state.
...@@ -356,7 +355,7 @@ protected: ...@@ -356,7 +355,7 @@ protected:
const Ice::ClFlags &getFlags() const { return getTranslator().getFlags(); } const Ice::ClFlags &getFlags() const { return getTranslator().getFlags(); }
// Generates an error Message with the bit address prefixed to it. // Generates an error Message with the bit address prefixed to it.
virtual bool Error(const std::string &Message) LLVM_OVERRIDE { bool Error(const std::string &Message) override {
uint64_t Bit = Record.GetStartBit() + Context->getHeaderSize() * 8; uint64_t Bit = Record.GetStartBit() + Context->getHeaderSize() * 8;
std::string Buffer; std::string Buffer;
raw_string_ostream StrBuf(Buffer); raw_string_ostream StrBuf(Buffer);
...@@ -367,11 +366,11 @@ protected: ...@@ -367,11 +366,11 @@ protected:
// Default implementation. Reports that block is unknown and skips // Default implementation. Reports that block is unknown and skips
// its contents. // its contents.
virtual bool ParseBlock(unsigned BlockID) LLVM_OVERRIDE; bool ParseBlock(unsigned BlockID) override;
// Default implementation. Reports that the record is not // Default implementation. Reports that the record is not
// understood. // understood.
virtual void ProcessRecord() LLVM_OVERRIDE; void ProcessRecord() override;
// Checks if the size of the record is Size. Return true if valid. // Checks if the size of the record is Size. Return true if valid.
// Otherwise generates an error and returns false. // Otherwise generates an error and returns false.
...@@ -465,14 +464,14 @@ public: ...@@ -465,14 +464,14 @@ public:
TypesParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) TypesParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser)
: BlockParserBaseClass(BlockID, EnclosingParser), NextTypeId(0) {} : BlockParserBaseClass(BlockID, EnclosingParser), NextTypeId(0) {}
~TypesParser() LLVM_OVERRIDE {} ~TypesParser() override {}
private: private:
// The type ID that will be associated with the next type defining // The type ID that will be associated with the next type defining
// record in the types block. // record in the types block.
unsigned NextTypeId; unsigned NextTypeId;
virtual void ProcessRecord() LLVM_OVERRIDE; void ProcessRecord() override;
}; };
void TypesParser::ProcessRecord() { void TypesParser::ProcessRecord() {
...@@ -565,7 +564,7 @@ public: ...@@ -565,7 +564,7 @@ public:
NextGlobalID = Context->getNumFunctionIDs(); NextGlobalID = Context->getNumFunctionIDs();
} }
virtual ~GlobalsParser() LLVM_OVERRIDE {} ~GlobalsParser() override {}
private: private:
// Holds the sequence of initializers for the global. // Holds the sequence of initializers for the global.
...@@ -584,7 +583,7 @@ private: ...@@ -584,7 +583,7 @@ private:
// The index of the next global variable. // The index of the next global variable.
unsigned NextGlobalID; unsigned NextGlobalID;
virtual void ExitBlock() LLVM_OVERRIDE { void ExitBlock() override {
verifyNoMissingInitializers(); verifyNoMissingInitializers();
unsigned NumIDs = Context->getNumGlobalValueIDs(); unsigned NumIDs = Context->getNumGlobalValueIDs();
if (NextGlobalID < NumIDs) { if (NextGlobalID < NumIDs) {
...@@ -598,7 +597,7 @@ private: ...@@ -598,7 +597,7 @@ private:
BlockParserBaseClass::ExitBlock(); BlockParserBaseClass::ExitBlock();
} }
virtual void ProcessRecord() LLVM_OVERRIDE; void ProcessRecord() override;
// Checks if the number of initializers needed is the same as the // Checks if the number of initializers needed is the same as the
// number found in the bitcode file. If different, and error message // number found in the bitcode file. If different, and error message
...@@ -773,7 +772,7 @@ public: ...@@ -773,7 +772,7 @@ public:
ValuesymtabParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) ValuesymtabParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser)
: BlockParserBaseClass(BlockID, EnclosingParser) {} : BlockParserBaseClass(BlockID, EnclosingParser) {}
virtual ~ValuesymtabParser() LLVM_OVERRIDE {} ~ValuesymtabParser() override {}
protected: protected:
typedef SmallString<128> StringType; typedef SmallString<128> StringType;
...@@ -786,7 +785,7 @@ protected: ...@@ -786,7 +785,7 @@ protected:
private: private:
virtual void ProcessRecord() LLVM_OVERRIDE; void ProcessRecord() override;
void ConvertToString(StringType &ConvertedName) { void ConvertToString(StringType &ConvertedName) {
const NaClBitcodeRecord::RecordVector &Values = Record.GetValues(); const NaClBitcodeRecord::RecordVector &Values = Record.GetValues();
...@@ -853,7 +852,7 @@ public: ...@@ -853,7 +852,7 @@ public:
} }
} }
~FunctionParser() LLVM_OVERRIDE; ~FunctionParser() override;
// Set the next constant ID to the given constant C. // Set the next constant ID to the given constant C.
void setNextConstantID(Ice::Constant *C) { void setNextConstantID(Ice::Constant *C) {
...@@ -905,11 +904,11 @@ private: ...@@ -905,11 +904,11 @@ private:
Alignment = 1; Alignment = 1;
} }
virtual bool ParseBlock(unsigned BlockID) LLVM_OVERRIDE; bool ParseBlock(unsigned BlockID) override;
virtual void ProcessRecord() LLVM_OVERRIDE; void ProcessRecord() override;
virtual void ExitBlock() LLVM_OVERRIDE; void ExitBlock() override;
// Creates and appends a new basic block to the list of basic blocks. // Creates and appends a new basic block to the list of basic blocks.
Ice::CfgNode *InstallNextBasicBlock() { return Func->makeNode(); } Ice::CfgNode *InstallNextBasicBlock() { return Func->makeNode(); }
...@@ -2032,7 +2031,7 @@ public: ...@@ -2032,7 +2031,7 @@ public:
: BlockParserBaseClass(BlockID, FuncParser), FuncParser(FuncParser), : BlockParserBaseClass(BlockID, FuncParser), FuncParser(FuncParser),
NextConstantType(Ice::IceType_void) {} NextConstantType(Ice::IceType_void) {}
~ConstantsParser() LLVM_OVERRIDE {} ~ConstantsParser() override {}
private: private:
// The parser of the function block this constants block appears in. // The parser of the function block this constants block appears in.
...@@ -2040,7 +2039,7 @@ private: ...@@ -2040,7 +2039,7 @@ private:
// The type to use for succeeding constants. // The type to use for succeeding constants.
Ice::Type NextConstantType; Ice::Type NextConstantType;
virtual void ProcessRecord() LLVM_OVERRIDE; void ProcessRecord() override;
Ice::GlobalContext *getContext() { return getTranslator().getContext(); } Ice::GlobalContext *getContext() { return getTranslator().getContext(); }
...@@ -2154,8 +2153,8 @@ private: ...@@ -2154,8 +2153,8 @@ private:
return reinterpret_cast<FunctionParser *>(GetEnclosingParser()); return reinterpret_cast<FunctionParser *>(GetEnclosingParser());
} }
virtual void setValueName(uint64_t Index, StringType &Name) LLVM_OVERRIDE; void setValueName(uint64_t Index, StringType &Name) override;
virtual void setBbName(uint64_t Index, StringType &Name) LLVM_OVERRIDE; void setBbName(uint64_t Index, StringType &Name) override;
// Reports that the assignment of Name to the value associated with // Reports that the assignment of Name to the value associated with
// index is not possible, for the given Context. // index is not possible, for the given Context.
...@@ -2221,7 +2220,7 @@ public: ...@@ -2221,7 +2220,7 @@ public:
: BlockParserBaseClass(BlockID, Context), : BlockParserBaseClass(BlockID, Context),
GlobalAddressNamesAndInitializersInstalled(false) {} GlobalAddressNamesAndInitializersInstalled(false) {}
virtual ~ModuleParser() LLVM_OVERRIDE {} ~ModuleParser() override {}
private: private:
// True if we have already instaledl names for unnamed global addresses, // True if we have already instaledl names for unnamed global addresses,
...@@ -2241,14 +2240,14 @@ private: ...@@ -2241,14 +2240,14 @@ private:
} }
} }
virtual bool ParseBlock(unsigned BlockID) LLVM_OVERRIDE; bool ParseBlock(unsigned BlockID) override;
virtual void ExitBlock() LLVM_OVERRIDE { void ExitBlock() override {
InstallGlobalAddressNamesAndInitializers(); InstallGlobalAddressNamesAndInitializers();
getTranslator().emitConstants(); getTranslator().emitConstants();
} }
virtual void ProcessRecord() LLVM_OVERRIDE; void ProcessRecord() override;
}; };
class ModuleValuesymtabParser : public ValuesymtabParser { class ModuleValuesymtabParser : public ValuesymtabParser {
...@@ -2260,11 +2259,11 @@ public: ...@@ -2260,11 +2259,11 @@ public:
ModuleValuesymtabParser(unsigned BlockID, ModuleParser *MP) ModuleValuesymtabParser(unsigned BlockID, ModuleParser *MP)
: ValuesymtabParser(BlockID, MP) {} : ValuesymtabParser(BlockID, MP) {}
virtual ~ModuleValuesymtabParser() LLVM_OVERRIDE {} ~ModuleValuesymtabParser() override {}
private: private:
virtual void setValueName(uint64_t Index, StringType &Name) LLVM_OVERRIDE; void setValueName(uint64_t Index, StringType &Name) override;
virtual void setBbName(uint64_t Index, StringType &Name) LLVM_OVERRIDE; void setBbName(uint64_t Index, StringType &Name) override;
}; };
void ModuleValuesymtabParser::setValueName(uint64_t Index, StringType &Name) { void ModuleValuesymtabParser::setValueName(uint64_t Index, StringType &Name) {
...@@ -2287,7 +2286,7 @@ void ModuleValuesymtabParser::setBbName(uint64_t Index, StringType &Name) { ...@@ -2287,7 +2286,7 @@ void ModuleValuesymtabParser::setBbName(uint64_t Index, StringType &Name) {
Error(StrBuf.str()); Error(StrBuf.str());
} }
bool ModuleParser::ParseBlock(unsigned BlockID) LLVM_OVERRIDE { bool ModuleParser::ParseBlock(unsigned BlockID) {
switch (BlockID) { switch (BlockID) {
case naclbitc::BLOCKINFO_BLOCK_ID: case naclbitc::BLOCKINFO_BLOCK_ID:
return NaClBitcodeParser::ParseBlock(BlockID); return NaClBitcodeParser::ParseBlock(BlockID);
......
...@@ -157,7 +157,6 @@ protected: ...@@ -157,7 +157,6 @@ protected:
private: private:
uint8_t length_; uint8_t length_;
uint8_t encoding_[6]; uint8_t encoding_[6];
uint8_t padding_;
AssemblerFixup *fixup_; AssemblerFixup *fixup_;
explicit Operand(GPRRegister reg) : fixup_(NULL) { SetModRM(3, reg); } explicit Operand(GPRRegister reg) : fixup_(NULL) { SetModRM(3, reg); }
......
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