From 7920d2ea4ef15ffe7005beaa745d4d3b0edcef6c Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 25 Apr 2018 09:17:05 +0000 Subject: [PATCH] [clangd] Minor fixes for C++ standard library header mapping. llvm-svn: 330803 --- .../clangd/index/CanonicalIncludes.cpp | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp index 6b3528556637..6b4f34441dd9 100644 --- a/clang-tools-extra/clangd/index/CanonicalIncludes.cpp +++ b/clang-tools-extra/clangd/index/CanonicalIncludes.cpp @@ -78,6 +78,7 @@ collectIWYUHeaderMaps(CanonicalIncludes *Includes) { void addSystemHeadersMapping(CanonicalIncludes *Includes) { static const std::vector> SymbolMap = { + {"std::addressof", ""}, // Map symbols in to their preferred includes. {"std::basic_filebuf", ""}, {"std::basic_fstream", ""}, @@ -120,6 +121,9 @@ void addSystemHeadersMapping(CanonicalIncludes *Includes) { {"std::basic_streambuf", ""}, {"std::streambuf", ""}, {"std::wstreambuf", ""}, + {"std::uint_least16_t", ""}, // redeclares these + {"std::uint_least32_t", ""}, + {"std::declval", ""}, }; for (const auto &Pair : SymbolMap) Includes->addSymbolMapping(Pair.first, Pair.second); @@ -191,16 +195,18 @@ void addSystemHeadersMapping(CanonicalIncludes *Includes) { {"include/_G_config.h$", ""}, {"include/assert.h$", ""}, {"algorithm$", ""}, + {"valarray$", ""}, {"array$", ""}, {"atomic$", ""}, {"backward/auto_ptr.h$", ""}, {"backward/binders.h$", ""}, {"bits/algorithmfwd.h$", ""}, - {"bits/alloc_traits.h$", ""}, + {"bits/alloc_traits.h$", ""}, {"bits/allocated_ptr.h$", ""}, {"bits/allocator.h$", ""}, {"bits/atomic_base.h$", ""}, {"bits/atomic_lockfree_defines.h$", ""}, + {"bits/atomic_futex.h$", ""}, {"bits/basic_ios.h$", ""}, {"bits/basic_ios.tcc$", ""}, {"bits/basic_string.h$", ""}, @@ -211,19 +217,21 @@ void addSystemHeadersMapping(CanonicalIncludes *Includes) { {"bits/cpp_type_traits.h$", ""}, {"bits/cxxabi_forced.h$", ""}, {"bits/deque.tcc$", ""}, + {"bits/exception.h$", ""}, {"bits/exception_defines.h$", ""}, {"bits/exception_ptr.h$", ""}, {"bits/forward_list.h$", ""}, {"bits/forward_list.tcc$", ""}, {"bits/fstream.tcc$", ""}, {"bits/functexcept.h$", ""}, - {"bits/functional_hash.h$", ""}, + {"bits/functional_hash.h$", ""}, {"bits/gslice.h$", ""}, {"bits/gslice_array.h$", ""}, {"bits/hash_bytes.h$", ""}, {"bits/hashtable.h$", ""}, {"bits/hashtable_policy.h$", ""}, {"bits/indirect_array.h$", ""}, + {"bits/invoke.h$", ""}, {"bits/ios_base.h$", ""}, {"bits/istream.tcc$", ""}, {"bits/list.tcc$", ""}, @@ -241,25 +249,33 @@ void addSystemHeadersMapping(CanonicalIncludes *Includes) { {"bits/nested_exception.h$", ""}, {"bits/ostream.tcc$", ""}, {"bits/ostream_insert.h$", ""}, - {"bits/postypes.h$", ""}, + {"bits/parse_numbers.h$", ""}, + {"bits/postypes.h$", ""}, {"bits/predefined_ops.h$", ""}, {"bits/ptr_traits.h$", ""}, + {"bits/quoted_string.h$", ""}, {"bits/random.h$", ""}, {"bits/random.tcc$", ""}, {"bits/range_access.h$", ""}, + {"bits/refwrap.h$", ""}, {"bits/regex.h$", ""}, + {"bits/regex_automaton.h$", ""}, {"bits/regex_compiler.h$", ""}, {"bits/regex_constants.h$", ""}, {"bits/regex_cursor.h$", ""}, {"bits/regex_error.h$", ""}, + {"bits/regex_executor.h$", ""}, {"bits/regex_grep_matcher.h$", ""}, {"bits/regex_grep_matcher.tcc$", ""}, {"bits/regex_nfa.h$", ""}, + {"bits/regex_scanner.h$", ""}, {"bits/shared_ptr.h$", ""}, {"bits/shared_ptr_base.h$", ""}, - {"bits/shared_ptr_atomic.h$", ""}, + {"bits/shared_ptr_atomic.h$", ""}, {"bits/slice_array.h$", ""}, {"bits/sstream.tcc$", ""}, + {"bits/std_abs.h$", ""}, + {"bits/std_function.h$", ""}, {"bits/std_mutex.h$", ""}, {"bits/stl_algo.h$", ""}, {"bits/stl_algobase.h$", ""}, @@ -270,7 +286,7 @@ void addSystemHeadersMapping(CanonicalIncludes *Includes) { {"bits/stl_heap.h$", ""}, {"bits/stl_iterator.h$", ""}, {"bits/stl_iterator_base_funcs.h$", ""}, - {"bits/stl_iterator_base_types.h$", ""}, + {"bits/stl_iterator_base_types.h$", ""}, {"bits/stl_list.h$", ""}, {"bits/stl_map.h$", ""}, {"bits/stl_multimap.h$", ""}, @@ -284,7 +300,7 @@ void addSystemHeadersMapping(CanonicalIncludes *Includes) { {"bits/stl_stack.h$", ""}, {"bits/stl_tempbuf.h$", ""}, {"bits/stl_tree.h$", ""}, - {"bits/stl_uninitialized.h$", ""}, + {"bits/stl_uninitialized.h$", ""}, {"bits/stl_vector.h$", ""}, {"bits/stream_iterator.h$", ""}, {"bits/streambuf.tcc$", ""}, @@ -294,7 +310,7 @@ void addSystemHeadersMapping(CanonicalIncludes *Includes) { {"bits/unique_ptr.h$", ""}, {"bits/unordered_map.h$", ""}, {"bits/unordered_set.h$", ""}, - {"bits/uses_allocator.h$", ""}, + {"bits/uses_allocator.h$", ""}, {"bits/valarray_after.h$", ""}, {"bits/valarray_array.h$", ""}, {"bits/valarray_array.tcc$", ""}, @@ -359,6 +375,7 @@ void addSystemHeadersMapping(CanonicalIncludes *Includes) { {"locale$", ""}, {"map$", ""}, {"memory$", ""}, + {"shared_mutex$", ""}, {"mutex$", ""}, {"new$", ""}, {"numeric$", ""},