Merge remote-tracking branch 'origin/master' into master-next

This commit is contained in:
swift-ci
2017-04-21 13:28:31 -07:00
29 changed files with 482 additions and 33 deletions

View File

@@ -106,6 +106,8 @@ ERROR(error_mode_cannot_emit_dependencies,none,
"this mode does not support emitting dependency files", ())
ERROR(error_mode_cannot_emit_header,none,
"this mode does not support emitting Objective-C headers", ())
ERROR(error_mode_cannot_emit_loaded_module_trace,none,
"this mode does not support emitting the loaded module trace", ())
ERROR(error_mode_cannot_emit_module,none,
"this mode does not support emitting modules", ())
ERROR(error_mode_cannot_emit_module_doc,none,

View File

@@ -473,8 +473,11 @@ public:
/// Determine whether the witness for the given type requirement
/// is the default definition.
bool usesDefaultDefinition(AssociatedTypeDecl *requirement) const {
return getTypeWitnessAndDecl(requirement, nullptr)
.second->isImplicit();
TypeDecl *witnessDecl = getTypeWitnessAndDecl(requirement, nullptr).second;
if (witnessDecl)
return witnessDecl->isImplicit();
// Conservatively assume it does not.
return false;
}
void setLazyLoader(LazyMemberLoader *resolver, uint64_t contextData);

View File

@@ -445,6 +445,16 @@ private:
void indent();
};
template <typename T> struct ArrayTraits<std::vector<T>> {
static size_t size(Output &out, std::vector<T> &seq) { return seq.size(); }
static T &element(Output &out, std::vector<T> &seq, size_t index) {
if (index >= seq.size())
seq.resize(index + 1);
return seq[index];
}
};
template<>
struct ScalarTraits<bool> {
static void output(const bool &, llvm::raw_ostream &);

View File

@@ -146,6 +146,10 @@ private:
/// detail than ShowIncrementalBuildDecisions.
bool ShowJobLifecycle = false;
/// When true, some frontend job has requested permission to pass
/// -emit-loaded-module-trace, so no other job needs to do it.
bool PassedEmitLoadedModuleTraceToFrontendJob = false;
static const Job *unwrap(const std::unique_ptr<const Job> &p) {
return p.get();
}
@@ -232,6 +236,22 @@ public:
/// -2 indicates that one of the Compilation's Jobs crashed during execution
int performJobs();
/// Returns whether the callee is permitted to pass -emit-loaded-module-trace
/// to a frontend job.
///
/// This only returns true once, because only one job should pass that
/// argument.
bool requestPermissionForFrontendToEmitLoadedModuleTrace() {
if (PassedEmitLoadedModuleTraceToFrontendJob)
// Someone else has already done it!
return false;
else {
// We're the first and only (to execute this path).
PassedEmitLoadedModuleTraceToFrontendJob = true;
return true;
}
}
private:
/// \brief Perform all jobs.
///

View File

@@ -59,6 +59,7 @@ TYPE("swift-dependencies", SwiftDeps, "swiftdeps", "")
TYPE("remap", Remapping, "remap", "")
TYPE("imported-modules", ImportedModules, "importedmodules", "")
TYPE("tbd", TBD, "tbd", "")
TYPE("module-trace", ModuleTrace, "trace.json", "")
// Misc types
TYPE("pcm", ClangModuleFile, "pcm", "")

View File

@@ -116,6 +116,9 @@ public:
/// The path to which we should output fixits as source edits.
std::string FixitsOutputPath;
/// The path to which we should output a loaded module trace file.
std::string LoadedModuleTracePath;
/// Arguments which should be passed in immediate mode.
std::vector<std::string> ImmediateArgv;

View File

@@ -199,6 +199,16 @@ def emit_dependencies : Flag<["-"], "emit-dependencies">,
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
HelpText<"Emit basic Make-compatible dependencies files">;
def emit_loaded_module_trace : Flag<["-"], "emit-loaded-module-trace">,
Flags<[FrontendOption, NoInteractiveOption]>,
HelpText<"Emit a JSON file containing information about what modules were loaded">;
def emit_loaded_module_trace_path : Separate<["-"], "emit-loaded-module-trace-path">,
Flags<[FrontendOption, NoInteractiveOption]>,
HelpText<"Emit the loaded module trace JSON to <path>">,
MetaVarName<"<path>">;
def emit_loaded_module_trace_path_EQ : Joined<["-"], "emit-loaded-module-trace-path=">,
Flags<[FrontendOption, NoInteractiveOption]>, Alias<emit_loaded_module_trace_path>;
def serialize_diagnostics : Flag<["-"], "serialize-diagnostics">,
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
HelpText<"Serialize diagnostics in a binary format">;

View File

@@ -54,7 +54,7 @@ const uint16_t VERSION_MAJOR = 0;
/// in source control, you should also update the comment to briefly
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
const uint16_t VERSION_MINOR = 335; // Last change: no type in objc method table
const uint16_t VERSION_MINOR = 336; // Last change: typealias canonical type
using DeclID = PointerEmbeddedInt<unsigned, 31>;
using DeclIDField = BCFixed<31>;
@@ -571,7 +571,8 @@ namespace decls_block {
using NameAliasTypeLayout = BCRecordLayout<
NAME_ALIAS_TYPE,
DeclIDField // typealias decl
DeclIDField, // typealias decl
TypeIDField // canonical type (a fallback)
>;
using GenericTypeParamTypeLayout = BCRecordLayout<