Fixup test to compile with -frtti when trying to use typeid() as the PS4 does not...
authorDouglas Yung <douglas.yung@sony.com>
Thu, 28 Jun 2018 00:19:12 +0000 (00:19 +0000)
committerDouglas Yung <douglas.yung@sony.com>
Thu, 28 Jun 2018 00:19:12 +0000 (00:19 +0000)
llvm-svn: 335799

clang-tools-extra/unittests/clang-tidy/ExprMutationAnalyzerTest.cpp

index 25f1cac..498aa7c 100644 (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()"));
 }