Unverified Commit 9190f17a authored by Kadir Cetinkaya's avatar Kadir Cetinkaya
Browse files

[clangd] Add std::size_t to StdSymbol mapping

This is a common symbol that's missing from our mapping because
cppreference yields multiple headers.

Add it manually by picking cstddef to prevent insertion of some stdlib-internal
headers instead.

Fixes https://github.com/clangd/clangd/issues/666.

Differential Revision: https://reviews.llvm.org/D95423
parent b208e5bc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -92,6 +92,8 @@ void CanonicalIncludes::addSystemHeadersMapping(const LangOptions &Language) {
#include "StdSymbolMap.inc"
        // There are two std::move()s, this is by far the most common.
        SYMBOL(move, std::, <utility>)
        // There are multiple headers for size_t, pick one.
        SYMBOL(size_t, std::, <cstddef>)
#undef SYMBOL
    });
    StdSymbolMapping = Symbols;
@@ -99,6 +101,8 @@ void CanonicalIncludes::addSystemHeadersMapping(const LangOptions &Language) {
    static const auto *CSymbols = new llvm::StringMap<llvm::StringRef>({
#define SYMBOL(Name, NameSpace, Header) {#Name, #Header},
#include "CSymbolMap.inc"
        // There are multiple headers for size_t, pick one.
        SYMBOL(size_t, None, <stddef.h>)
#undef SYMBOL
    });
    StdSymbolMapping = CSymbols;