[Driver] Move .swiftdeps strings (NFC)

Define compilation record (.swiftdeps) top-level keys, as well as string
identifiers used in compilation record files (like "!dirty" and "!private"), in
a single location. NFC.
This commit is contained in:
Brian Gesiak
2016-08-24 19:52:01 -04:00
parent 01c6d4bccd
commit 2b3647efc4
4 changed files with 109 additions and 24 deletions

View File

@@ -36,6 +36,8 @@
#include "llvm/Support/Timer.h"
#include "llvm/Support/YAMLParser.h"
#include "CompilationRecord.h"
using namespace swift;
using namespace swift::sys;
using namespace swift::driver;
@@ -190,27 +192,24 @@ static void writeCompilationRecord(StringRef path, StringRef argsHash,
out << "[" << time.seconds() << ", " << time.nanoseconds() << "]";
};
out << "version: \"" << llvm::yaml::escape(version::getSwiftFullVersion())
using compilation_record::TopLevelKey;
out << compilation_record::getName(TopLevelKey::Version) << ": \""
<< llvm::yaml::escape(version::getSwiftFullVersion())
<< "\"\n";
out << "options: \"" << llvm::yaml::escape(argsHash) << "\"\n";
out << "build_time: ";
out << compilation_record::getName(TopLevelKey::Options) << ": \""
<< llvm::yaml::escape(argsHash) << "\"\n";
out << compilation_record::getName(TopLevelKey::BuildTime) << ": ";
writeTimeValue(out, buildTime);
out << "\n";
out << "inputs:\n";
out << compilation_record::getName(TopLevelKey::Inputs) << ":\n";
for (auto &entry : inputs) {
out << " \"" << llvm::yaml::escape(entry.first->getValue()) << "\": ";
switch (entry.second.status) {
case CompileJobAction::InputInfo::UpToDate:
break;
case CompileJobAction::InputInfo::NewlyAdded:
case CompileJobAction::InputInfo::NeedsCascadingBuild:
out << "!dirty ";
break;
case CompileJobAction::InputInfo::NeedsNonCascadingBuild:
out << "!private ";
break;
using compilation_record::getIdentifierForInputInfoStatus;
auto Name = getIdentifierForInputInfoStatus(entry.second.status);
if (!Name.empty()) {
out << Name << " ";
}
writeTimeValue(out, entry.second.previousModTime);