[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

Test variable renaming committed in https://reviews.llvm.org/rG8e8dd110be5f


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

Argh seems like Phabricator didn't like the fact I linked the revision in a 
different commit. So to see the actual change that got landed as part of this 
you need to visit the history tab.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG41a2d7a37cb1: [lldb][NFC] Build fix: use 
TemplateParameterInfos public APIs instead of… (authored by Michael137).

Changed prior to commit:
  https://reviews.llvm.org/D140030?vs=483759=492631#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

Files:
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1440,10 +1440,12 @@
   clang::TemplateParameterList *template_param_list =
   CreateTemplateParameterList(getASTContext(), template_param_infos,
   ignore);
-  llvm::SmallVector args =
-  template_param_infos.args;
+  llvm::SmallVector args(
+  template_param_infos.GetArgs());
   if (template_param_infos.hasParameterPack()) {
-args.append(template_param_infos.packed_args->args);
+llvm::ArrayRef pack_args =
+template_param_infos.GetParameterPackArgs();
+args.append(pack_args.begin(), pack_args.end());
   }
   std::string str;
   llvm::raw_string_ostream os(str);


Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -1440,10 +1440,12 @@
   clang::TemplateParameterList *template_param_list =
   CreateTemplateParameterList(getASTContext(), template_param_infos,
   ignore);
-  llvm::SmallVector args =
-  template_param_infos.args;
+  llvm::SmallVector args(
+  template_param_infos.GetArgs());
   if (template_param_infos.hasParameterPack()) {
-args.append(template_param_infos.packed_args->args);
+llvm::ArrayRef pack_args =
+template_param_infos.GetParameterPackArgs();
+args.append(pack_args.begin(), pack_args.end());
   }
   std::string str;
   llvm::raw_string_ostream os(str);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

Didn't rebase properly and broke the build
Fixing...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2023-01-26 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

Got landed in 
https://reviews.llvm.org/rGa29e06bbeaad7012ac85b221f1aaba3fe1d5fd35

Forgot about your last comment re. variable names in the tests Pavel. Will 
change in a follow-up commit


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2022-12-19 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

That looks great. I have just one small nit. I think the test would read better 
if you made the names of temporary `TemplateArgument` objects more descriptive 
-- i.e. encode the kind and value information in the name. For example. 
`int47Arg` for an integer template argument whose value is 47, and `intTypeArg` 
for a type template argument (where `int` is the "value").


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2022-12-17 Thread Michael Buch via Phabricator via lldb-commits
Michael137 updated this revision to Diff 483759.
Michael137 added a comment.

- Fix tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  lldb/unittests/Symbol/TestTypeSystemClang.cpp

Index: lldb/unittests/Symbol/TestTypeSystemClang.cpp
===
--- lldb/unittests/Symbol/TestTypeSystemClang.cpp
+++ lldb/unittests/Symbol/TestTypeSystemClang.cpp
@@ -470,11 +470,10 @@
 
 TEST_F(TestTypeSystemClang, TemplateArguments) {
   TypeSystemClang::TemplateParameterInfos infos;
-  infos.names.push_back("T");
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext().IntTy));
-  infos.names.push_back("I");
+  infos.InsertArg("T", TemplateArgument(m_ast->getASTContext().IntTy));
+
   llvm::APSInt arg(llvm::APInt(8, 47));
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(), arg,
+  infos.InsertArg("I", TemplateArgument(m_ast->getASTContext(), arg,
 m_ast->getASTContext().IntTy));
 
   // template struct foo;
@@ -598,126 +597,143 @@
   // The behaviour should follow the C++ rules for redeclaring templates
   // (e.g., parameter names can be changed/omitted.)
 
-  // This describes a class template *instantiation* from which we will infer
-  // the structure of the class template.
-  TypeSystemClang::TemplateParameterInfos infos;
-
   // Test an empty template parameter list: <>
-  ExpectNewTemplate("<>", infos);
+  ExpectNewTemplate("<>", {{}, {}});
+
+  clang::TemplateArgument intArg1(m_ast->getASTContext().IntTy);
+  clang::TemplateArgument intArg2(m_ast->getASTContext(),
+  llvm::APSInt(llvm::APInt(32, 47)),
+  m_ast->getASTContext().IntTy);
+  clang::TemplateArgument floatArg(m_ast->getASTContext().FloatTy);
+  clang::TemplateArgument charArg1(m_ast->getASTContext(),
+   llvm::APSInt(llvm::APInt(8, 47)),
+   m_ast->getASTContext().SignedCharTy);
+
+  clang::TemplateArgument charArg2(m_ast->getASTContext(),
+   llvm::APSInt(llvm::APInt(8, 123)),
+   m_ast->getASTContext().SignedCharTy);
 
   // Test that  with T = int creates a new template.
