diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index d97f8a5b7696..9438ee177576 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -25,6 +25,7 @@ #include "llvm/Target/TargetAsmParser.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" @@ -41,7 +42,7 @@ class ARMOperand; class ARMAsmParser : public TargetAsmParser { MCAsmParser &Parser; - const MCSubtargetInfo *STI; + OwningPtr STI; MCAsmParser &getParser() const { return Parser; } MCAsmLexer &getLexer() const { return Parser.getLexer(); } @@ -128,8 +129,8 @@ class ARMAsmParser : public TargetAsmParser { public: ARMAsmParser(StringRef TT, StringRef CPU, StringRef FS, MCAsmParser &_Parser) - : TargetAsmParser(), Parser(_Parser) { - STI = ARM_MC::createARMMCSubtargetInfo(TT, CPU, FS); + : TargetAsmParser(), Parser(_Parser), + STI(ARM_MC::createARMMCSubtargetInfo(TT, CPU, FS)) { MCAsmParserExtension::Initialize(_Parser); // Initialize the set of available features. diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 5b66a0597225..db6ab33ed68e 100644 --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -19,6 +19,7 @@ #include "llvm/MC/MCParser/MCAsmLexer.h" #include "llvm/MC/MCParser/MCAsmParser.h" #include "llvm/MC/MCParser/MCParsedAsmOperand.h" +#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" @@ -37,7 +38,7 @@ struct X86Operand; class X86ATTAsmParser : public TargetAsmParser { MCAsmParser &Parser; - const MCSubtargetInfo *STI; + OwningPtr STI; private: MCAsmParser &getParser() const { return Parser; } @@ -79,8 +80,8 @@ private: public: X86ATTAsmParser(StringRef TT, StringRef CPU, StringRef FS, MCAsmParser &parser) - : TargetAsmParser(), Parser(parser) { - STI = X86_MC::createX86MCSubtargetInfo(TT, CPU, FS); + : TargetAsmParser(), Parser(parser), + STI(X86_MC::createX86MCSubtargetInfo(TT, CPU, FS)) { // Initialize the set of available features. setAvailableFeatures(ComputeAvailableFeatures(STI->getFeatureBits()));