diff --git a/clang/unittests/AST/ASTImporterFixtures.h b/clang/unittests/AST/ASTImporterFixtures.h --- a/clang/unittests/AST/ASTImporterFixtures.h +++ b/clang/unittests/AST/ASTImporterFixtures.h @@ -52,13 +52,14 @@ class CompilerOptionSpecificTest : public ::testing::Test { protected: // Return the extra arguments appended to runtime options at compilation. - virtual ArgVector getExtraArgs() const { return ArgVector(); } + virtual std::vector getExtraArgs() const { return {}; } // Returns the argument vector used for a specific language option, this set // can be tweaked by the test parameters. - ArgVector getArgVectorForLanguage(Language Lang) const { - ArgVector Args = getBasicRunOptionsForLanguage(Lang); - ArgVector ExtraArgs = getExtraArgs(); + std::vector + getCommandLineArgsForLanguage(TestLanguage Lang) const { + std::vector Args = getCommandLineArgsForTesting(Lang); + std::vector ExtraArgs = getExtraArgs(); for (const auto &Arg : ExtraArgs) { Args.push_back(Arg); } @@ -66,10 +67,13 @@ } }; -const auto DefaultTestArrayForRunOptions = std::array{ - {ArgVector(), ArgVector{"-fdelayed-template-parsing"}, - ArgVector{"-fms-compatibility"}, - ArgVector{"-fdelayed-template-parsing", "-fms-compatibility"}}}; +const auto DefaultTestArrayForRunOptions = + std::array, 4>{ + {std::vector(), + std::vector{"-fdelayed-template-parsing"}, + std::vector{"-fms-compatibility"}, + std::vector{"-fdelayed-template-parsing", + "-fms-compatibility"}}}; const auto DefaultTestValuesForRunOptions = ::testing::ValuesIn(DefaultTestArrayForRunOptions); @@ -111,7 +115,7 @@ ImporterConstructor Creator; ASTImporter::ODRHandlingType ODRHandling; - TU(StringRef Code, StringRef FileName, ArgVector Args, + TU(StringRef Code, StringRef FileName, std::vector Args, ImporterConstructor C = ImporterConstructor(), ASTImporter::ODRHandlingType ODRHandling = ASTImporter::ODRHandlingType::Conservative); @@ -141,7 +145,8 @@ // Initialize the shared state if not initialized already. void lazyInitSharedState(TranslationUnitDecl *ToTU); - void lazyInitToAST(Language ToLang, StringRef ToSrcCode, StringRef FileName); + void lazyInitToAST(TestLanguage ToLang, StringRef ToSrcCode, + StringRef FileName); protected: std::shared_ptr SharedStatePtr; @@ -157,32 +162,33 @@ // of the identifier into the To context. // Must not be called more than once within the same test. std::tuple - getImportedDecl(StringRef FromSrcCode, Language FromLang, StringRef ToSrcCode, - Language ToLang, StringRef Identifier = DeclToImportID); + getImportedDecl(StringRef FromSrcCode, TestLanguage FromLang, + StringRef ToSrcCode, TestLanguage ToLang, + StringRef Identifier = DeclToImportID); // Creates a TU decl for the given source code which can be used as a From // context. May be called several times in a given test (with different file // name). - TranslationUnitDecl *getTuDecl(StringRef SrcCode, Language Lang, + TranslationUnitDecl *getTuDecl(StringRef SrcCode, TestLanguage Lang, StringRef FileName = "input.cc"); // Creates the To context with the given source code and returns the TU decl. - TranslationUnitDecl *getToTuDecl(StringRef ToSrcCode, Language ToLang); + TranslationUnitDecl *getToTuDecl(StringRef ToSrcCode, TestLanguage ToLang); // Import the given Decl into the ToCtx. // May be called several times in a given test. // The different instances of the param From may have different ASTContext. - Decl *Import(Decl *From, Language ToLang); + Decl *Import(Decl *From, TestLanguage ToLang); - template DeclT *Import(DeclT *From, Language Lang) { + template DeclT *Import(DeclT *From, TestLanguage Lang) { return cast_or_null(Import(cast(From), Lang)); } // Import the given Decl into the ToCtx. // Same as Import but returns the result of the import which can be an error. - llvm::Expected importOrError(Decl *From, Language ToLang); + llvm::Expected importOrError(Decl *From, TestLanguage ToLang); - QualType ImportType(QualType FromType, Decl *TUDecl, Language ToLang); + QualType ImportType(QualType FromType, Decl *TUDecl, TestLanguage ToLang); ASTImporterTestBase() : ODRHandling(ASTImporter::ODRHandlingType::Conservative) {} @@ -191,9 +197,9 @@ class ASTImporterOptionSpecificTestBase : public ASTImporterTestBase, - public ::testing::WithParamInterface { + public ::testing::WithParamInterface> { protected: - ArgVector getExtraArgs() const override { return GetParam(); } + std::vector getExtraArgs() const override { return GetParam(); } }; template diff --git a/clang/unittests/AST/ASTImporterFixtures.cpp b/clang/unittests/AST/ASTImporterFixtures.cpp --- a/clang/unittests/AST/ASTImporterFixtures.cpp +++ b/clang/unittests/AST/ASTImporterFixtures.cpp @@ -38,7 +38,8 @@ llvm::MemoryBuffer::getMemBuffer(Code)); } -ASTImporterTestBase::TU::TU(StringRef Code, StringRef FileName, ArgVector Args, +ASTImporterTestBase::TU::TU(StringRef Code, StringRef FileName, + std::vector Args, ImporterConstructor C, ASTImporter::ODRHandlingType ODRHandling) : Code(std::string(Code)), FileName(std::string(FileName)), @@ -112,11 +113,12 @@ SharedStatePtr = std::make_shared(*ToTU); } -void ASTImporterTestBase::lazyInitToAST(Language ToLang, StringRef ToSrcCode, +void ASTImporterTestBase::lazyInitToAST(TestLanguage ToLang, + StringRef ToSrcCode, StringRef FileName) { if (ToAST) return; - ArgVector ToArgs = getArgVectorForLanguage(ToLang); + std::vector ToArgs = getCommandLineArgsForLanguage(ToLang); // Source code must be a valid live buffer through the tests lifetime. ToCode = std::string(ToSrcCode); // Build the AST from an empty file. @@ -136,12 +138,11 @@ return &*It; } -std::tuple -ASTImporterTestBase::getImportedDecl(StringRef FromSrcCode, Language FromLang, - StringRef ToSrcCode, Language ToLang, - StringRef Identifier) { - ArgVector FromArgs = getArgVectorForLanguage(FromLang), - ToArgs = getArgVectorForLanguage(ToLang); +std::tuple ASTImporterTestBase::getImportedDecl( + StringRef FromSrcCode, TestLanguage FromLang, StringRef ToSrcCode, + TestLanguage ToLang, StringRef Identifier) { + std::vector FromArgs = getCommandLineArgsForLanguage(FromLang); + std::vector ToArgs = getCommandLineArgsForLanguage(ToLang); FromTUs.emplace_back(FromSrcCode, InputFileName, FromArgs, Creator, ODRHandling); @@ -170,13 +171,13 @@ } TranslationUnitDecl *ASTImporterTestBase::getTuDecl(StringRef SrcCode, - Language Lang, + TestLanguage Lang, StringRef FileName) { assert(llvm::find_if(FromTUs, [FileName](const TU &E) { return E.FileName == FileName; }) == FromTUs.end()); - ArgVector Args = getArgVectorForLanguage(Lang); + std::vector Args = getCommandLineArgsForLanguage(Lang); FromTUs.emplace_back(SrcCode, FileName, Args, Creator, ODRHandling); TU &Tu = FromTUs.back(); @@ -184,14 +185,14 @@ } TranslationUnitDecl *ASTImporterTestBase::getToTuDecl(StringRef ToSrcCode, - Language ToLang) { - ArgVector ToArgs = getArgVectorForLanguage(ToLang); + TestLanguage ToLang) { + std::vector ToArgs = getCommandLineArgsForLanguage(ToLang); assert(!ToAST); lazyInitToAST(ToLang, ToSrcCode, OutputFileName); return ToAST->getASTContext().getTranslationUnitDecl(); } -Decl *ASTImporterTestBase::Import(Decl *From, Language ToLang) { +Decl *ASTImporterTestBase::Import(Decl *From, TestLanguage ToLang) { lazyInitToAST(ToLang, "", OutputFileName); TU *FromTU = findFromTU(From); assert(SharedStatePtr); @@ -200,7 +201,7 @@ } llvm::Expected ASTImporterTestBase::importOrError(Decl *From, - Language ToLang) { + TestLanguage ToLang) { lazyInitToAST(ToLang, "", OutputFileName); TU *FromTU = findFromTU(From); assert(SharedStatePtr); @@ -210,7 +211,7 @@ } QualType ASTImporterTestBase::ImportType(QualType FromType, Decl *TUDecl, - Language ToLang) { + TestLanguage ToLang) { lazyInitToAST(ToLang, "", OutputFileName); TU *FromTU = findFromTU(TUDecl); assert(SharedStatePtr); diff --git a/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp b/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp --- a/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp +++ b/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp @@ -37,7 +37,7 @@ BindableMatcher getPattern() { return functionDecl(hasName("X"), unless(isImplicit())); } - Language getLang() { return Lang_C; } + TestLanguage getLang() { return Lang_C; } }; struct Typedef { @@ -45,7 +45,7 @@ static constexpr auto *Definition = "typedef int X;"; static constexpr auto *ConflictingDefinition = "typedef double X;"; BindableMatcher getPattern() { return typedefNameDecl(hasName("X")); } - Language getLang() { return Lang_CXX; } + TestLanguage getLang() { return Lang_CXX; } }; struct TypedefAlias { @@ -53,7 +53,7 @@ static constexpr auto *Definition = "using X = int;"; static constexpr auto *ConflictingDefinition = "using X = double;"; BindableMatcher getPattern() { return typedefNameDecl(hasName("X")); } - Language getLang() { return Lang_CXX11; } + TestLanguage getLang() { return Lang_CXX11; } }; struct Enum { @@ -61,7 +61,7 @@ static constexpr auto *Definition = "enum X { a, b };"; static constexpr auto *ConflictingDefinition = "enum X { a, b, c };"; BindableMatcher getPattern() { return enumDecl(hasName("X")); } - Language getLang() { return Lang_CXX; } + TestLanguage getLang() { return Lang_CXX; } }; struct EnumClass { @@ -69,7 +69,7 @@ static constexpr auto *Definition = "enum class X { a, b };"; static constexpr auto *ConflictingDefinition = "enum class X { a, b, c };"; BindableMatcher getPattern() { return enumDecl(hasName("X")); } - Language getLang() { return Lang_CXX11; } + TestLanguage getLang() { return Lang_CXX11; } }; struct EnumConstant { @@ -77,7 +77,7 @@ static constexpr auto *Definition = "enum E { X = 0 };"; static constexpr auto *ConflictingDefinition = "enum E { X = 1 };"; BindableMatcher getPattern() { return enumConstantDecl(hasName("X")); } - Language getLang() { return Lang_CXX; } + TestLanguage getLang() { return Lang_CXX; } }; struct Class { @@ -88,7 +88,7 @@ BindableMatcher getPattern() { return cxxRecordDecl(hasName("X"), unless(isImplicit())); } - Language getLang() { return Lang_CXX; } + TestLanguage getLang() { return Lang_CXX; } }; struct Variable { @@ -98,7 +98,7 @@ static constexpr auto *Definition = "int X;"; static constexpr auto *ConflictingDefinition = "float X;"; BindableMatcher getPattern() { return varDecl(hasName("X")); } - Language getLang() { return Lang_CXX; } + TestLanguage getLang() { return Lang_CXX; } }; struct ClassTemplate { @@ -112,7 +112,7 @@ BindableMatcher getPattern() { return classTemplateDecl(hasName("X"), unless(isImplicit())); } - Language getLang() { return Lang_CXX; } + TestLanguage getLang() { return Lang_CXX; } }; struct FunctionTemplate { @@ -133,7 +133,7 @@ } static std::string getDef0() { return Definition0; } static std::string getDef1() { return Definition1; } - Language getLang() { return Lang_CXX; } + TestLanguage getLang() { return Lang_CXX; } }; static const internal::VariadicDynCastAllOfMatcher @@ -152,7 +152,7 @@ constexpr int X = 0; )"; BindableMatcher getPattern() { return varTemplateDecl(hasName("X")); } - Language getLang() { return Lang_CXX14; } + TestLanguage getLang() { return Lang_CXX14; } }; struct ClassTemplateSpec { @@ -175,7 +175,7 @@ BindableMatcher getPattern() { return classTemplateSpecializationDecl(hasName("X"), unless(isImplicit())); } - Language getLang() { return Lang_CXX; } + TestLanguage getLang() { return Lang_CXX; } }; // Function template specializations are all "full" specializations. @@ -208,7 +208,7 @@ } static std::string getDef0() { return Definition0; } static std::string getDef1() { return Definition1; } - Language getLang() { return Lang_CXX; } + TestLanguage getLang() { return Lang_CXX; } }; static const internal::VariadicDynCastAllOfMatcher< @@ -230,7 +230,7 @@ BindableMatcher getPattern() { return varTemplateSpecializationDecl(hasName("X"), unless(isImplicit())); } - Language getLang() { return Lang_CXX14; } + TestLanguage getLang() { return Lang_CXX14; } }; template @@ -252,7 +252,7 @@ return TypeParam::ConflictingProtoDef; } static BindableMatcher getPattern() { return TypeParam().getPattern(); } - static Language getLang() { return TypeParam().getLang(); } + static TestLanguage getLang() { return TypeParam().getLang(); } template &, Decl *, Decl *)> diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -28,8 +28,9 @@ using llvm::StringMap; // Base class for those tests which use the family of `testImport` functions. -class TestImportBase : public CompilerOptionSpecificTest, - public ::testing::WithParamInterface { +class TestImportBase + : public CompilerOptionSpecificTest, + public ::testing::WithParamInterface> { template llvm::Expected importNode(ASTUnit *From, ASTUnit *To, @@ -62,8 +63,9 @@ template testing::AssertionResult - testImport(const std::string &FromCode, const ArgVector &FromArgs, - const std::string &ToCode, const ArgVector &ToArgs, + testImport(const std::string &FromCode, + const std::vector &FromArgs, + const std::string &ToCode, const std::vector &ToArgs, MatchVerifier &Verifier, const BindableMatcher &SearchMatcher, const BindableMatcher &VerificationMatcher) { @@ -110,8 +112,9 @@ template testing::AssertionResult - testImport(const std::string &FromCode, const ArgVector &FromArgs, - const std::string &ToCode, const ArgVector &ToArgs, + testImport(const std::string &FromCode, + const std::vector &FromArgs, + const std::string &ToCode, const std::vector &ToArgs, MatchVerifier &Verifier, const BindableMatcher &VerificationMatcher) { return testImport( @@ -122,7 +125,7 @@ } protected: - ArgVector getExtraArgs() const override { return GetParam(); } + std::vector getExtraArgs() const override { return GetParam(); } public: @@ -130,12 +133,12 @@ /// of "FromCode" virtual file is imported to "ToCode" virtual file. /// The verification is done by running AMatcher over the imported node. template - void testImport(const std::string &FromCode, Language FromLang, - const std::string &ToCode, Language ToLang, + void testImport(const std::string &FromCode, TestLanguage FromLang, + const std::string &ToCode, TestLanguage ToLang, MatchVerifier &Verifier, const MatcherType &AMatcher) { - ArgVector FromArgs = getArgVectorForLanguage(FromLang), - ToArgs = getArgVectorForLanguage(ToLang); + std::vector FromArgs = getCommandLineArgsForLanguage(FromLang); + std::vector ToArgs = getCommandLineArgsForLanguage(ToLang); EXPECT_TRUE( testImport(FromCode, FromArgs, ToCode, ToArgs, Verifier, AMatcher)); } @@ -162,14 +165,14 @@ struct CodeEntry { std::string CodeSample; - Language Lang; + TestLanguage Lang; }; using CodeFiles = StringMap; /// Builds an ASTUnit for one potential compile options set. SingleASTUnit createASTUnit(StringRef FileName, const CodeEntry &CE) const { - ArgVector Args = getArgVectorForLanguage(CE.Lang); + std::vector Args = getCommandLineArgsForLanguage(CE.Lang); auto AST = tooling::buildASTFromCodeWithArgs(CE.CodeSample, Args, FileName); EXPECT_TRUE(AST.get()); return AST; @@ -5523,14 +5526,14 @@ } INSTANTIATE_TEST_CASE_P(ParameterizedTests, SVEBuiltins, - ::testing::Values(ArgVector{"-target", - "aarch64-linux-gnu"}), ); + ::testing::Values(std::vector{ + "-target", "aarch64-linux-gnu"}), ); INSTANTIATE_TEST_CASE_P(ParameterizedTests, DeclContextTest, - ::testing::Values(ArgVector()), ); + ::testing::Values(std::vector()), ); INSTANTIATE_TEST_CASE_P(ParameterizedTests, CanonicalRedeclChain, - ::testing::Values(ArgVector()), ); + ::testing::Values(std::vector()), ); TEST_P(ASTImporterOptionSpecificTestBase, LambdasAreDifferentiated) { Decl *FromTU = getTuDecl( @@ -5982,9 +5985,9 @@ } template -auto ExtendWithOptions(const T &Values, const ArgVector &Args) { +auto ExtendWithOptions(const T &Values, const std::vector &Args) { auto Copy = Values; - for (ArgVector &ArgV : Copy) { + for (std::vector &ArgV : Copy) { for (const std::string &Arg : Args) { ArgV.push_back(Arg); } @@ -6056,14 +6059,15 @@ DefaultTestValuesForRunOptions, ); INSTANTIATE_TEST_CASE_P(ParameterizedTests, ImportPath, - ::testing::Values(ArgVector()), ); + ::testing::Values(std::vector()), ); INSTANTIATE_TEST_CASE_P(ParameterizedTests, ImportExpr, DefaultTestValuesForRunOptions, ); INSTANTIATE_TEST_CASE_P(ParameterizedTests, ImportFixedPointExpr, ExtendWithOptions(DefaultTestArrayForRunOptions, - ArgVector{"-ffixed-point"}), ); + std::vector{ + "-ffixed-point"}), ); INSTANTIATE_TEST_CASE_P(ParameterizedTests, ImportType, DefaultTestValuesForRunOptions, ); diff --git a/clang/unittests/AST/ASTImporterVisibilityTest.cpp b/clang/unittests/AST/ASTImporterVisibilityTest.cpp --- 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>; +using ImportVisibilityChainParams = ::testing::WithParamInterface< + std::tuple, 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 getExtraArgs() const override { + return std::get<0>(GetParam()); + } std::string getCode() const { return std::get<1>(GetParam()); } BindableMatcher 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>>; +using ImportVisibilityParams = ::testing::WithParamInterface, std::tuple>>; template 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 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())); } diff --git a/clang/unittests/AST/Language.h b/clang/unittests/AST/Language.h --- a/clang/unittests/AST/Language.h +++ b/clang/unittests/AST/Language.h @@ -13,30 +13,25 @@ #ifndef LLVM_CLANG_UNITTESTS_AST_LANGUAGE_H #define LLVM_CLANG_UNITTESTS_AST_LANGUAGE_H -#include "llvm/Support/ErrorHandling.h" #include #include namespace clang { -namespace ast_matchers { -typedef std::vector ArgVector; - -enum Language { - Lang_C, - Lang_C89, - Lang_CXX, - Lang_CXX11, - Lang_CXX14, - Lang_CXX17, - Lang_CXX2a, - Lang_OpenCL, - Lang_OBJCXX +enum TestLanguage { + Lang_C, + Lang_C89, + Lang_CXX, + Lang_CXX11, + Lang_CXX14, + Lang_CXX17, + Lang_CXX2a, + Lang_OpenCL, + Lang_OBJCXX }; -ArgVector getBasicRunOptionsForLanguage(Language Lang); +std::vector getCommandLineArgsForTesting(TestLanguage Lang); -} // end namespace ast_matchers } // end namespace clang #endif diff --git a/clang/unittests/AST/Language.cpp b/clang/unittests/AST/Language.cpp --- a/clang/unittests/AST/Language.cpp +++ b/clang/unittests/AST/Language.cpp @@ -11,43 +11,42 @@ //===----------------------------------------------------------------------===// #include "Language.h" +#include "llvm/Support/ErrorHandling.h" namespace clang { -namespace ast_matchers { -ArgVector getBasicRunOptionsForLanguage(Language Lang) { - ArgVector BasicArgs; +std::vector getCommandLineArgsForTesting(TestLanguage Lang) { + std::vector Args; // Test with basic arguments. switch (Lang) { case Lang_C: - BasicArgs = {"-x", "c", "-std=c99"}; + Args = {"-x", "c", "-std=c99"}; break; case Lang_C89: - BasicArgs = {"-x", "c", "-std=c89"}; + Args = {"-x", "c", "-std=c89"}; break; case Lang_CXX: - BasicArgs = {"-std=c++98", "-frtti"}; + Args = {"-std=c++98", "-frtti"}; break; case Lang_CXX11: - BasicArgs = {"-std=c++11", "-frtti"}; + Args = {"-std=c++11", "-frtti"}; break; case Lang_CXX14: - BasicArgs = {"-std=c++14", "-frtti"}; + Args = {"-std=c++14", "-frtti"}; break; case Lang_CXX17: - BasicArgs = {"-std=c++17", "-frtti"}; + Args = {"-std=c++17", "-frtti"}; break; case Lang_CXX2a: - BasicArgs = {"-std=c++2a", "-frtti"}; + Args = {"-std=c++2a", "-frtti"}; break; case Lang_OBJCXX: - BasicArgs = {"-x", "objective-c++", "-frtti"}; + Args = {"-x", "objective-c++", "-frtti"}; break; case Lang_OpenCL: llvm_unreachable("Not implemented yet!"); } - return BasicArgs; + return Args; } -} // end namespace ast_matchers } // end namespace clang diff --git a/clang/unittests/AST/MatchVerifier.h b/clang/unittests/AST/MatchVerifier.h --- a/clang/unittests/AST/MatchVerifier.h +++ b/clang/unittests/AST/MatchVerifier.h @@ -41,17 +41,15 @@ template testing::AssertionResult match(const std::string &Code, - const MatcherType &AMatcher, - Language L) { + const MatcherType &AMatcher, TestLanguage L) { std::vector Args; return match(Code, AMatcher, Args, L); } template - testing::AssertionResult match(const std::string &Code, - const MatcherType &AMatcher, - std::vector& Args, - Language L); + testing::AssertionResult + match(const std::string &Code, const MatcherType &AMatcher, + std::vector &Args, TestLanguage L); template testing::AssertionResult match(const Decl *D, const MatcherType &AMatcher); @@ -77,10 +75,12 @@ /// \brief Runs a matcher over some code, and returns the result of the /// verifier for the matched node. -template template -testing::AssertionResult MatchVerifier::match( - const std::string &Code, const MatcherType &AMatcher, - std::vector& Args, Language L) { +template +template +testing::AssertionResult +MatchVerifier::match(const std::string &Code, + const MatcherType &AMatcher, + std::vector &Args, TestLanguage L) { MatchFinder Finder; Finder.addMatcher(AMatcher.bind(""), this); std::unique_ptr Factory( diff --git a/clang/unittests/AST/StructuralEquivalenceTest.cpp b/clang/unittests/AST/StructuralEquivalenceTest.cpp --- a/clang/unittests/AST/StructuralEquivalenceTest.cpp +++ b/clang/unittests/AST/StructuralEquivalenceTest.cpp @@ -23,12 +23,13 @@ // snippets. To determine the returned node, a separate matcher is specified // for both snippets. The first matching node is returned. template - std::tuple makeDecls( - const std::string &SrcCode0, const std::string &SrcCode1, Language Lang, - const MatcherType &Matcher0, const MatcherType &Matcher1) { + std::tuple + makeDecls(const std::string &SrcCode0, const std::string &SrcCode1, + TestLanguage Lang, const MatcherType &Matcher0, + const MatcherType &Matcher1) { this->Code0 = SrcCode0; this->Code1 = SrcCode1; - ArgVector Args = getBasicRunOptionsForLanguage(Lang); + std::vector Args = getCommandLineArgsForTesting(Lang); const char *const InputFileName = "input.cc"; @@ -43,11 +44,12 @@ return std::make_tuple(D0, D1); } - std::tuple makeTuDecls( - const std::string &SrcCode0, const std::string &SrcCode1, Language Lang) { + std::tuple + makeTuDecls(const std::string &SrcCode0, const std::string &SrcCode1, + TestLanguage Lang) { this->Code0 = SrcCode0; this->Code1 = SrcCode1; - ArgVector Args = getBasicRunOptionsForLanguage(Lang); + std::vector Args = getCommandLineArgsForTesting(Lang); const char *const InputFileName = "input.cc"; @@ -61,9 +63,9 @@ // Get a pair of node pointers into the synthesized AST from the given code // snippets. The same matcher is used for both snippets. template - std::tuple makeDecls( - const std::string &SrcCode0, const std::string &SrcCode1, Language Lang, - const MatcherType &AMatcher) { + std::tuple + makeDecls(const std::string &SrcCode0, const std::string &SrcCode1, + TestLanguage Lang, const MatcherType &AMatcher) { return makeDecls( SrcCode0, SrcCode1, Lang, AMatcher, AMatcher); } @@ -71,9 +73,9 @@ // Get a pair of Decl pointers to the synthesized declarations from the given // code snippets. We search for the first NamedDecl with given name in both // snippets. - std::tuple makeNamedDecls( - const std::string &SrcCode0, const std::string &SrcCode1, - Language Lang, const char *const Identifier = "foo") { + std::tuple + makeNamedDecls(const std::string &SrcCode0, const std::string &SrcCode1, + TestLanguage Lang, const char *const Identifier = "foo") { auto Matcher = namedDecl(hasName(Identifier)); return makeDecls(SrcCode0, SrcCode1, Lang, Matcher); }