Fight a bit against global initializers. NFC.

llvm-svn: 369695
This commit is contained in:
Benjamin Kramer 2019-08-22 19:43:27 +00:00
parent a1c022c791
commit b3a991df3c
6 changed files with 664 additions and 664 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,8 @@ namespace clangd {
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, RefKind K) { llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, RefKind K) {
if (K == RefKind::Unknown) if (K == RefKind::Unknown)
return OS << "Unknown"; return OS << "Unknown";
static const std::vector<const char *> Messages = {"Decl", "Def", "Ref"}; static constexpr std::array<const char *, 3> Messages = {"Decl", "Def",
"Ref"};
bool VisitedOnce = false; bool VisitedOnce = false;
for (unsigned I = 0; I < Messages.size(); ++I) { for (unsigned I = 0; I < Messages.size(); ++I) {
if (static_cast<uint8_t>(K) & 1u << I) { if (static_cast<uint8_t>(K) & 1u << I) {

View File

@ -35,8 +35,8 @@ using namespace lld::coff;
using SymbolMapTy = using SymbolMapTy =
DenseMap<const SectionChunk *, SmallVector<DefinedRegular *, 4>>; DenseMap<const SectionChunk *, SmallVector<DefinedRegular *, 4>>;
static const std::string indent8 = " "; // 8 spaces static constexpr char indent8[] = " "; // 8 spaces
static const std::string indent16 = " "; // 16 spaces static constexpr char indent16[] = " "; // 16 spaces
// Print out the first three columns of a line. // Print out the first three columns of a line.
static void writeHeader(raw_ostream &os, uint64_t addr, uint64_t size, static void writeHeader(raw_ostream &os, uint64_t addr, uint64_t size,

View File

@ -39,8 +39,8 @@ using namespace lld::elf;
using SymbolMapTy = DenseMap<const SectionBase *, SmallVector<Defined *, 4>>; using SymbolMapTy = DenseMap<const SectionBase *, SmallVector<Defined *, 4>>;
static const std::string indent8 = " "; // 8 spaces static constexpr char indent8[] = " "; // 8 spaces
static const std::string indent16 = " "; // 16 spaces static constexpr char indent16[] = " "; // 16 spaces
// Print out the first three columns of a line. // Print out the first three columns of a line.
static void writeHeader(raw_ostream &os, uint64_t vma, uint64_t lma, static void writeHeader(raw_ostream &os, uint64_t vma, uint64_t lma,

View File

@ -58,7 +58,7 @@ private:
#if LLVM_LIBXML2_ENABLED #if LLVM_LIBXML2_ENABLED
static const std::pair<StringRef, StringRef> MtNsHrefsPrefixes[] = { static constexpr std::pair<StringLiteral, StringLiteral> MtNsHrefsPrefixes[] = {
{"urn:schemas-microsoft-com:asm.v1", "ms_asmv1"}, {"urn:schemas-microsoft-com:asm.v1", "ms_asmv1"},
{"urn:schemas-microsoft-com:asm.v2", "ms_asmv2"}, {"urn:schemas-microsoft-com:asm.v2", "ms_asmv2"},
{"urn:schemas-microsoft-com:asm.v3", "ms_asmv3"}, {"urn:schemas-microsoft-com:asm.v3", "ms_asmv3"},

View File

@ -397,7 +397,7 @@ void SectionWriter::visit(const OwnedDataSection &Sec) {
llvm::copy(Sec.Data, Out.getBufferStart() + Sec.Offset); llvm::copy(Sec.Data, Out.getBufferStart() + Sec.Offset);
} }
static const std::vector<uint8_t> ZlibGnuMagic = {'Z', 'L', 'I', 'B'}; static constexpr std::array<uint8_t, 4> ZlibGnuMagic = {'Z', 'L', 'I', 'B'};
static bool isDataGnuCompressed(ArrayRef<uint8_t> Data) { static bool isDataGnuCompressed(ArrayRef<uint8_t> Data) {
return Data.size() > ZlibGnuMagic.size() && return Data.size() > ZlibGnuMagic.size() &&