llvm.org GIT mirror llvm / 79b7faa
[PM] Teach PreservedAnalyses to have an `allInSet` static factory function template to simplify building a quick object with a set marked as preserved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307493 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 2 years ago
2 changed file(s) with 15 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
158158 static PreservedAnalyses all() {
159159 PreservedAnalyses PA;
160160 PA.PreservedIDs.insert(&AllAnalysesKey);
161 return PA;
162 }
163
164 /// \brief Construct a preserved analyses object with a single preserved set.
165 template
166 static PreservedAnalyses allInSet() {
167 PreservedAnalyses PA;
168 PA.preserveSet();
161169 return PA;
162170 }
163171
208208 auto PAC = PA4.getChecker();
209209 EXPECT_FALSE(PAC.preserved());
210210 EXPECT_FALSE(PAC.preservedSet>());
211 }
212 auto PA5 = PreservedAnalyses::allInSet>();
213 {
214 auto PAC = PA5.getChecker();
215 EXPECT_FALSE(PAC.preserved());
216 EXPECT_TRUE(PAC.preservedSet>());
217 EXPECT_FALSE(PAC.preservedSet>());
211218 }
212219 }
213220