@@ -1779,7 +1779,7 @@ TEST(ExprMutationAnalyzerTest, PointeeMutatedByPassAsArgumentInConstruct) {
1779
1779
TEST (ExprMutationAnalyzerTest,
1780
1780
PointeeMutatedByPassAsArgumentInTemplateConstruct) {
1781
1781
const std::string Code = " template<class T> void f() { int *x; new T(x); }" ;
1782
- auto AST = buildASTFromCodeWithArgs (Code, {});
1782
+ auto AST = buildASTFromCodeWithArgs (Code, {" -fno-delayed-template-parsing " });
1783
1783
auto Results =
1784
1784
match (withEnclosingCompound (declRefTo (" x" )), AST->getASTContext ());
1785
1785
EXPECT_TRUE (isPointeeMutated (Results, AST.get ()));
@@ -1793,7 +1793,8 @@ TEST(ExprMutationAnalyzerTest, PointeeMutatedByPassAsArgumentInInitList) {
1793
1793
" struct initializer_list{ T const* begin; T const* end; };"
1794
1794
" }"
1795
1795
" void f() { int *x; std::initializer_list<int*> a{x, x, x}; }" ;
1796
- auto AST = buildASTFromCodeWithArgs (Code, {});
1796
+ auto AST =
1797
+ buildASTFromCodeWithArgs (Code, {" -fno-delayed-template-parsing" });
1797
1798
auto Results =
1798
1799
match (withEnclosingCompound (declRefTo (" x" )), AST->getASTContext ());
1799
1800
EXPECT_TRUE (isPointeeMutated (Results, AST.get ()));
@@ -1942,4 +1943,16 @@ TEST(ExprMutationAnalyzerTest, PointeeMutatedByPointerArithmeticSubElement) {
1942
1943
EXPECT_TRUE (isPointeeMutated (Results, AST.get ()));
1943
1944
}
1944
1945
1946
+ TEST (ExprMutationAnalyzerTest, PointeeMutatedByConditionOperator) {
1947
+ const std::string Code = R"(
1948
+ void f() {
1949
+ int* x;
1950
+ int* y = 1 ? nullptr : x;
1951
+ })" ;
1952
+ auto AST = buildASTFromCodeWithArgs (Code, {" -Wno-everything" });
1953
+ auto Results =
1954
+ match (withEnclosingCompound (declRefTo (" x" )), AST->getASTContext ());
1955
+ EXPECT_TRUE (isPointeeMutated (Results, AST.get ()));
1956
+ }
1957
+
1945
1958
} // namespace clang
0 commit comments