/// The number of original input argument strings.
unsigned NumInputArgStrings;
+ /// Release allocated arguments.
+ void releaseMemory();
+
public:
InputArgList(const char* const *ArgBegin, const char* const *ArgEnd);
- // Default move operations implemented for the convenience of MSVC. Nothing
- // special here.
InputArgList(InputArgList &&RHS)
: ArgList(std::move(RHS)), ArgStrings(std::move(RHS.ArgStrings)),
SynthesizedStrings(std::move(RHS.SynthesizedStrings)),
NumInputArgStrings(RHS.NumInputArgStrings) {}
InputArgList &operator=(InputArgList &&RHS) {
+ releaseMemory();
ArgList::operator=(std::move(RHS));
ArgStrings = std::move(RHS.ArgStrings);
SynthesizedStrings = std::move(RHS.SynthesizedStrings);
NumInputArgStrings = RHS.NumInputArgStrings;
return *this;
}
- ~InputArgList();
+ ~InputArgList() { releaseMemory(); }
const char *getArgString(unsigned Index) const override {
return ArgStrings[Index];
//
+void InputArgList::releaseMemory() {
+ // An InputArgList always owns its arguments.
+ for (Arg *A : *this)
+ delete A;
+}
+
InputArgList::InputArgList(const char* const *ArgBegin,
const char* const *ArgEnd)
: NumInputArgStrings(ArgEnd - ArgBegin) {
ArgStrings.append(ArgBegin, ArgEnd);
}
-InputArgList::~InputArgList() {
- // An InputArgList always owns its arguments.
- for (iterator it = begin(), ie = end(); it != ie; ++it)
- delete *it;
-}
-
unsigned InputArgList::MakeIndex(StringRef String0) const {
unsigned Index = ArgStrings.size();