Repository: apple/swift
File: lib/ClangImporter/SwiftifyDecl.cpp (C++)

Code before:
    return false;

  return ParentClass->getForeignClassKind() != ClassDecl::ForeignKind::Normal;
}

template<typename T>
static bool getImplicitObjectParamAnnotation(const clang::ObjCMethodDecl* D) {
    return false; // Only C++ methods have implicit params
}

static size_t getNumParams(const clang::ObjCMethodDecl* D) {
    return D->param_size();
}
static size_t getNumParams(const clang::FunctionDecl* D) {
    return D->getNumParams();
}
} // namespace

template<typename T>
static bool swiftifyImpl(ClangImporter::Implementation &Self,
                         SwiftifyInfoFunctionPrinter &printer,
                         const AbstractFunctionDecl *MappedDecl,
                         const T *ClangDecl) {
  DLOG_SCOPE("Checking '" << *ClangDecl << "' for bounds and lifetime info\n");

  if (ClangDecl->hasAttrs())
    for (auto attr : ClangDecl->getAttrs())
      if (auto swiftAttr = dyn_cast<clang::SwiftAttrAttr>(attr))
        if (swiftAttr->getAttribute() == "no_safe_wrapper") {
          DLOG("skipping function with no_safe_wrapper\n");
          return false;
        }

  // FIXME: for private macro generated functions we do not serialize the
  // SILFunction's body anywhere triggering assertions.
  if (ClangDecl->getAccess() == clang::AS_protected ||
      ClangDecl->getAccess() == clang::AS_private)
    return false;

  if (ClangDecl->isImplicit()) {
    DLOG("implicit functions lack lifetime and bounds info\n");
    return false;
  }

  clang::ASTContext &clangASTContext = Self.getClangASTContext();

  const clang::Module *OwningModule = getOwningModule(ClangDecl);
  bool IsInBridgingHeader = MappedDecl->getModuleContext()->getName().str() == CLANG_HEADER_MODULE_NAME;
  ASSERT(OwningModule || IsInBridgingHeader);
  ForwardDeclaredConcreteTypeVisitor CheckForwardDecls(OwningModule);


Review comment (suggestion):
nit: even if there is only one statement following an if-statement, I think it should be put in braces if it spans multiple lines/involves multiple statements. 

Code after:
    return false;

  return ParentClass->getForeignClassKind() != ClassDecl::ForeignKind::Normal;
}

template<typename T>
static bool getImplicitObjectParamAnnotation(const clang::ObjCMethodDecl* D) {
    return false; // Only C++ methods have implicit params
}

static size_t getNumParams(const clang::ObjCMethodDecl* D) {
    return D->param_size();
}
static size_t getNumParams(const clang::FunctionDecl* D) {
    return D->getNumParams();
}
} // namespace

template<typename T>
static bool swiftifyImpl(ClangImporter::Implementation &Self,
                         SwiftifyInfoFunctionPrinter &printer,
                         const AbstractFunctionDecl *MappedDecl,
                         const T *ClangDecl) {
  DLOG_SCOPE("Checking '" << *ClangDecl << "' for bounds and lifetime info\n");

  if (ClangDecl->hasAttrs()) {
    for (auto *attr : ClangDecl->getAttrs()) {
      if (auto *swiftAttr = dyn_cast<clang::SwiftAttrAttr>(attr);
          swiftAttr && swiftAttr->getAttribute() == "no_safe_wrapper") {
        DLOG("skipping function with no_safe_wrapper\n");
        return false;
      }
    }
  }

  // FIXME: for private macro generated functions we do not serialize the
  // SILFunction's body anywhere triggering assertions.
  if (ClangDecl->getAccess() == clang::AS_protected ||
      ClangDecl->getAccess() == clang::AS_private)
    return false;

  if (ClangDecl->isImplicit()) {
    DLOG("implicit functions lack lifetime and bounds info\n");
    return false;
  }

  clang::ASTContext &clangASTContext = Self.getClangASTContext();

  const clang::Module *OwningModule = getOwningModule(ClangDecl);
  bool IsInBridgingHeader = MappedDecl->getModuleContext()->getName().str() == CLANG_HEADER_MODULE_NAME;
  ASSERT(OwningModule || IsInBridgingHeader);