diff options
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.h')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/llvm/lib/AsmParser/LLParser.h b/llvm/lib/AsmParser/LLParser.h index 0c066f4b603..a67c3f5b0db 100644 --- a/llvm/lib/AsmParser/LLParser.h +++ b/llvm/lib/AsmParser/LLParser.h @@ -55,22 +55,24 @@ namespace llvm { t_InlineAsm, // Value in FTy/StrVal/StrVal2/UIntVal. t_ConstantStruct, // Value in ConstantStructElts. t_PackedConstantStruct // Value in ConstantStructElts. - } Kind; + } Kind = t_LocalID; LLLexer::LocTy Loc; unsigned UIntVal; FunctionType *FTy; std::string StrVal, StrVal2; APSInt APSIntVal; - APFloat APFloatVal; + APFloat APFloatVal{0.0}; Constant *ConstantVal; - Constant **ConstantStructElts; - - ValID() : Kind(t_LocalID), APFloatVal(0.0) {} - ~ValID() { - if (Kind == t_ConstantStruct || Kind == t_PackedConstantStruct) - delete [] ConstantStructElts; - } + std::unique_ptr<Constant *[]> ConstantStructElts; + + ValID() = default; + ValID(ValID &&RHS) + : Kind(RHS.Kind), Loc(RHS.Loc), UIntVal(RHS.UIntVal), FTy(RHS.FTy), + StrVal(std::move(RHS.StrVal)), StrVal2(std::move(RHS.StrVal2)), + APSIntVal(std::move(RHS.APSIntVal)), + APFloatVal(std::move(RHS.APFloatVal)), ConstantVal(RHS.ConstantVal), + ConstantStructElts(std::move(RHS.ConstantStructElts)) {} bool operator<(const ValID &RHS) const { if (Kind == t_LocalID || Kind == t_GlobalID) |