@@ -128,30 +128,36 @@ class PreservedAnalyses {
128128 }
129129
130130 // / Mark an analysis as preserved.
131- template <typename AnalysisT> void preserve () { preserve (AnalysisT::ID ()); }
131+ template <typename AnalysisT> PreservedAnalyses &preserve () {
132+ preserve (AnalysisT::ID ());
133+ return *this ;
134+ }
132135
133136 // / Given an analysis's ID, mark the analysis as preserved, adding it
134137 // / to the set.
135- void preserve (AnalysisKey *ID) {
138+ PreservedAnalyses & preserve (AnalysisKey *ID) {
136139 // Clear this ID from the explicit not-preserved set if present.
137140 NotPreservedAnalysisIDs.erase (ID);
138141
139142 // If we're not already preserving all analyses (other than those in
140143 // NotPreservedAnalysisIDs).
141144 if (!areAllPreserved ())
142145 PreservedIDs.insert (ID);
146+ return *this ;
143147 }
144148
145149 // / Mark an analysis set as preserved.
146- template <typename AnalysisSetT> void preserveSet () {
150+ template <typename AnalysisSetT> PreservedAnalyses & preserveSet () {
147151 preserveSet (AnalysisSetT::ID ());
152+ return *this ;
148153 }
149154
150155 // / Mark an analysis set as preserved using its ID.
151- void preserveSet (AnalysisSetKey *ID) {
156+ PreservedAnalyses & preserveSet (AnalysisSetKey *ID) {
152157 // If we're not already in the saturated 'all' state, add this set.
153158 if (!areAllPreserved ())
154159 PreservedIDs.insert (ID);
160+ return *this ;
155161 }
156162
157163 // / Mark an analysis as abandoned.
@@ -161,7 +167,10 @@ class PreservedAnalyses {
161167 // /
162168 // / Note that you can only abandon a specific analysis, not a *set* of
163169 // / analyses.
164- template <typename AnalysisT> void abandon () { abandon (AnalysisT::ID ()); }
170+ template <typename AnalysisT> PreservedAnalyses &abandon () {
171+ abandon (AnalysisT::ID ());
172+ return *this ;
173+ }
165174
166175 // / Mark an analysis as abandoned using its ID.
167176 // /
@@ -170,9 +179,10 @@ class PreservedAnalyses {
170179 // /
171180 // / Note that you can only abandon a specific analysis, not a *set* of
172181 // / analyses.
173- void abandon (AnalysisKey *ID) {
182+ PreservedAnalyses & abandon (AnalysisKey *ID) {
174183 PreservedIDs.erase (ID);
175184 NotPreservedAnalysisIDs.insert (ID);
185+ return *this ;
176186 }
177187
178188 // / Intersect this set with another in place.
0 commit comments