Fixup test to compile with -frtti when trying to use typeid() as the PS4 does not have it on by default and it was failing on the PS4 linux bot because of this.

llvm-svn: 335799
This commit is contained in:
Douglas Yung 2018-06-28 00:19:12 +00:00
parent d18639bd13
commit 3a670eacf6
1 changed files with 7 additions and 4 deletions

View File

@ -579,8 +579,10 @@ TEST(ExprMutationAnalyzerTest, UnevaluatedExpressions) {
Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
EXPECT_FALSE(isMutated(Results, AST.get()));
AST = tooling::buildASTFromCode("namespace std { class type_info; }"
"void f() { int x; typeid(x = 10); }");
AST =
tooling::buildASTFromCodeWithArgs("namespace std { class type_info; }"
"void f() { int x; typeid(x = 10); }",
std::vector<std::string> ({"-frtti"}));
Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
EXPECT_FALSE(isMutated(Results, AST.get()));
@ -596,10 +598,11 @@ TEST(ExprMutationAnalyzerTest, NotUnevaluatedExpressions) {
match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x++"));
AST = tooling::buildASTFromCode(
AST = tooling::buildASTFromCodeWithArgs(
"namespace std { class type_info; }"
"struct A { virtual ~A(); }; struct B : A {};"
"struct X { A& f(); }; void f() { X x; typeid(x.f()); }");
"struct X { A& f(); }; void f() { X x; typeid(x.f()); }",
std::vector<std::string> ({"-frtti"}));
Results = match(withEnclosingCompound(declRefTo("x")), AST->getASTContext());
EXPECT_THAT(mutatedBy(Results, AST.get()), ElementsAre("x.f()"));
}