@@ -47,7 +47,7 @@ static llvm::ArrayRef<syntax::Token> tokens(syntax::Node *N) {
4747class SyntaxTreeTest : public ::testing::Test {
4848protected:
4949 // Build a syntax tree for the code.
50- syntax::TranslationUnit *buildTree (llvm::StringRef Code, StringRef Target ) {
50+ syntax::TranslationUnit *buildTree (llvm::StringRef Code) {
5151 // FIXME: this code is almost the identical to the one in TokensTest. Share
5252 // it.
5353 class BuildSyntaxTree : public ASTConsumer {
@@ -98,9 +98,9 @@ class SyntaxTreeTest : public ::testing::Test {
9898 if (!Diags->getClient ())
9999 Diags->setClient (new IgnoringDiagConsumer);
100100 // Prepare to run a compiler.
101- std::vector<const char *> Args = {" -target " , Target. data () ,
102- " -fsyntax-only " , " -std=c++17 " ,
103- " syntax-test " , FileName};
101+ std::vector<const char *> Args = {" syntax-test " , " -std=c++11 " ,
102+ " -fno-delayed-template-parsing " ,
103+ " -fsyntax-only " , FileName};
104104 Invocation = createInvocationFromCommandLine (Args, Diags, FS);
105105 assert (Invocation);
106106 Invocation->getFrontendOpts ().DisableFree = false ;
@@ -121,29 +121,14 @@ class SyntaxTreeTest : public ::testing::Test {
121121 return Root;
122122 }
123123
124- void expectTreeDumpEqual (StringRef Code, StringRef Tree,
125- bool RunWithDelayedTemplateParsing = true ) {
126- SCOPED_TRACE (Code);
127-
128- std::string Expected = Tree.trim ().str ();
129-
130- // We want to run the test with -fdelayed-template-parsing enabled and
131- // disabled, therefore we use these representative targets that differ in
132- // the default value.
133- // We are not passing -fdelayed-template-parsing directly but we are using
134- // the `-target` to improve coverage and discover differences in behavior
135- // early.
136- for (const StringRef Target :
137- {" x86_64-unknown-unknown" , " x86_64-pc-win32" }) {
138- if (!RunWithDelayedTemplateParsing && Target.equals (" x86_64-pc-win32" )) {
139- continue ;
140- }
141- auto *Root = buildTree (Code, Target);
142- std::string Actual = std::string (StringRef (Root->dump (*Arena)).trim ());
143- EXPECT_EQ (Expected, Actual)
144- << " for target " << Target << " the resulting dump is:\n "
145- << Actual;
146- }
124+ void expectTreeDumpEqual (StringRef code, StringRef tree) {
125+ SCOPED_TRACE (code);
126+
127+ auto *Root = buildTree (code);
128+ std::string Expected = tree.trim ().str ();
129+ std::string Actual =
130+ std::string (llvm::StringRef (Root->dump (*Arena)).trim ());
131+ EXPECT_EQ (Expected, Actual) << " the resulting dump is:\n " << Actual;
147132 }
148133
149134 // Adds a file to the test VFS.
@@ -809,10 +794,7 @@ template <class T> int fun() {}
809794 `-CompoundStatement
810795 |-{
811796 `-}
812- )txt" ,
813- // FIXME: Make this test work on windows by generating the expected Syntax
814- // tree when -fdelayed-template-parsing is active.
815- /* RunWithDelayedTemplateParsing=*/ true );
797+ )txt" );
816798}
817799
818800TEST_F (SyntaxTreeTest, NestedTemplates) {
@@ -1758,7 +1740,7 @@ TEST_F(SyntaxTreeTest, Mutations) {
17581740 auto CheckTransformation = [this ](std::string Input, std::string Expected,
17591741 Transformation Transform) -> void {
17601742 llvm::Annotations Source (Input);
1761- auto *Root = buildTree (Source.code (), " x86_64-unknown-unknown " );
1743+ auto *Root = buildTree (Source.code ());
17621744
17631745 Transform (Source, Root);
17641746
@@ -1796,7 +1778,7 @@ TEST_F(SyntaxTreeTest, Mutations) {
17961778}
17971779
17981780TEST_F (SyntaxTreeTest, SynthesizedNodes) {
1799- buildTree (" " , " x86_64-unknown-unknown " );
1781+ buildTree (" " );
18001782
18011783 auto *C = syntax::createPunctuation (*Arena, tok::comma);
18021784 ASSERT_NE (C, nullptr );
0 commit comments