-  infos.names = {"T"};
-  infos.args = {TemplateArgument(m_ast->getASTContext().IntTy)};
-  ClassTemplateDecl *single_type_arg = ExpectNewTemplate("", infos);
+  ClassTemplateDecl *single_type_arg =
+  ExpectNewTemplate("", {{"T"}, {intArg1}});
 
   // Test that changing the parameter name doesn't create a new class template.
-  infos.names = {"A"};
-  ExpectReusedTemplate(" (A = int)", infos, single_type_arg);
+  ExpectReusedTemplate(" (A = int)", {{"A"}, {intArg1}},
+   single_type_arg);
 
   // Test that changing the used type doesn't create a new class template.
-  infos.args = {TemplateArgument(m_ast->getASTContext().FloatTy)};
-  ExpectReusedTemplate(" (A = float)", infos, single_type_arg);
+  ExpectReusedTemplate(" (A = float)", {{"A"}, {floatArg}},
+   single_type_arg);
 
   // Test that  creates a new template with A = int
   // and I = 47;
-  infos.names.push_back("I");
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(),
-llvm::APSInt(llvm::APInt(8, 47)),
-m_ast->getASTContext().SignedCharTy));
   ClassTemplateDecl *type_and_char_value =
-  ExpectNewTemplate(" (I = 47)", infos);
+  ExpectNewTemplate(" (I = 47)",
+{{"A", "I"}, {floatArg, charArg1}});
 
   // Change the value of the I parameter to 123. The previously created
   // class template should still be reused.
-  infos.args.pop_back();
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(),
-llvm::APSInt(llvm::APInt(8, 123)),
-m_ast->getASTContext().SignedCharTy));
-  ExpectReusedTemplate(" (I = 123)", infos,
-   type_and_char_value);
+  ExpectReusedTemplate(" (I = 123)",
+   {{"A", "I"}, {floatArg, charArg2}}, type_and_char_value);
 
   // Change the type of the I parameter to int so we have .
   // The class template from above can't be reused.
-  infos.args.pop_back();
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(),
-llvm::APSInt(llvm::APInt(32, 47)),
-m_ast->getASTContext().IntTy));
-  ExpectNewTemplate(" (I = 123)", infos);
+  ExpectNewTemplate(" (I = 123)",
+{{"A", "I"}, {floatArg, intArg2}});
 
   // Test a second type 

[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2022-12-15 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.

In D140030#3999199 , @labath wrote:

> I think that test should just be rewritten to not modify the object in such a 
> way. Instead of cumulatively modifying a single object, it could just create 
> a fresh one each time. That will also make it clearer what is being tested.  
> And I think it's fair game to add some constructors to the production object 
> to make that easy.
>
> For example, instead of
>
>   // long sequence of manipulator operations
>   ExpectNewTemplate(" (T = int, long = 1)", infos);
>
> it could do something like
>
>   ExpectNewTemplate(" (T = int, long = 1)",
> TemplateParameterInfos({{"T", intType}}, /*pack_name=*/???, 
> /*pack=*/TemplateParameterInfos(???));

@labath good point, looks much better now. Even found a bug I introduced into 
the test :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2022-12-15 Thread Michael Buch via Phabricator via lldb-commits
Michael137 updated this revision to Diff 483378.
Michael137 added a comment.

- No need for manipulator wrapper. Add constructors instead


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  lldb/unittests/Symbol/TestTypeSystemClang.cpp

Index: lldb/unittests/Symbol/TestTypeSystemClang.cpp
===
--- lldb/unittests/Symbol/TestTypeSystemClang.cpp
+++ lldb/unittests/Symbol/TestTypeSystemClang.cpp
@@ -470,11 +470,10 @@
 
 TEST_F(TestTypeSystemClang, TemplateArguments) {
   TypeSystemClang::TemplateParameterInfos infos;
-  infos.names.push_back("T");
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext().IntTy));
-  infos.names.push_back("I");
+  infos.InsertArg("T", TemplateArgument(m_ast->getASTContext().IntTy));
+
   llvm::APSInt arg(llvm::APInt(8, 47));
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(), arg,
+  infos.InsertArg("I", TemplateArgument(m_ast->getASTContext(), arg,
 m_ast->getASTContext().IntTy));
 
   // template struct foo;
@@ -598,63 +597,60 @@
   // The behaviour should follow the C++ rules for redeclaring templates
   // (e.g., parameter names can be changed/omitted.)
 
-  // This describes a class template *instantiation* from which we will infer
-  // the structure of the class template.
-  TypeSystemClang::TemplateParameterInfos infos;
-
   // Test an empty template parameter list: <>
-  ExpectNewTemplate("<>", infos);
+  ExpectNewTemplate("<>", {{}, {}});
+
+  clang::TemplateArgument intArg1(m_ast->getASTContext().IntTy);
+  clang::TemplateArgument intArg2(m_ast->getASTContext(),
+  llvm::APSInt(llvm::APInt(32, 47)),
+  m_ast->getASTContext().IntTy);
+  clang::TemplateArgument floatArg(m_ast->getASTContext().FloatTy);
+  clang::TemplateArgument charArg1(m_ast->getASTContext(),
+   llvm::APSInt(llvm::APInt(8, 47)),
+   m_ast->getASTContext().SignedCharTy);
+
+  clang::TemplateArgument charArg2(m_ast->getASTContext(),
+   llvm::APSInt(llvm::APInt(8, 123)),
+   m_ast->getASTContext().SignedCharTy);
 
   // Test that  with T = int creates a new template.
-  infos.names = {"T"};
-  infos.args = {TemplateArgument(m_ast->getASTContext().IntTy)};
-  ClassTemplateDecl *single_type_arg = ExpectNewTemplate("", infos);
+  ClassTemplateDecl *single_type_arg =
+  ExpectNewTemplate("", {"T", {intArg1}});
 
   // Test that changing the parameter name doesn't create a new class template.
-  infos.names = {"A"};
-  ExpectReusedTemplate(" (A = int)", infos, single_type_arg);
+  ExpectReusedTemplate(" (A = int)", {"A", {intArg1}},
+   single_type_arg);
 
   // Test that changing the used type doesn't create a new class template.
-  infos.args = {TemplateArgument(m_ast->getASTContext().FloatTy)};
-  ExpectReusedTemplate(" (A = float)", infos, single_type_arg);
+  ExpectReusedTemplate(" (A = float)", {"A", {floatArg}},
+   single_type_arg);
 
   // Test that  creates a new template with A = int
   // and I = 47;
-  infos.names.push_back("I");
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(),
-llvm::APSInt(llvm::APInt(8, 47)),
-m_ast->getASTContext().SignedCharTy));
   ClassTemplateDecl *type_and_char_value =
