@@ -8711,15 +8711,17 @@ void ClangImporter::Implementation::importAttributes(
87118711 AnyUnavailable = true ;
87128712 }
87138713
8714- if (isUsingMacroName (getClangASTContext ().getSourceManager (),
8715- avail->getLoc (), " SPI_AVAILABLE" ) ||
8716- isUsingMacroName (getClangASTContext ().getSourceManager (),
8717- avail->getLoc (), " __SPI_AVAILABLE" )) {
8718- // The decl has been marked as SPI in the header by using the SPI macro,
8719- // thus we add the SPI attribute to it with a default group name.
8720- MappedDecl->getAttrs ().add (SPIAccessControlAttr::create (SwiftContext,
8721- SourceLoc (), SourceRange (),
8722- SwiftContext.getIdentifier (CLANG_MODULE_DEFUALT_SPI_GROUP_NAME)));
8714+ if (EnableClangSPI) {
8715+ if (isUsingMacroName (getClangASTContext ().getSourceManager (),
8716+ avail->getLoc (), " SPI_AVAILABLE" ) ||
8717+ isUsingMacroName (getClangASTContext ().getSourceManager (),
8718+ avail->getLoc (), " __SPI_AVAILABLE" )) {
8719+ // The decl has been marked as SPI in the header by using the SPI macro,
8720+ // thus we add the SPI attribute to it with a default group name.
8721+ MappedDecl->getAttrs ().add (SPIAccessControlAttr::create (SwiftContext,
8722+ SourceLoc (), SourceRange (),
8723+ SwiftContext.getIdentifier (CLANG_MODULE_DEFUALT_SPI_GROUP_NAME)));
8724+ }
87238725 }
87248726
87258727 StringRef message = avail->getMessage ();
0 commit comments