mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[PM] Teach PreservedAnalyses to have an allInSet
static factory
function template to simplify building a quick object with a set marked as preserved. llvm-svn: 307493
This commit is contained in:
parent
8652178bc5
commit
36d470ca31
@ -162,6 +162,14 @@ public:
|
||||
return PA;
|
||||
}
|
||||
|
||||
/// \brief Construct a preserved analyses object with a single preserved set.
|
||||
template <typename AnalysisSetT>
|
||||
static PreservedAnalyses allInSet() {
|
||||
PreservedAnalyses PA;
|
||||
PA.preserveSet<AnalysisSetT>();
|
||||
return PA;
|
||||
}
|
||||
|
||||
/// Mark an analysis as preserved.
|
||||
template <typename AnalysisT> void preserve() { preserve(AnalysisT::ID()); }
|
||||
|
||||
|
@ -210,6 +210,13 @@ TEST(PreservedAnalysesTest, Basic) {
|
||||
EXPECT_FALSE(PAC.preserved());
|
||||
EXPECT_FALSE(PAC.preservedSet<AllAnalysesOn<Function>>());
|
||||
}
|
||||
auto PA5 = PreservedAnalyses::allInSet<AllAnalysesOn<Function>>();
|
||||
{
|
||||
auto PAC = PA5.getChecker<TestFunctionAnalysis>();
|
||||
EXPECT_FALSE(PAC.preserved());
|
||||
EXPECT_TRUE(PAC.preservedSet<AllAnalysesOn<Function>>());
|
||||
EXPECT_FALSE(PAC.preservedSet<AllAnalysesOn<Module>>());
|
||||
}
|
||||
}
|
||||
|
||||
TEST(PreservedAnalysesTest, Preserve) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user