Skip to content

Commit

Permalink
Update std symbol mapping to v20240610; Move assertion to detect all …
Browse files Browse the repository at this point in the history
…ungrouped mappings
  • Loading branch information
vvd170501 committed Oct 30, 2024
1 parent 76fd590 commit 8def842
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 32 deletions.
8 changes: 5 additions & 3 deletions clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,17 @@ 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!");
}
if (SymIndex >= 0 &&
Mapping->SymbolNames[SymIndex].qualifiedName() == QName) {
// Not a new symbol, use the same index.
} else {
// First symbol or new symbol, increment next available index.
++SymIndex;
Expand Down
46 changes: 40 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,37 @@ 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.
SYMBOL(begin, std::ranges::, <ranges>)
SYMBOL(begin, std::ranges::, <iterator>)
SYMBOL(cbegin, std::ranges::, <ranges>)
SYMBOL(cbegin, std::ranges::, <iterator>)
SYMBOL(cdata, std::ranges::, <ranges>)
SYMBOL(cdata, std::ranges::, <iterator>)
SYMBOL(cend, std::ranges::, <ranges>)
SYMBOL(cend, std::ranges::, <iterator>)
SYMBOL(crbegin, std::ranges::, <ranges>)
SYMBOL(crbegin, std::ranges::, <iterator>)
SYMBOL(crend, std::ranges::, <ranges>)
SYMBOL(crend, std::ranges::, <iterator>)
SYMBOL(data, std::ranges::, <ranges>)
SYMBOL(data, std::ranges::, <iterator>)
SYMBOL(empty, std::ranges::, <ranges>)
SYMBOL(empty, std::ranges::, <iterator>)
SYMBOL(end, std::ranges::, <ranges>)
SYMBOL(end, std::ranges::, <iterator>)
SYMBOL(rbegin, std::ranges::, <ranges>)
SYMBOL(rbegin, std::ranges::, <iterator>)
SYMBOL(rend, std::ranges::, <ranges>)
SYMBOL(rend, std::ranges::, <iterator>)
SYMBOL(size, std::ranges::, <ranges>)
SYMBOL(size, std::ranges::, <iterator>)
SYMBOL(ssize, std::ranges::, <ranges>)
SYMBOL(ssize, 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 +383,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>)

// These are C symbols that are not under std namespace.
SYMBOL(localtime_r, None, <ctime>)
Expand Down
Loading

0 comments on commit 8def842

Please sign in to comment.