From: Dmitri Gribenko Date: Fri, 4 Oct 2019 09:42:19 +0000 (+0000) Subject: Revert "[NFC] [FileCheck] Fix init of stack objects in unit tests" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6a1d18d569515b5d5c17f9da771454872409004;p=llvm Revert "[NFC] [FileCheck] Fix init of stack objects in unit tests" This reverts commit r373717. It broke the build: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/18721. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373722 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/unittests/Support/FileCheckTest.cpp b/unittests/Support/FileCheckTest.cpp index e5fd0801204..3fbc06b467b 100644 --- a/unittests/Support/FileCheckTest.cpp +++ b/unittests/Support/FileCheckTest.cpp @@ -62,9 +62,10 @@ uint64_t doAdd(uint64_t OpL, uint64_t OpR) { return OpL + OpR; } TEST_F(FileCheckTest, NumericVariable) { // Undefined variable: getValue and eval fail, error returned by eval holds // the name of the undefined variable. - FileCheckNumericVariable FooVar("FOO", 1); + FileCheckNumericVariable FooVar = FileCheckNumericVariable("FOO", 1); EXPECT_EQ("FOO", FooVar.getName()); - FileCheckNumericVariableUse FooVarUse("FOO", &FooVar); + FileCheckNumericVariableUse FooVarUse = + FileCheckNumericVariableUse("FOO", &FooVar); EXPECT_FALSE(FooVar.getValue()); Expected EvalResult = FooVarUse.eval(); ASSERT_FALSE(EvalResult); @@ -90,15 +91,16 @@ TEST_F(FileCheckTest, NumericVariable) { } TEST_F(FileCheckTest, Binop) { - FileCheckNumericVariable FooVar("FOO", 1); + FileCheckNumericVariable FooVar = FileCheckNumericVariable("FOO", 1); FooVar.setValue(42); std::unique_ptr FooVarUse = std::make_unique("FOO", &FooVar); - FileCheckNumericVariable BarVar("BAR", 2); + FileCheckNumericVariable BarVar = FileCheckNumericVariable("BAR", 2); BarVar.setValue(18); std::unique_ptr BarVarUse = std::make_unique("BAR", &BarVar); - FileCheckASTBinop Binop(doAdd, std::move(FooVarUse), std::move(BarVarUse)); + FileCheckASTBinop Binop = + FileCheckASTBinop(doAdd, std::move(FooVarUse), std::move(BarVarUse)); // Defined variable: eval returns right value. Expected Value = Binop.eval(); @@ -215,7 +217,8 @@ private: SourceMgr SM; FileCheckRequest Req; FileCheckPatternContext Context; - FileCheckPattern P(Check::CheckPlain, &Context, LineNumber++); + FileCheckPattern P = + FileCheckPattern(Check::CheckPlain, &Context, LineNumber++); public: PatternTester() { @@ -406,24 +409,25 @@ TEST_F(FileCheckTest, Substitution) { // Substitution of an undefined string variable fails and error holds that // variable's name. - FileCheckStringSubstitution StringSubstitution(&Context, "VAR404", 42); + FileCheckStringSubstitution StringSubstitution = + FileCheckStringSubstitution(&Context, "VAR404", 42); Expected SubstValue = StringSubstitution.getResult(); ASSERT_FALSE(bool(SubstValue)); expectUndefError("VAR404", SubstValue.takeError()); // Substitutions of defined pseudo and non-pseudo numeric variables return // the right value. - FileCheckNumericVariable LineVar("@LINE", 1); - FileCheckNumericVariable NVar("N", 1); + FileCheckNumericVariable LineVar = FileCheckNumericVariable("@LINE", 1); + FileCheckNumericVariable NVar = FileCheckNumericVariable("N", 1); LineVar.setValue(42); NVar.setValue(10); auto LineVarUse = std::make_unique("@LINE", &LineVar); auto NVarUse = std::make_unique("N", &NVar); - FileCheckNumericSubstitution SubstitutionLine(&Context, "@LINE", - std::move(LineVarUse), 12); - FileCheckNumericSubstitution SubstitutionN(&Context, "N", std::move(NVarUse), - 30); + FileCheckNumericSubstitution SubstitutionLine = FileCheckNumericSubstitution( + &Context, "@LINE", std::move(LineVarUse), 12); + FileCheckNumericSubstitution SubstitutionN = + FileCheckNumericSubstitution(&Context, "N", std::move(NVarUse), 30); SubstValue = SubstitutionLine.getResult(); ASSERT_TRUE(bool(SubstValue)); EXPECT_EQ("42", *SubstValue); @@ -443,7 +447,7 @@ TEST_F(FileCheckTest, Substitution) { expectUndefError("N", SubstValue.takeError()); // Substitution of a defined string variable returns the right value. - FileCheckPattern P(Check::CheckPlain, &Context, 1); + FileCheckPattern P = FileCheckPattern(Check::CheckPlain, &Context, 1); StringSubstitution = FileCheckStringSubstitution(&Context, "FOO", 42); SubstValue = StringSubstitution.getResult(); ASSERT_TRUE(bool(SubstValue)); @@ -451,7 +455,7 @@ TEST_F(FileCheckTest, Substitution) { } TEST_F(FileCheckTest, FileCheckContext) { - FileCheckPatternContext Cxt; + FileCheckPatternContext Cxt = FileCheckPatternContext(); std::vector GlobalDefines; SourceMgr SM; @@ -514,7 +518,7 @@ TEST_F(FileCheckTest, FileCheckContext) { StringRef EmptyVarStr = "EmptyVar"; StringRef UnknownVarStr = "UnknownVar"; Expected LocalVar = Cxt.getPatternVarValue(LocalVarStr); - FileCheckPattern P(Check::CheckPlain, &Cxt, 1); + FileCheckPattern P = FileCheckPattern(Check::CheckPlain, &Cxt, 1); Optional DefinedNumericVariable; Expected> ExpressionAST = P.parseNumericSubstitutionBlock(LocalNumVar1Ref, DefinedNumericVariable,