Rename APIs in unittests/AST/Language.h in preparation to share them
Summary:
Declaring these helpers in the ast_matcher namespace in the clangAST
unit test seems inappropriate -- neither these helpers, nor clangAST have
anything to do with AST matchers. Therefore, I moved these helpers to
the clang namespace.
Declaring another typedef called "ArgVector" is not a good idea -- we
already have both "ArgVector", "ArgsVector", and "ArgList". I expanded
it into the underlying type.
Declaring another enum called "Language" is not a good idea because we
arleady have the "clang::Language" enum. I renamed it to
"TestLanguage".
Similarly, I renamed "getBasicRunOptionsForLanguage" to
"getCommandLineArgsForTesting" to explain the semantics better (what are
"run options"?) and not repeat types in the function name
("ForLanguage").
Reviewers: shafik, rengolin, sammccall
Reviewed By: sammccall
Subscribers: gribozavr2, sammccall, martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D80786
diff --git a/clang/unittests/AST/ASTImporterVisibilityTest.cpp b/clang/unittests/AST/ASTImporterVisibilityTest.cpp
index 00a307b..2624024 100644
--- a/clang/unittests/AST/ASTImporterVisibilityTest.cpp
+++ b/clang/unittests/AST/ASTImporterVisibilityTest.cpp
@@ -96,8 +96,8 @@
// First value in tuple: Compile options.
// Second value in tuple: Source code to be used in the test.
-using ImportVisibilityChainParams =
- ::testing::WithParamInterface<std::tuple<ArgVector, const char *>>;
+using ImportVisibilityChainParams = ::testing::WithParamInterface<
+ std::tuple<std::vector<std::string>, const char *>>;
// Fixture to test the redecl chain of Decls with the same visibility. Gtest
// makes it possible to have either value-parameterized or type-parameterized
// fixtures. However, we cannot have both value- and type-parameterized test
@@ -109,7 +109,9 @@
: public ASTImporterTestBase, public ImportVisibilityChainParams {
protected:
using DeclTy = typename PatternFactory::DeclTy;
- ArgVector getExtraArgs() const override { return std::get<0>(GetParam()); }
+ std::vector<std::string> getExtraArgs() const override {
+ return std::get<0>(GetParam());
+ }
std::string getCode() const { return std::get<1>(GetParam()); }
BindableMatcher<Decl> getPattern() const { return PatternFactory()(); }
@@ -222,8 +224,8 @@
// functions are expected to be linked in a declaration chain.
// One value of this tuple is combined with every value of compile options.
// The test can have a single tuple as parameter only.
-using ImportVisibilityParams = ::testing::WithParamInterface<
- std::tuple<ArgVector, std::tuple<const char *, const char *, bool>>>;
+using ImportVisibilityParams = ::testing::WithParamInterface<std::tuple<
+ std::vector<std::string>, std::tuple<const char *, const char *, bool>>>;
template <typename PatternFactory>
class ImportVisibility
@@ -231,7 +233,9 @@
public ImportVisibilityParams {
protected:
using DeclTy = typename PatternFactory::DeclTy;
- ArgVector getExtraArgs() const override { return std::get<0>(GetParam()); }
+ std::vector<std::string> getExtraArgs() const override {
+ return std::get<0>(GetParam());
+ }
std::string getCode0() const { return std::get<0>(std::get<1>(GetParam())); }
std::string getCode1() const { return std::get<1>(std::get<1>(GetParam())); }
bool shouldBeLinked() const { return std::get<2>(std::get<1>(GetParam())); }