diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-04-20 22:37:46 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-04-20 22:37:46 +0000 |
commit | 7117d739d630f523aff1338e69019856bbf0d66b (patch) | |
tree | fd0f302d53ba99f9b99222a4a937ed25127a7304 /include | |
parent | f8107eb05111832e4ce4431b33ed08fb371b85ad (diff) | |
download | llvm-7117d739d630f523aff1338e69019856bbf0d66b.tar.gz llvm-7117d739d630f523aff1338e69019856bbf0d66b.tar.bz2 llvm-7117d739d630f523aff1338e69019856bbf0d66b.tar.xz |
Use unique_ptr to handle ownership of synthesized args in DerivedArgList
This might be able to be simplified further by using Arg as a value type
in a linked list (to maintain pointer validity), but here's something
simple to start with.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206724 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Option/ArgList.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/llvm/Option/ArgList.h b/include/llvm/Option/ArgList.h index 6a51900d06..25248f444d 100644 --- a/include/llvm/Option/ArgList.h +++ b/include/llvm/Option/ArgList.h @@ -15,6 +15,7 @@ #include "llvm/Option/OptSpecifier.h" #include "llvm/Option/Option.h" #include <list> +#include <memory> #include <string> #include <vector> @@ -334,7 +335,7 @@ class DerivedArgList : public ArgList { const InputArgList &BaseArgs; /// The list of arguments we synthesized. - mutable arglist_type SynthesizedArgs; + mutable SmallVector<std::unique_ptr<Arg>, 16> SynthesizedArgs; public: /// Construct a new derived arg list from \p BaseArgs. @@ -358,9 +359,7 @@ public: /// AddSynthesizedArg - Add a argument to the list of synthesized arguments /// (to be freed). - void AddSynthesizedArg(Arg *A) { - SynthesizedArgs.push_back(A); - } + void AddSynthesizedArg(Arg *A); const char *MakeArgString(StringRef Str) const override; |