Start tracking lookups on AnyObject/AnyClass.

These form dependencies as well. Part of rdar://problem/19270018.

Swift SVN r24049
This commit is contained in:
Jordan Rose
2014-12-20 01:59:01 +00:00
parent b8596ffccb
commit 75c6ec9def
4 changed files with 85 additions and 20 deletions

View File

@@ -41,8 +41,9 @@
#include "llvm/Option/OptTable.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/YAMLParser.h"
#include <memory>
@@ -101,6 +102,10 @@ static bool emitReferenceDependencies(DiagnosticEngine &diags,
return true;
}
auto escape = [](Identifier name) -> std::string {
return llvm::yaml::escape(name.str());
};
out << "### Swift dependencies file v0 ###\n";
SmallVector<const NominalTypeDecl *, 16> extendedNominals;
@@ -127,7 +132,7 @@ static bool emitReferenceDependencies(DiagnosticEngine &diags,
case DeclKind::InfixOperator:
case DeclKind::PrefixOperator:
case DeclKind::PostfixOperator:
out << "- \"" << cast<OperatorDecl>(D)->getName() << "\"\n";
out << "- \"" << escape(cast<OperatorDecl>(D)->getName()) << "\"\n";
break;
case DeclKind::Enum:
@@ -139,7 +144,7 @@ static bool emitReferenceDependencies(DiagnosticEngine &diags,
NTD->getAccessibility() == Accessibility::Private) {
break;
}
out << "- \"" << NTD->getName() << "\"\n";
out << "- \"" << escape(NTD->getName()) << "\"\n";
extendedNominals.push_back(NTD);
findNominals(extendedNominals, NTD->getMembers());
break;
@@ -153,7 +158,7 @@ static bool emitReferenceDependencies(DiagnosticEngine &diags,
VD->getAccessibility() == Accessibility::Private) {
break;
}
out << "- \"" << VD->getName() << "\"\n";
out << "- \"" << escape(VD->getName()) << "\"\n";
break;
}
@@ -191,7 +196,7 @@ static bool emitReferenceDependencies(DiagnosticEngine &diags,
out << "- ";
if (!entry.second)
out << "!private ";
out << "\"" << entry.first << "\"\n";
out << "\"" << escape(entry.first) << "\"\n";
}
// FIXME: Sort these?
@@ -210,6 +215,15 @@ static bool emitReferenceDependencies(DiagnosticEngine &diags,
out << "\"\n";
}
// FIXME: Sort these?
out << "dynamic-lookup:\n";
for (auto &entry : tracker->getDynamicLookupNames()) {
out << "- ";
if (!entry.second)
out << "!private ";
out << "\"" << escape(entry.first) << "\"\n";
}
return false;
}