forked from OSchip/llvm-project
Fight a bit against global initializers. NFC.
llvm-svn: 369695
This commit is contained in:
parent
a1c022c791
commit
b3a991df3c
|
@ -88,12 +88,12 @@ collectIWYUHeaderMaps(CanonicalIncludes *Includes) {
|
||||||
|
|
||||||
void addSystemHeadersMapping(CanonicalIncludes *Includes,
|
void addSystemHeadersMapping(CanonicalIncludes *Includes,
|
||||||
const LangOptions &Language) {
|
const LangOptions &Language) {
|
||||||
static const std::vector<std::pair<const char *, const char *>> SymbolMap = {
|
static constexpr std::pair<const char *, const char *> SymbolMap[] = {
|
||||||
#define SYMBOL(Name, NameSpace, Header) { #NameSpace#Name, #Header },
|
#define SYMBOL(Name, NameSpace, Header) { #NameSpace#Name, #Header },
|
||||||
#include "StdSymbolMap.inc"
|
#include "StdSymbolMap.inc"
|
||||||
#undef SYMBOL
|
#undef SYMBOL
|
||||||
};
|
};
|
||||||
static const std::vector<std::pair<const char *, const char *>> CSymbolMap = {
|
static constexpr std::pair<const char *, const char *> CSymbolMap[] = {
|
||||||
#define SYMBOL(Name, NameSpace, Header) { #Name, #Header },
|
#define SYMBOL(Name, NameSpace, Header) { #Name, #Header },
|
||||||
#include "CSymbolMap.inc"
|
#include "CSymbolMap.inc"
|
||||||
#undef SYMBOL
|
#undef SYMBOL
|
||||||
|
@ -107,9 +107,8 @@ void addSystemHeadersMapping(CanonicalIncludes *Includes,
|
||||||
}
|
}
|
||||||
// FIXME: remove the std header mapping once we support ambiguous symbols, now
|
// FIXME: remove the std header mapping once we support ambiguous symbols, now
|
||||||
// it serves as a fallback to disambiguate:
|
// it serves as a fallback to disambiguate:
|
||||||
// - symbols with mulitiple headers (e.g. std::move)
|
// - symbols with multiple headers (e.g. std::move)
|
||||||
static const std::vector<std::pair<const char *, const char *>>
|
static constexpr std::pair<const char *, const char *> SystemHeaderMap[] = {
|
||||||
SystemHeaderMap = {
|
|
||||||
{"include/__stddef_max_align_t.h", "<cstddef>"},
|
{"include/__stddef_max_align_t.h", "<cstddef>"},
|
||||||
{"include/__wmmintrin_aes.h", "<wmmintrin.h>"},
|
{"include/__wmmintrin_aes.h", "<wmmintrin.h>"},
|
||||||
{"include/__wmmintrin_pclmul.h", "<wmmintrin.h>"},
|
{"include/__wmmintrin_pclmul.h", "<wmmintrin.h>"},
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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"},
|
||||||
|
|
|
@ -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() &&
|
||||||
|
|
Loading…
Reference in New Issue