2929using namespace swift ;
3030using namespace importer ;
3131
32- #define SIW_DBG (x ) DEBUG_WITH_TYPE(" safe-interop-wrappers" , llvm::dbgs() << x)
32+ #define DEBUG_TYPE " safe-interop-wrappers"
33+ #define DLOG (x ) LLVM_DEBUG(llvm::dbgs() << x)
3334
3435namespace {
3536ValueDecl *getKnownSingleDecl (ASTContext &SwiftContext, StringRef DeclName) {
@@ -301,7 +302,7 @@ static bool swiftifyImpl(ClangImporter::Implementation &Self,
301302 SwiftifyInfoPrinter &printer,
302303 const AbstractFunctionDecl *MappedDecl,
303304 const clang::FunctionDecl *ClangDecl) {
304- SIW_DBG (" Checking " << *ClangDecl << " for bounds and lifetime info\n " );
305+ DLOG (" Checking " << *ClangDecl << " for bounds and lifetime info\n " );
305306
306307 // FIXME: for private macro generated functions we do not serialize the
307308 // SILFunction's body anywhere triggering assertions.
@@ -336,15 +337,15 @@ static bool swiftifyImpl(ClangImporter::Implementation &Self,
336337 auto *CAT = ClangDecl->getReturnType ()->getAs <clang::CountAttributedType>();
337338 if (SwiftifiableCAT (clangASTContext, CAT, swiftReturnTy)) {
338339 printer.printCountedBy (CAT, SwiftifyInfoPrinter::RETURN_VALUE_INDEX);
339- SIW_DBG (" Found bounds info '" << clang::QualType (CAT, 0 ) << " ' on return value\n " );
340+ DLOG (" Found bounds info '" << clang::QualType (CAT, 0 ) << " ' on return value\n " );
340341 attachMacro = true ;
341342 }
342343 auto dependsOnClass = [](const ParamDecl *fromParam) {
343344 return fromParam->getInterfaceType ()->isAnyClassReferenceType ();
344345 };
345346 bool returnHasLifetimeInfo = false ;
346347 if (getImplicitObjectParamAnnotation<clang::LifetimeBoundAttr>(ClangDecl)) {
347- SIW_DBG (" Found lifetimebound attribute on implicit 'this'\n " );
348+ DLOG (" Found lifetimebound attribute on implicit 'this'\n " );
348349 if (!dependsOnClass (
349350 MappedDecl->getImplicitSelfDecl (/* createIfNeeded*/ true ))) {
350351 printer.printLifetimeboundReturn (SwiftifyInfoPrinter::SELF_PARAM_INDEX,
@@ -391,8 +392,8 @@ static bool swiftifyImpl(ClangImporter::Implementation &Self,
391392 diag::note_swift_name_instance_method);
392393 } else if (SwiftifiableCAT (clangASTContext, CAT, swiftParamTy)) {
393394 printer.printCountedBy (CAT, mappedIndex);
394- SIW_DBG (" Found bounds info '" << clangParamTy
395- << " ' on parameter ' " << *clangParam << " '\n " );
395+ DLOG (" Found bounds info '" << clangParamTy << " ' on parameter ' "
396+ << *clangParam << " '\n " );
396397 attachMacro = paramHasBoundsInfo = true ;
397398 }
398399 bool paramIsStdSpan =
@@ -401,12 +402,12 @@ static bool swiftifyImpl(ClangImporter::Implementation &Self,
401402
402403 bool paramHasLifetimeInfo = false ;
403404 if (clangParam->hasAttr <clang::NoEscapeAttr>()) {
404- SIW_DBG (" Found noescape attribute on parameter '" << *clangParam << " '\n " );
405+ DLOG (" Found noescape attribute on parameter '" << *clangParam << " '\n " );
405406 printer.printNonEscaping (mappedIndex);
406407 paramHasLifetimeInfo = true ;
407408 }
408409 if (clangParam->template hasAttr <clang::LifetimeBoundAttr>()) {
409- SIW_DBG (" Found lifetimebound attribute on parameter '" << *clangParam
410+ DLOG (" Found lifetimebound attribute on parameter '" << *clangParam
410411 << " '\n " );
411412 if (!dependsOnClass (swiftParam)) {
412413 // If this parameter has bounds info we will tranform it into a Span,
@@ -421,13 +422,13 @@ static bool swiftifyImpl(ClangImporter::Implementation &Self,
421422 }
422423 }
423424 if (paramIsStdSpan && paramHasLifetimeInfo) {
424- SIW_DBG (" Found both std::span and lifetime info "
425- " for parameter ' " << *clangParam << " '\n " );
425+ DLOG (" Found both std::span and lifetime info for parameter ' "
426+ << *clangParam << " '\n " );
426427 attachMacro = true ;
427428 }
428429 }
429430 if (returnIsStdSpan && returnHasLifetimeInfo) {
430- SIW_DBG (" Found both std::span and lifetime info for return value\n " );
431+ DLOG (" Found both std::span and lifetime info for return value\n " );
431432 attachMacro = true ;
432433 }
433434 }
@@ -458,7 +459,7 @@ void ClangImporter::Implementation::swiftify(AbstractFunctionDecl *MappedDecl) {
458459 printer.printTypeMapping ();
459460 }
460461
461- SIW_DBG (" Attaching safe interop macro: " << MacroString << " \n " );
462+ DLOG (" Attaching safe interop macro: " << MacroString << " \n " );
462463 if (clang::RawComment *raw =
463464 getClangASTContext ().getRawCommentForDeclNoCache (ClangDecl)) {
464465 // swift::RawDocCommentAttr doesn't contain its text directly, but instead
@@ -477,4 +478,4 @@ void ClangImporter::Implementation::swiftify(AbstractFunctionDecl *MappedDecl) {
477478 importNontrivialAttribute (MappedDecl, MacroString);
478479 }
479480}
480- # undef SIW_DBG
481+
0 commit comments