Skip to content

Commit c0ce44e

Browse files
authoredNov 4, 2024
[Tooling/Inclusion] Update std symbols mapping (#113612)
Fixes #113494
1 parent 2dd74d4 commit c0ce44e

File tree

4 files changed

+178
-46
lines changed

4 files changed

+178
-46
lines changed
 

‎clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,19 @@ static int initialize(Lang Language) {
115115
NSLen = 0;
116116
}
117117

118-
if (SymIndex >= 0 &&
119-
Mapping->SymbolNames[SymIndex].qualifiedName() == QName) {
120-
// Not a new symbol, use the same index.
118+
if (SymIndex > 0) {
121119
assert(llvm::none_of(llvm::ArrayRef(Mapping->SymbolNames, SymIndex),
122120
[&QName](const SymbolHeaderMapping::SymbolName &S) {
123121
return S.qualifiedName() == QName;
124122
}) &&
125123
"The symbol has been added before, make sure entries in the .inc "
126124
"file are grouped by symbol name!");
127-
} else {
125+
}
126+
if (SymIndex < 0 ||
127+
Mapping->SymbolNames[SymIndex].qualifiedName() != QName) {
128128
// First symbol or new symbol, increment next available index.
129129
++SymIndex;
130-
}
130+
} // Else use the same index.
131131
Mapping->SymbolNames[SymIndex] = {
132132
QName.data(), NSLen, static_cast<unsigned int>(QName.size() - NSLen)};
133133
if (!HeaderName.empty())

‎clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc

+41-6
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,38 @@ SYMBOL(ssize, std::, <string_view>)
232232
SYMBOL(ssize, std::, <unordered_map>)
233233
SYMBOL(ssize, std::, <unordered_set>)
234234
SYMBOL(ssize, std::, <vector>)
235+
// C++ [range.access.general]: ... the customization point objects
236+
// in [range.access] are available when the header <iterator> is included.
237+
// (see https://eel.is/c++draft/range.access#general)
238+
SYMBOL(begin, std::ranges::, <ranges>)
239+
SYMBOL(begin, std::ranges::, <iterator>)
240+
SYMBOL(end, std::ranges::, <ranges>)
241+
SYMBOL(end, std::ranges::, <iterator>)
242+
SYMBOL(cbegin, std::ranges::, <ranges>)
243+
SYMBOL(cbegin, std::ranges::, <iterator>)
244+
SYMBOL(cend, std::ranges::, <ranges>)
245+
SYMBOL(cend, std::ranges::, <iterator>)
246+
SYMBOL(rbegin, std::ranges::, <ranges>)
247+
SYMBOL(rbegin, std::ranges::, <iterator>)
248+
SYMBOL(rend, std::ranges::, <ranges>)
249+
SYMBOL(rend, std::ranges::, <iterator>)
250+
SYMBOL(crbegin, std::ranges::, <ranges>)
251+
SYMBOL(crbegin, std::ranges::, <iterator>)
252+
SYMBOL(crend, std::ranges::, <ranges>)
253+
SYMBOL(crend, std::ranges::, <iterator>)
254+
SYMBOL(size, std::ranges::, <ranges>)
255+
SYMBOL(size, std::ranges::, <iterator>)
256+
SYMBOL(ssize, std::ranges::, <ranges>)
257+
SYMBOL(ssize, std::ranges::, <iterator>)
258+
SYMBOL(empty, std::ranges::, <ranges>)
259+
SYMBOL(empty, std::ranges::, <iterator>)
260+
SYMBOL(data, std::ranges::, <ranges>)
261+
SYMBOL(data, std::ranges::, <iterator>)
262+
SYMBOL(cdata, std::ranges::, <ranges>)
263+
SYMBOL(cdata, std::ranges::, <iterator>)
264+
265+
// Ignore specializations
266+
SYMBOL(hash, std::, <functional>)
235267

236268
// Add headers for generic integer-type abs.
237269
// Ignore other variants (std::complex, std::valarray, std::intmax_t)
@@ -352,20 +384,23 @@ SYMBOL(get, std::, /*no headers*/)
352384
// providing the type.
353385
SYMBOL(make_error_code, std::, /*no headers*/)
354386
SYMBOL(make_error_condition, std::, /*no headers*/)
387+
// Similar to std::get, has variants for multiple containers
388+
// (vector, deque, list, etc.)
389+
SYMBOL(erase, std::, /*no headers*/)
390+
SYMBOL(erase_if, std::, /*no headers*/)
355391

356392
// cppreference symbol index page was missing these symbols.
357393
// Remove them when the cppreference offline archive catches up.
358-
SYMBOL(index_sequence, std::, <utility>)
359-
SYMBOL(index_sequence_for, std::, <utility>)
360-
SYMBOL(make_index_sequence, std::, <utility>)
361-
SYMBOL(make_integer_sequence, std::, <utility>)
394+
SYMBOL(regular_invocable, std::, <concepts>)
362395

363396
// Symbols missing from the generated symbol map as reported by users.
364397
// Remove when the generator starts producing them.
365-
SYMBOL(make_any, std::, <any>)
366-
SYMBOL(any_cast, std::, <any>)
367398
SYMBOL(div, std::, <cstdlib>)
368399
SYMBOL(abort, std::, <cstdlib>)
400+
SYMBOL(atomic_wait, std::, <atomic>)
401+
SYMBOL(atomic_wait_explicit, std::, <atomic>)
402+
SYMBOL(move_backward, std::, <algorithm>)
403+
SYMBOL(month_weekday, std::chrono::, <chrono>)
369404

370405
SYMBOL(binary_search, std::ranges::, <algorithm>)
371406
SYMBOL(equal_range, std::ranges::, <algorithm>)

0 commit comments

Comments
 (0)