uint64_t ExternalCommand::getSignature() {
  // FIXME: Use a more appropriate hashing infrastructure.
  using llvm::hash_combine;
  llvm::hash_code code = hash_value(getName());
  for (const auto* input: inputs) {
    code = hash_combine(code, input->getName());
  }
  for (const auto* output: outputs) {
    code = hash_combine(code, output->getName());
  }
  code = hash_combine(code, allowMissingInputs);
  code = hash_combine(code, allowModifiedOutputs);
  code = hash_combine(code, alwaysOutOfDate);
  return size_t(code);
}
Example #2
0
std::string CompilerInvocation::getPCHHash() const {
  using llvm::hash_code;
  using llvm::hash_value;
  using llvm::hash_combine;

  auto Code = hash_value(LangOpts.getPCHHashComponents());
  Code = hash_combine(Code, FrontendOpts.getPCHHashComponents());
  Code = hash_combine(Code, ClangImporterOpts.getPCHHashComponents());
  Code = hash_combine(Code, SearchPathOpts.getPCHHashComponents());
  Code = hash_combine(Code, DiagnosticOpts.getPCHHashComponents());
  Code = hash_combine(Code, SILOpts.getPCHHashComponents());
  Code = hash_combine(Code, IRGenOpts.getPCHHashComponents());

  return llvm::APInt(64, Code).toString(36, /*Signed=*/false);
}