mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
32 lines
1.0 KiB
C++
32 lines
1.0 KiB
C++
//===--- TextualInterfaceGeneration.cpp - swiftinterface files ------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2018 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "TextualInterfaceGeneration.h"
|
|
|
|
#include "swift/AST/Decl.h"
|
|
#include "swift/AST/Module.h"
|
|
|
|
using namespace swift;
|
|
|
|
bool swift::emitModuleInterface(raw_ostream &out, ModuleDecl *M) {
|
|
const PrintOptions printOptions = PrintOptions::printTextualInterfaceFile();
|
|
SmallVector<Decl *, 16> topLevelDecls;
|
|
M->getTopLevelDecls(topLevelDecls);
|
|
for (const Decl *D : topLevelDecls) {
|
|
if (!D->shouldPrintInContext(printOptions))
|
|
continue;
|
|
D->print(out, printOptions);
|
|
out << "\n";
|
|
}
|
|
return false;
|
|
}
|