[clang] 9967352 - Revert "[Syntax] Test both the default and windows target platforms in unittests"
Dmitri Gribenko via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 20 04:16:33 PDT 2020
Author: Dmitri Gribenko
Date: 2020-03-20T12:13:49+01:00
New Revision: 9967352a0346021d389afb6e3283d0c58911a560
URL: https://github.com/llvm/llvm-project/commit/9967352a0346021d389afb6e3283d0c58911a560
DIFF: https://github.com/llvm/llvm-project/commit/9967352a0346021d389afb6e3283d0c58911a560.diff
LOG: Revert "[Syntax] Test both the default and windows target platforms in unittests"
This reverts commit fd7300f717c18c861e77685efe6f16f12fb63ae7. The fix
in this patch didn't help and the Windows buildbot broke:
http://45.33.8.238/win/10881/step_7.txt
Added:
Modified:
clang/unittests/Tooling/Syntax/TreeTest.cpp
Removed:
################################################################################
diff --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp b/clang/unittests/Tooling/Syntax/TreeTest.cpp
index fc9967f39911..17b1f2274537 100644
--- a/clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -47,7 +47,7 @@ static llvm::ArrayRef<syntax::Token> tokens(syntax::Node *N) {
class SyntaxTreeTest : public ::testing::Test {
protected:
// Build a syntax tree for the code.
- syntax::TranslationUnit *buildTree(llvm::StringRef Code, StringRef Target) {
+ syntax::TranslationUnit *buildTree(llvm::StringRef Code) {
// FIXME: this code is almost the identical to the one in TokensTest. Share
// it.
class BuildSyntaxTree : public ASTConsumer {
@@ -98,9 +98,9 @@ class SyntaxTreeTest : public ::testing::Test {
if (!Diags->getClient())
Diags->setClient(new IgnoringDiagConsumer);
// Prepare to run a compiler.
- std::vector<const char *> Args = {"-target", Target.data(),
- "-fsyntax-only", "-std=c++17",
- "syntax-test", FileName};
+ std::vector<const char *> Args = {"syntax-test", "-std=c++11",
+ "-fno-delayed-template-parsing",
+ "-fsyntax-only", FileName};
Invocation = createInvocationFromCommandLine(Args, Diags, FS);
assert(Invocation);
Invocation->getFrontendOpts().DisableFree = false;
@@ -121,29 +121,14 @@ class SyntaxTreeTest : public ::testing::Test {
return Root;
}
- void expectTreeDumpEqual(StringRef Code, StringRef Tree,
- bool RunWithDelayedTemplateParsing = true) {
- SCOPED_TRACE(Code);
-
- std::string Expected = Tree.trim().str();
-
- // We want to run the test with -fdelayed-template-parsing enabled and
- // disabled, therefore we use these representative targets that
diff er in
- // the default value.
- // We are not passing -fdelayed-template-parsing directly but we are using
- // the `-target` to improve coverage and discover
diff erences in behavior
- // early.
- for (const StringRef Target :
- {"x86_64-unknown-unknown", "x86_64-pc-win32"}) {
- if (!RunWithDelayedTemplateParsing && Target.equals("x86_64-pc-win32")) {
- continue;
- }
- auto *Root = buildTree(Code, Target);
- std::string Actual = std::string(StringRef(Root->dump(*Arena)).trim());
- EXPECT_EQ(Expected, Actual)
- << "for target " << Target << " the resulting dump is:\n"
- << Actual;
- }
+ void expectTreeDumpEqual(StringRef code, StringRef tree) {
+ SCOPED_TRACE(code);
+
+ auto *Root = buildTree(code);
+ std::string Expected = tree.trim().str();
+ std::string Actual =
+ std::string(llvm::StringRef(Root->dump(*Arena)).trim());
+ EXPECT_EQ(Expected, Actual) << "the resulting dump is:\n" << Actual;
}
// Adds a file to the test VFS.
@@ -809,10 +794,7 @@ template <class T> int fun() {}
`-CompoundStatement
|-{
`-}
-)txt",
- // FIXME: Make this test work on windows by generating the expected Syntax
- // tree when -fdelayed-template-parsing is active.
- /*RunWithDelayedTemplateParsing=*/true);
+)txt");
}
TEST_F(SyntaxTreeTest, NestedTemplates) {
@@ -1758,7 +1740,7 @@ TEST_F(SyntaxTreeTest, Mutations) {
auto CheckTransformation = [this](std::string Input, std::string Expected,
Transformation Transform) -> void {
llvm::Annotations Source(Input);
- auto *Root = buildTree(Source.code(), "x86_64-unknown-unknown");
+ auto *Root = buildTree(Source.code());
Transform(Source, Root);
@@ -1796,7 +1778,7 @@ TEST_F(SyntaxTreeTest, Mutations) {
}
TEST_F(SyntaxTreeTest, SynthesizedNodes) {
- buildTree("", "x86_64-unknown-unknown");
+ buildTree("");
auto *C = syntax::createPunctuation(*Arena, tok::comma);
ASSERT_NE(C, nullptr);
More information about the cfe-commits
mailing list