mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Update master to build with Xcode 8 beta 3, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs.
This commit is contained in:
@@ -147,38 +147,27 @@ getUnderlyingClangModuleForImport(ImportDecl *Import) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void printTypeNameToString(Type Ty, std::string &Text) {
|
||||
SmallString<128> Buffer;
|
||||
llvm::raw_svector_ostream OS(Buffer);
|
||||
Ty->print(OS);
|
||||
Text = OS.str();
|
||||
}
|
||||
|
||||
bool swift::ide::
|
||||
printTypeInterface(ModuleDecl *M, Type Ty, ASTPrinter &Printer,
|
||||
std::string &TypeName, std::string &Error) {
|
||||
if (!Ty) {
|
||||
if (Error.empty())
|
||||
Error = "type cannot be null.";
|
||||
return true;
|
||||
}
|
||||
std::string &Error) {
|
||||
if (!Ty)
|
||||
return false;
|
||||
Ty = Ty->getRValueType();
|
||||
if (auto ND = Ty->getNominalOrBoundGenericNominal()) {
|
||||
PrintOptions Options = PrintOptions::printTypeInterface(Ty.getPointer(), M);
|
||||
ND->print(Printer, Options);
|
||||
printTypeNameToString(Ty, TypeName);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
Error = "cannot find declaration of type.";
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool swift::ide::
|
||||
printTypeInterface(ModuleDecl *M, StringRef TypeUSR, ASTPrinter &Printer,
|
||||
std::string &TypeName, std::string &Error) {
|
||||
std::string &Error) {
|
||||
return printTypeInterface(M, getTypeFromMangledSymbolname(M->getASTContext(),
|
||||
TypeUSR, Error),
|
||||
Printer, TypeName, Error);
|
||||
Printer, Error);
|
||||
}
|
||||
|
||||
void swift::ide::printModuleInterface(Module *M, Optional<StringRef> Group,
|
||||
|
||||
Reference in New Issue
Block a user