11#include "llvm/ADT/StringExtras.h"
12#include "llvm/Support/SHA1.h"
18 auto Hash = llvm::SHA1::hash(llvm::arrayRefFromStringRef(
USR));
19 static_assert(
sizeof(Hash) >=
RawSize,
"RawSize larger than SHA1");
20 memcpy(HashValue.data(), Hash.data(),
RawSize);
24 return llvm::StringRef(
reinterpret_cast<const char *
>(HashValue.data()),
31 memcpy(
ID.HashValue.data(), Raw.data(),
RawSize);
39 return error(
"Bad ID length");
41 if (!llvm::isHexDigit(
C))
42 return error(
"Bad hex ID");
43 return fromRaw(llvm::fromHex(Str));
47 return OS << llvm::toHex(
ID.raw());
llvm::raw_string_ostream OS
static constexpr size_t RawSize
static llvm::Expected< SymbolID > fromStr(llvm::StringRef)
static SymbolID fromRaw(llvm::StringRef)
llvm::StringRef raw() const
llvm::Error error(std::error_code EC, const char *Fmt, Ts &&... Vals)
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//