Skip to content

Commit 96662cb

Browse files
committed
Update std symbol mapping to v20230810; Move assertion to detect all ungrouped mappings
1 parent 95e5a99 commit 96662cb

File tree

3 files changed

+200
-110
lines changed

3 files changed

+200
-110
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,17 @@ 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!");
125+
}
126+
if (SymIndex >= 0 &&
127+
Mapping->SymbolNames[SymIndex].qualifiedName() == QName) {
128+
// Not a new symbol, use the same index.
127129
} else {
128130
// First symbol or new symbol, increment next available index.
129131
++SymIndex;

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

Lines changed: 124 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,23 @@ SYMBOL(ssize, std::, <unordered_map>)
233233
SYMBOL(ssize, std::, <unordered_set>)
234234
SYMBOL(ssize, std::, <vector>)
235235

236+
// Overloads for different containers, actual header depends on function arg.
237+
// Probably should use a special handler, like with std::move.
238+
SYMBOL(erase, std::, <vector>)
239+
SYMBOL(erase, std::, <deque>)
240+
SYMBOL(erase, std::, <string>)
241+
SYMBOL(erase, std::, <list>)
242+
SYMBOL(erase, std::, <forward_list>)
243+
SYMBOL(erase_if, std::, <vector>)
244+
SYMBOL(erase_if, std::, <string>)
245+
SYMBOL(erase_if, std::, <list>)
246+
SYMBOL(erase_if, std::, <forward_list>)
247+
SYMBOL(erase_if, std::, <map>)
248+
SYMBOL(erase_if, std::, <unordered_map>)
249+
SYMBOL(erase_if, std::, <set>)
250+
SYMBOL(erase_if, std::, <deque>)
251+
SYMBOL(erase_if, std::, <unordered_set>)
252+
236253
// Add headers for generic integer-type abs.
237254
// Ignore other variants (std::complex, std::valarray, std::intmax_t)
238255
SYMBOL(abs, std::, <cstdlib>)
@@ -242,9 +259,78 @@ SYMBOL(abs, None, <stdlib.h>)
242259
SYMBOL(abs, None, <cmath>)
243260
SYMBOL(abs, None, <math.h>)
244261

245-
// Only add headers for the generic atomic template.
262+
// Same as abs - ignore variants (std::complex, std::valarray)
263+
SYMBOL(acos, std::, <cmath>)
264+
SYMBOL(acos, None, <cmath>)
265+
SYMBOL(acos, None, <math.h>)
266+
SYMBOL(acosh, std::, <cmath>)
267+
SYMBOL(acosh, None, <cmath>)
268+
SYMBOL(acosh, None, <math.h>)
269+
SYMBOL(asin, std::, <cmath>)
270+
SYMBOL(asin, None, <cmath>)
271+
SYMBOL(asin, None, <math.h>)
272+
SYMBOL(asinh, std::, <cmath>)
273+
SYMBOL(asinh, None, <cmath>)
274+
SYMBOL(asinh, None, <math.h>)
275+
SYMBOL(atan, std::, <cmath>)
276+
SYMBOL(atan, None, <cmath>)
277+
SYMBOL(atan, None, <math.h>)
278+
SYMBOL(atan2, std::, <cmath>)
279+
SYMBOL(atan2, None, <cmath>)
280+
SYMBOL(atan2, None, <math.h>)
281+
SYMBOL(atanh, std::, <cmath>)
282+
SYMBOL(atanh, None, <cmath>)
283+
SYMBOL(atanh, None, <math.h>)
284+
SYMBOL(cos, std::, <cmath>)
285+
SYMBOL(cos, None, <cmath>)
286+
SYMBOL(cos, None, <math.h>)
287+
SYMBOL(cosh, std::, <cmath>)
288+
SYMBOL(cosh, None, <cmath>)
289+
SYMBOL(cosh, None, <math.h>)
290+
SYMBOL(exp, std::, <cmath>)
291+
SYMBOL(exp, None, <cmath>)
292+
SYMBOL(exp, None, <math.h>)
293+
SYMBOL(log, std::, <cmath>)
294+
SYMBOL(log, None, <cmath>)
295+
SYMBOL(log, None, <math.h>)
296+
SYMBOL(log10, std::, <cmath>)
297+
SYMBOL(log10, None, <cmath>)
298+
SYMBOL(log10, None, <math.h>)
299+
SYMBOL(pow, std::, <cmath>)
300+
SYMBOL(pow, None, <cmath>)
301+
SYMBOL(pow, None, <math.h>)
302+
SYMBOL(sin, std::, <cmath>)
303+
SYMBOL(sin, None, <cmath>)
304+
SYMBOL(sin, None, <math.h>)
305+
SYMBOL(sinh, std::, <cmath>)
306+
SYMBOL(sinh, None, <cmath>)
307+
SYMBOL(sinh, None, <math.h>)
308+
SYMBOL(sqrt, std::, <cmath>)
309+
SYMBOL(sqrt, None, <cmath>)
310+
SYMBOL(sqrt, None, <math.h>)
311+
SYMBOL(tan, std::, <cmath>)
312+
SYMBOL(tan, None, <cmath>)
313+
SYMBOL(tan, None, <math.h>)
314+
SYMBOL(tanh, std::, <cmath>)
315+
SYMBOL(tanh, None, <cmath>)
316+
SYMBOL(tanh, None, <math.h>)
317+
318+
// Only add headers for the generic atomic template
319+
// and atomic_* template functions.
246320
// Ignore variants (std::weak_ptr, std::shared_ptr).
247321
SYMBOL(atomic, std::, <atomic>)
322+
SYMBOL(atomic_compare_exchange_strong, std::, <atomic>)
323+
SYMBOL(atomic_compare_exchange_strong_explicit, std::, <atomic>)
324+
SYMBOL(atomic_compare_exchange_weak, std::, <atomic>)
325+
SYMBOL(atomic_compare_exchange_weak_explicit, std::, <atomic>)
326+
SYMBOL(atomic_exchange, std::, <atomic>)
327+
SYMBOL(atomic_exchange_explicit, std::, <atomic>)
328+
SYMBOL(atomic_is_lock_free, std::, <atomic>)
329+
SYMBOL(atomic_load, std::, <atomic>)
330+
SYMBOL(atomic_load_explicit, std::, <atomic>)
331+
SYMBOL(atomic_store, std::, <atomic>)
332+
SYMBOL(atomic_store_explicit, std::, <atomic>)
333+
248334
// atomic_* family symbols. <stdatomic.h> is for C compatibility.
249335
SYMBOL(atomic_bool, std::, <atomic>)
250336
SYMBOL(atomic_bool, None, <stdatomic.h>)
@@ -355,18 +441,49 @@ SYMBOL(make_error_condition, std::, /*no headers*/)
355441

356442
// cppreference symbol index page was missing these symbols.
357443
// 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>)
444+
SYMBOL(add_pointer_t, std::, <type_traits>)
445+
SYMBOL(regular_invocable, std::, <concepts>)
362446

363447
// Symbols missing from the generated symbol map as reported by users.
364448
// Remove when the generator starts producing them.
365-
SYMBOL(make_any, std::, <any>)
366-
SYMBOL(any_cast, std::, <any>)
367449
SYMBOL(div, std::, <cstdlib>)
368450
SYMBOL(abort, std::, <cstdlib>)
369451

452+
// Class declaration was broken, header wasn't rendered.
453+
// Remove when the cppreference offline archive catches up.
454+
SYMBOL(month_weekday, std::chrono::, <chrono>)
455+
456+
// FIXME Ambiguous symbols
457+
// Not sure if they should be updated, this is copied from v20220730
458+
SYMBOL(filebuf, std::, <streambuf>)
459+
SYMBOL(filebuf, std::, <iostream>)
460+
SYMBOL(filebuf, std::, <iosfwd>)
461+
SYMBOL(istream, std::, <istream>)
462+
SYMBOL(istream, std::, <iostream>)
463+
SYMBOL(istream, std::, <iosfwd>)
464+
SYMBOL(ostream, std::, <ostream>)
465+
SYMBOL(ostream, std::, <iostream>)
466+
SYMBOL(ostream, std::, <iosfwd>)
467+
SYMBOL(streampos, std::, <iosfwd>)
468+
SYMBOL(streampos, std::, <iosfwd>)
469+
SYMBOL(u16streampos, std::, <iosfwd>)
470+
SYMBOL(u16streampos, std::, <iosfwd>)
471+
SYMBOL(u32streampos, std::, <iosfwd>)
472+
SYMBOL(u32streampos, std::, <iosfwd>)
473+
SYMBOL(u8streampos, std::, <iosfwd>)
474+
SYMBOL(u8streampos, std::, <iosfwd>)
475+
SYMBOL(wfilebuf, std::, <streambuf>)
476+
SYMBOL(wfilebuf, std::, <iostream>)
477+
SYMBOL(wfilebuf, std::, <iosfwd>)
478+
SYMBOL(wistream, std::, <istream>)
479+
SYMBOL(wistream, std::, <iostream>)
480+
SYMBOL(wistream, std::, <iosfwd>)
481+
SYMBOL(wostream, std::, <ostream>)
482+
SYMBOL(wostream, std::, <iostream>)
483+
SYMBOL(wostream, std::, <iosfwd>)
484+
SYMBOL(wstreampos, std::, <iosfwd>)
485+
SYMBOL(wstreampos, std::, <iosfwd>)
486+
370487
// These are C symbols that are not under std namespace.
371488
SYMBOL(localtime_r, None, <ctime>)
372489
SYMBOL(localtime_r, None, <time.h>)

0 commit comments

Comments
 (0)