-  ExpectNewTemplate(" (I = 47)", infos);
+  ExpectNewTemplate(" (I = 47)",
+{{"A", "I"}, {floatArg, charArg1}});
 
   // Change the value of the I parameter to 123. The previously created
   // class template should still be reused.
-  infos.args.pop_back();
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(),
-llvm::APSInt(llvm::APInt(8, 123)),
-m_ast->getASTContext().SignedCharTy));
-  ExpectReusedTemplate(" (I = 123)", infos,
-   type_and_char_value);
+  ExpectReusedTemplate(" (I = 123)",
+   {{"A", "I"}, {floatArg, charArg2}}, type_and_char_value);
 
   // Change the type of the I parameter to int so we have .
   // The class template from above can't be reused.
-  infos.args.pop_back();
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(),
-llvm::APSInt(llvm::APInt(32, 47)),
-m_ast->getASTContext().IntTy));
-  ExpectNewTemplate(" (I = 123)", infos);
+  ExpectNewTemplate(" (I = 123)",
+{{"A", "I"}, {floatArg, 

[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2022-12-15 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I think that test should just be rewritten to not modify the object in such a 
way. Instead of cumulatively modifying a single object, it could just create a 
fresh one each time. That will also make it clearer what is being tested.  And 
I think it's fair game to add some constructors to the production object to 
make that easy.

For example, instead of

  // long sequence of manipulator operations
  ExpectNewTemplate(" (T = int, long = 1)", infos);

it could do something like

  ExpectNewTemplate(" (T = int, long = 1)",
TemplateParameterInfos({{"T", intType}}, /*pack_name=*/???, 
/*pack=*/TemplateParameterInfos(???));


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2022-12-14 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:2067
 
+if (name && !name[0])
+  name = nullptr;

aprantl wrote:
> I wish we had a lazy version of StringRef that computes the length only on 
> demand. How long does template_param_infos live? If it's only temporary, 
> maybe we could just make it store StringRefs?
I think that would be feasible. Though for this NFC change I'd prefer just 
keeping the changes to a minimum. There is this subtle distinction between a 
`nullptr` name and an empty string literal which affects how parameter packs 
are handled. I suspect there's ways to simplify those codepaths and then start 
using `StringRef`s instead. I'll look into it after this patch lands


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2022-12-14 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added inline comments.
This revision is now accepted and ready to land.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:2067
 
+if (name && !name[0])
+  name = nullptr;

I wish we had a lazy version of StringRef that computes the length only on 
demand. How long does template_param_infos live? If it's only temporary, maybe 
we could just make it store StringRefs?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140030/new/

https://reviews.llvm.org/D140030

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D140030: [lldb][TypeSystemClang][NFC] Make TemplateParameterInfos members private

2022-12-14 Thread Michael Buch via Phabricator via lldb-commits
Michael137 created this revision.
Michael137 added reviewers: aprantl, labath.
Herald added a reviewer: shafik.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This patch makes the members of `TemplateParameterInfos` only accessible
via public APIs. The motivation for this is that
`TemplateParameterInfos` attempts to maintain two vectors in tandem
(`args` for the template arguments and `names` for the corresponding
name). Working with this structure as it's currently designed makes
it easy to run into out-of-bounds accesses later down the line.

This patch proposes to introduce a new
`TemplateParameterInfos::InsertArg` which is the only way to
set the `TemplateArgument` and name of an entry and since we
require both to be specified we maintain the vectors in sync
out-of-the-box.

To avoid adding non-const getters just for unit-tests a new
`TemplateParameterInfosManipulatorForTests` is introduced
that can be used to control internal state from tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140030

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  lldb/unittests/Symbol/TestTypeSystemClang.cpp

Index: lldb/unittests/Symbol/TestTypeSystemClang.cpp
===
--- lldb/unittests/Symbol/TestTypeSystemClang.cpp
+++ lldb/unittests/Symbol/TestTypeSystemClang.cpp
@@ -470,11 +470,10 @@
 
 TEST_F(TestTypeSystemClang, TemplateArguments) {
   TypeSystemClang::TemplateParameterInfos infos;
-  infos.names.push_back("T");
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext().IntTy));
-  infos.names.push_back("I");
+  infos.InsertArg("T", TemplateArgument(m_ast->getASTContext().IntTy));
+
   llvm::APSInt arg(llvm::APInt(8, 47));
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(), arg,
+  infos.InsertArg("I", TemplateArgument(m_ast->getASTContext(), arg,
 m_ast->getASTContext().IntTy));
 
   // template struct foo;
@@ -601,27 +600,26 @@
   // This describes a class template *instantiation* from which we will infer
   // the structure of the class template.
   TypeSystemClang::TemplateParameterInfos infos;
+  auto manipulator = infos.GetManipulatorForTests();
 
   // Test an empty template parameter list: <>
   ExpectNewTemplate("<>", infos);
 
   // Test that  with T = int creates a new template.
-  infos.names = {"T"};
-  infos.args = {TemplateArgument(m_ast->getASTContext().IntTy)};
+  infos.InsertArg("T", TemplateArgument(m_ast->getASTContext().IntTy));
   ClassTemplateDecl *single_type_arg = ExpectNewTemplate("", infos);
 
   // Test that changing the parameter name doesn't create a new class template.
-  infos.names = {"A"};
+  manipulator.SetNames({"A"});
   ExpectReusedTemplate(" (A = int)", infos, single_type_arg);
 
   // Test that changing the used type doesn't create a new class template.
-  infos.args = {TemplateArgument(m_ast->getASTContext().FloatTy)};
+  manipulator.SetArgs({TemplateArgument(m_ast->getASTContext().FloatTy)});
   ExpectReusedTemplate(" (A = float)", infos, single_type_arg);
 
   // Test that  creates a new template with A = int
   // and I = 47;
-  infos.names.push_back("I");
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(),
+  infos.InsertArg("I", TemplateArgument(m_ast->getASTContext(),
 llvm::APSInt(llvm::APInt(8, 47)),
 m_ast->getASTContext().SignedCharTy));
   ClassTemplateDecl *type_and_char_value =
@@ -629,31 +627,31 @@
 
   // Change the value of the I parameter to 123. The previously created
   // class template should still be reused.
-  infos.args.pop_back();
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(),
-llvm::APSInt(llvm::APInt(8, 123)),
-m_ast->getASTContext().SignedCharTy));
+  manipulator.PopBackArg();
+  manipulator.PushBackArg(TemplateArgument(
+  m_ast->getASTContext(), llvm::APSInt(llvm::APInt(8, 123)),
+  m_ast->getASTContext().SignedCharTy));
   ExpectReusedTemplate(" (I = 123)", infos,
type_and_char_value);
 
   // Change the type of the I parameter to int so we have .
   // The class template from above can't be reused.
-  infos.args.pop_back();
-  infos.args.push_back(TemplateArgument(m_ast->getASTContext(),
-llvm::APSInt(llvm::APInt(32, 47)),
-m_ast->getASTContext().IntTy));
+  manipulator.PopBackArg();
+  manipulator.PushBackArg(TemplateArgument(m_ast->getASTContext(),
+   llvm::APSInt(llvm::APInt(32, 47)),
+