Skip to content

[Tooling/Inclusion] Update std symbols mapping #113612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,19 @@ static int initialize(Lang Language) {
NSLen = 0;
}

if (SymIndex >= 0 &&
Mapping->SymbolNames[SymIndex].qualifiedName() == QName) {
// Not a new symbol, use the same index.
if (SymIndex > 0) {
assert(llvm::none_of(llvm::ArrayRef(Mapping->SymbolNames, SymIndex),
[&QName](const SymbolHeaderMapping::SymbolName &S) {
return S.qualifiedName() == QName;
}) &&
"The symbol has been added before, make sure entries in the .inc "
"file are grouped by symbol name!");
} else {
}
if (SymIndex < 0 ||
Mapping->SymbolNames[SymIndex].qualifiedName() != QName) {
// First symbol or new symbol, increment next available index.
++SymIndex;
}
} // Else use the same index.
Mapping->SymbolNames[SymIndex] = {
QName.data(), NSLen, static_cast<unsigned int>(QName.size() - NSLen)};
if (!HeaderName.empty())
Expand Down
47 changes: 41 additions & 6 deletions clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,38 @@ SYMBOL(ssize, std::, <string_view>)
SYMBOL(ssize, std::, <unordered_map>)
SYMBOL(ssize, std::, <unordered_set>)
SYMBOL(ssize, std::, <vector>)
// C++ [range.access.general]: ... the customization point objects
// in [range.access] are available when the header <iterator> is included.
// (see https://eel.is/c++draft/range.access#general)
SYMBOL(begin, std::ranges::, <ranges>)
SYMBOL(begin, std::ranges::, <iterator>)
SYMBOL(end, std::ranges::, <ranges>)
SYMBOL(end, std::ranges::, <iterator>)
SYMBOL(cbegin, std::ranges::, <ranges>)
SYMBOL(cbegin, std::ranges::, <iterator>)
SYMBOL(cend, std::ranges::, <ranges>)
SYMBOL(cend, std::ranges::, <iterator>)
SYMBOL(rbegin, std::ranges::, <ranges>)
SYMBOL(rbegin, std::ranges::, <iterator>)
SYMBOL(rend, std::ranges::, <ranges>)
SYMBOL(rend, std::ranges::, <iterator>)
SYMBOL(crbegin, std::ranges::, <ranges>)
SYMBOL(crbegin, std::ranges::, <iterator>)
SYMBOL(crend, std::ranges::, <ranges>)
SYMBOL(crend, std::ranges::, <iterator>)
SYMBOL(size, std::ranges::, <ranges>)
SYMBOL(size, std::ranges::, <iterator>)
SYMBOL(ssize, std::ranges::, <ranges>)
SYMBOL(ssize, std::ranges::, <iterator>)
SYMBOL(empty, std::ranges::, <ranges>)
SYMBOL(empty, std::ranges::, <iterator>)
SYMBOL(data, std::ranges::, <ranges>)
SYMBOL(data, std::ranges::, <iterator>)
SYMBOL(cdata, std::ranges::, <ranges>)
SYMBOL(cdata, std::ranges::, <iterator>)

// Ignore specializations
SYMBOL(hash, std::, <functional>)

// Add headers for generic integer-type abs.
// Ignore other variants (std::complex, std::valarray, std::intmax_t)
Expand Down Expand Up @@ -352,20 +384,23 @@ SYMBOL(get, std::, /*no headers*/)
// providing the type.
SYMBOL(make_error_code, std::, /*no headers*/)
SYMBOL(make_error_condition, std::, /*no headers*/)
// Similar to std::get, has variants for multiple containers
// (vector, deque, list, etc.)
SYMBOL(erase, std::, /*no headers*/)
SYMBOL(erase_if, std::, /*no headers*/)

// cppreference symbol index page was missing these symbols.
// Remove them when the cppreference offline archive catches up.
SYMBOL(index_sequence, std::, <utility>)
SYMBOL(index_sequence_for, std::, <utility>)
SYMBOL(make_index_sequence, std::, <utility>)
SYMBOL(make_integer_sequence, std::, <utility>)
SYMBOL(regular_invocable, std::, <concepts>)

// Symbols missing from the generated symbol map as reported by users.
// Remove when the generator starts producing them.
SYMBOL(make_any, std::, <any>)
SYMBOL(any_cast, std::, <any>)
SYMBOL(div, std::, <cstdlib>)
SYMBOL(abort, std::, <cstdlib>)
SYMBOL(atomic_wait, std::, <atomic>)
SYMBOL(atomic_wait_explicit, std::, <atomic>)
SYMBOL(move_backward, std::, <algorithm>)
SYMBOL(month_weekday, std::chrono::, <chrono>)

SYMBOL(binary_search, std::ranges::, <algorithm>)
SYMBOL(equal_range, std::ranges::, <algorithm>)
Expand Down
Loading
Loading