@@ -3158,13 +3158,30 @@ suppressingFeatureIsolatedDeinit(PrintOptions &options,
31583158 action ();
31593159}
31603160
3161+ namespace {
3162+ struct ExcludeAttrRAII {
3163+ std::vector<AnyAttrKind> &ExcludeAttrList;
3164+ unsigned OriginalExcludeAttrCount;
3165+
3166+ ExcludeAttrRAII (std::vector<AnyAttrKind> &ExcludeAttrList,
3167+ DeclAttrKind excluded)
3168+ : ExcludeAttrList(ExcludeAttrList),
3169+ OriginalExcludeAttrCount (ExcludeAttrList.size())
3170+ {
3171+ ExcludeAttrList.push_back (excluded);
3172+ }
3173+
3174+ ~ExcludeAttrRAII () {
3175+ ExcludeAttrList.resize (OriginalExcludeAttrCount);
3176+ }
3177+ };
3178+ }
3179+
31613180static void
31623181suppressingFeatureAllowUnsafeAttribute (PrintOptions &options,
31633182 llvm::function_ref<void ()> action) {
3164- unsigned originalExcludeAttrCount = options.ExcludeAttrList .size ();
3165- options.ExcludeAttrList .push_back (DeclAttrKind::Unsafe);
3183+ ExcludeAttrRAII scope (options.ExcludeAttrList , DeclAttrKind::Unsafe);
31663184 action ();
3167- options.ExcludeAttrList .resize (originalExcludeAttrCount);
31683185}
31693186
31703187static void
@@ -3177,11 +3194,17 @@ suppressingFeatureCoroutineAccessors(PrintOptions &options,
31773194static void
31783195suppressingFeatureABIAttribute (PrintOptions &options,
31793196 llvm::function_ref<void ()> action) {
3180- llvm::SaveAndRestore<bool > scope (options.PrintSyntheticSILGenName , true );
3181- unsigned originalExcludeAttrCount = options.ExcludeAttrList .size ();
3182- options.ExcludeAttrList .push_back (DeclAttrKind::ABI);
3197+ llvm::SaveAndRestore<bool > scope1 (options.PrintSyntheticSILGenName , true );
3198+ ExcludeAttrRAII scope2 (options.ExcludeAttrList , DeclAttrKind::ABI);
3199+ action ();
3200+ }
3201+
3202+ static void
3203+ suppressingFeatureAddressableTypes (PrintOptions &options,
3204+ llvm::function_ref<void ()> action) {
3205+ ExcludeAttrRAII scope (options.ExcludeAttrList ,
3206+ DeclAttrKind::AddressableForDependencies);
31833207 action ();
3184- options.ExcludeAttrList .resize (originalExcludeAttrCount);
31853208}
31863209
31873210// / Suppress the printing of a particular feature.
0 commit comments