diff --git a/clang/include/clang/Tooling/Inclusions/CSymbolMap.inc b/clang/include/clang/Tooling/Inclusions/CSymbolMap.inc --- a/clang/include/clang/Tooling/Inclusions/CSymbolMap.inc +++ b/clang/include/clang/Tooling/Inclusions/CSymbolMap.inc @@ -77,6 +77,11 @@ SYMBOL(FLT_ROUNDS, None, ) SYMBOL(FLT_TRUE_MIN, None, ) SYMBOL(FOPEN_MAX, None, ) +SYMBOL(FP_FAST_FMA, None, ) +SYMBOL(FP_FAST_FMAF, None, ) +SYMBOL(FP_FAST_FMAL, None, ) +SYMBOL(FP_ILOGB0, None, ) +SYMBOL(FP_ILOGBNAN, None, ) SYMBOL(FP_INFINITE, None, ) SYMBOL(FP_NAN, None, ) SYMBOL(FP_NORNAL, None, ) @@ -87,14 +92,24 @@ SYMBOL(HUGE_VALL, None, ) SYMBOL(I, None, ) SYMBOL(INFINITY, None, ) +SYMBOL(INT16_C, None, ) +SYMBOL(INT16_C, None, ) SYMBOL(INT16_MAX, None, ) SYMBOL(INT16_MIN, None, ) +SYMBOL(INT32_C, None, ) +SYMBOL(INT32_C, None, ) SYMBOL(INT32_MAX, None, ) SYMBOL(INT32_MIN, None, ) +SYMBOL(INT64_C, None, ) +SYMBOL(INT64_C, None, ) SYMBOL(INT64_MAX, None, ) SYMBOL(INT64_MIN, None, ) +SYMBOL(INT8_C, None, ) +SYMBOL(INT8_C, None, ) SYMBOL(INT8_MAX, None, ) SYMBOL(INT8_MIN, None, ) +SYMBOL(INTMAX_C, None, ) +SYMBOL(INTMAX_C, None, ) SYMBOL(INTMAX_MAX, None, ) SYMBOL(INTMAX_MIN, None, ) SYMBOL(INTPTR_MAX, None, ) @@ -146,13 +161,328 @@ SYMBOL(MB_CUR_MAX, None, ) SYMBOL(MB_LEN_MAX, None, ) SYMBOL(NAN, None, ) +SYMBOL(NULL, None, ) +SYMBOL(NULL, None, ) +SYMBOL(NULL, None, ) +SYMBOL(NULL, None, ) +SYMBOL(NULL, None, ) +SYMBOL(NULL, None, ) +SYMBOL(NULL, None, ) SYMBOL(ONCE_FLAG_INIT, None, ) +SYMBOL(PRIX16, None, ) +SYMBOL(PRIX16, None, ) +SYMBOL(PRIX32, None, ) +SYMBOL(PRIX32, None, ) +SYMBOL(PRIX64, None, ) +SYMBOL(PRIX64, None, ) +SYMBOL(PRIX8, None, ) +SYMBOL(PRIX8, None, ) +SYMBOL(PRIXFAST16, None, ) +SYMBOL(PRIXFAST16, None, ) +SYMBOL(PRIXFAST32, None, ) +SYMBOL(PRIXFAST32, None, ) +SYMBOL(PRIXFAST64, None, ) +SYMBOL(PRIXFAST64, None, ) +SYMBOL(PRIXFAST8, None, ) +SYMBOL(PRIXFAST8, None, ) +SYMBOL(PRIXLEAST16, None, ) +SYMBOL(PRIXLEAST16, None, ) +SYMBOL(PRIXLEAST32, None, ) +SYMBOL(PRIXLEAST32, None, ) +SYMBOL(PRIXLEAST64, None, ) +SYMBOL(PRIXLEAST64, None, ) +SYMBOL(PRIXLEAST8, None, ) +SYMBOL(PRIXLEAST8, None, ) +SYMBOL(PRIXMAX, None, ) +SYMBOL(PRIXMAX, None, ) +SYMBOL(PRIXPTR, None, ) +SYMBOL(PRIXPTR, None, ) +SYMBOL(PRId16, None, ) +SYMBOL(PRId16, None, ) +SYMBOL(PRId32, None, ) +SYMBOL(PRId32, None, ) +SYMBOL(PRId64, None, ) +SYMBOL(PRId64, None, ) +SYMBOL(PRId8, None, ) +SYMBOL(PRId8, None, ) +SYMBOL(PRIdFAST16, None, ) +SYMBOL(PRIdFAST16, None, ) +SYMBOL(PRIdFAST32, None, ) +SYMBOL(PRIdFAST32, None, ) +SYMBOL(PRIdFAST64, None, ) +SYMBOL(PRIdFAST64, None, ) +SYMBOL(PRIdFAST8, None, ) +SYMBOL(PRIdFAST8, None, ) +SYMBOL(PRIdLEAST16, None, ) +SYMBOL(PRIdLEAST16, None, ) +SYMBOL(PRIdLEAST32, None, ) +SYMBOL(PRIdLEAST32, None, ) +SYMBOL(PRIdLEAST64, None, ) +SYMBOL(PRIdLEAST64, None, ) +SYMBOL(PRIdLEAST8, None, ) +SYMBOL(PRIdLEAST8, None, ) +SYMBOL(PRIdMAX, None, ) +SYMBOL(PRIdMAX, None, ) +SYMBOL(PRIdPTR, None, ) +SYMBOL(PRIdPTR, None, ) +SYMBOL(PRIi16, None, ) +SYMBOL(PRIi16, None, ) +SYMBOL(PRIi32, None, ) +SYMBOL(PRIi32, None, ) +SYMBOL(PRIi64, None, ) +SYMBOL(PRIi64, None, ) +SYMBOL(PRIi8, None, ) +SYMBOL(PRIi8, None, ) +SYMBOL(PRIiFAST16, None, ) +SYMBOL(PRIiFAST16, None, ) +SYMBOL(PRIiFAST32, None, ) +SYMBOL(PRIiFAST32, None, ) +SYMBOL(PRIiFAST64, None, ) +SYMBOL(PRIiFAST64, None, ) +SYMBOL(PRIiFAST8, None, ) +SYMBOL(PRIiFAST8, None, ) +SYMBOL(PRIiLEAST16, None, ) +SYMBOL(PRIiLEAST16, None, ) +SYMBOL(PRIiLEAST32, None, ) +SYMBOL(PRIiLEAST32, None, ) +SYMBOL(PRIiLEAST64, None, ) +SYMBOL(PRIiLEAST64, None, ) +SYMBOL(PRIiLEAST8, None, ) +SYMBOL(PRIiLEAST8, None, ) +SYMBOL(PRIiMAX, None, ) +SYMBOL(PRIiMAX, None, ) +SYMBOL(PRIiPTR, None, ) +SYMBOL(PRIiPTR, None, ) +SYMBOL(PRIo16, None, ) +SYMBOL(PRIo16, None, ) +SYMBOL(PRIo32, None, ) +SYMBOL(PRIo32, None, ) +SYMBOL(PRIo64, None, ) +SYMBOL(PRIo64, None, ) +SYMBOL(PRIo8, None, ) +SYMBOL(PRIo8, None, ) +SYMBOL(PRIoFAST16, None, ) +SYMBOL(PRIoFAST16, None, ) +SYMBOL(PRIoFAST32, None, ) +SYMBOL(PRIoFAST32, None, ) +SYMBOL(PRIoFAST64, None, ) +SYMBOL(PRIoFAST64, None, ) +SYMBOL(PRIoFAST8, None, ) +SYMBOL(PRIoFAST8, None, ) +SYMBOL(PRIoLEAST16, None, ) +SYMBOL(PRIoLEAST16, None, ) +SYMBOL(PRIoLEAST32, None, ) +SYMBOL(PRIoLEAST32, None, ) +SYMBOL(PRIoLEAST64, None, ) +SYMBOL(PRIoLEAST64, None, ) +SYMBOL(PRIoLEAST8, None, ) +SYMBOL(PRIoLEAST8, None, ) +SYMBOL(PRIoMAX, None, ) +SYMBOL(PRIoMAX, None, ) +SYMBOL(PRIoPTR, None, ) +SYMBOL(PRIoPTR, None, ) +SYMBOL(PRIu16, None, ) +SYMBOL(PRIu16, None, ) +SYMBOL(PRIu32, None, ) +SYMBOL(PRIu32, None, ) +SYMBOL(PRIu64, None, ) +SYMBOL(PRIu64, None, ) +SYMBOL(PRIu8, None, ) +SYMBOL(PRIu8, None, ) +SYMBOL(PRIuFAST16, None, ) +SYMBOL(PRIuFAST16, None, ) +SYMBOL(PRIuFAST32, None, ) +SYMBOL(PRIuFAST32, None, ) +SYMBOL(PRIuFAST64, None, ) +SYMBOL(PRIuFAST64, None, ) +SYMBOL(PRIuFAST8, None, ) +SYMBOL(PRIuFAST8, None, ) +SYMBOL(PRIuLEAST16, None, ) +SYMBOL(PRIuLEAST16, None, ) +SYMBOL(PRIuLEAST32, None, ) +SYMBOL(PRIuLEAST32, None, ) +SYMBOL(PRIuLEAST64, None, ) +SYMBOL(PRIuLEAST64, None, ) +SYMBOL(PRIuLEAST8, None, ) +SYMBOL(PRIuLEAST8, None, ) +SYMBOL(PRIuMAX, None, ) +SYMBOL(PRIuMAX, None, ) +SYMBOL(PRIuPTR, None, ) +SYMBOL(PRIuPTR, None, ) +SYMBOL(PRIx16, None, ) +SYMBOL(PRIx16, None, ) +SYMBOL(PRIx32, None, ) +SYMBOL(PRIx32, None, ) +SYMBOL(PRIx64, None, ) +SYMBOL(PRIx64, None, ) +SYMBOL(PRIx8, None, ) +SYMBOL(PRIx8, None, ) +SYMBOL(PRIxFAST16, None, ) +SYMBOL(PRIxFAST16, None, ) +SYMBOL(PRIxFAST32, None, ) +SYMBOL(PRIxFAST32, None, ) +SYMBOL(PRIxFAST64, None, ) +SYMBOL(PRIxFAST64, None, ) +SYMBOL(PRIxFAST8, None, ) +SYMBOL(PRIxFAST8, None, ) +SYMBOL(PRIxLEAST16, None, ) +SYMBOL(PRIxLEAST16, None, ) +SYMBOL(PRIxLEAST32, None, ) +SYMBOL(PRIxLEAST32, None, ) +SYMBOL(PRIxLEAST64, None, ) +SYMBOL(PRIxLEAST64, None, ) +SYMBOL(PRIxLEAST8, None, ) +SYMBOL(PRIxLEAST8, None, ) +SYMBOL(PRIxMAX, None, ) +SYMBOL(PRIxMAX, None, ) +SYMBOL(PRIxPTR, None, ) +SYMBOL(PRIxPTR, None, ) SYMBOL(PTRDIFF_MAX, None, ) SYMBOL(PTRDIFF_MIN, None, ) SYMBOL(RAND_MAX, None, ) SYMBOL(RSIZE_MAX, None, ) SYMBOL(SCHAR_MAX, None, ) SYMBOL(SCHAR_MIN, None, ) +SYMBOL(SCNd16, None, ) +SYMBOL(SCNd16, None, ) +SYMBOL(SCNd32, None, ) +SYMBOL(SCNd32, None, ) +SYMBOL(SCNd64, None, ) +SYMBOL(SCNd64, None, ) +SYMBOL(SCNd8, None, ) +SYMBOL(SCNd8, None, ) +SYMBOL(SCNdFAST16, None, ) +SYMBOL(SCNdFAST16, None, ) +SYMBOL(SCNdFAST32, None, ) +SYMBOL(SCNdFAST32, None, ) +SYMBOL(SCNdFAST64, None, ) +SYMBOL(SCNdFAST64, None, ) +SYMBOL(SCNdFAST8, None, ) +SYMBOL(SCNdFAST8, None, ) +SYMBOL(SCNdLEAST16, None, ) +SYMBOL(SCNdLEAST16, None, ) +SYMBOL(SCNdLEAST32, None, ) +SYMBOL(SCNdLEAST32, None, ) +SYMBOL(SCNdLEAST64, None, ) +SYMBOL(SCNdLEAST64, None, ) +SYMBOL(SCNdLEAST8, None, ) +SYMBOL(SCNdLEAST8, None, ) +SYMBOL(SCNdMAX, None, ) +SYMBOL(SCNdMAX, None, ) +SYMBOL(SCNdPTR, None, ) +SYMBOL(SCNdPTR, None, ) +SYMBOL(SCNi16, None, ) +SYMBOL(SCNi16, None, ) +SYMBOL(SCNi32, None, ) +SYMBOL(SCNi32, None, ) +SYMBOL(SCNi64, None, ) +SYMBOL(SCNi64, None, ) +SYMBOL(SCNi8, None, ) +SYMBOL(SCNi8, None, ) +SYMBOL(SCNiFAST16, None, ) +SYMBOL(SCNiFAST16, None, ) +SYMBOL(SCNiFAST32, None, ) +SYMBOL(SCNiFAST32, None, ) +SYMBOL(SCNiFAST64, None, ) +SYMBOL(SCNiFAST64, None, ) +SYMBOL(SCNiFAST8, None, ) +SYMBOL(SCNiFAST8, None, ) +SYMBOL(SCNiLEAST16, None, ) +SYMBOL(SCNiLEAST16, None, ) +SYMBOL(SCNiLEAST32, None, ) +SYMBOL(SCNiLEAST32, None, ) +SYMBOL(SCNiLEAST64, None, ) +SYMBOL(SCNiLEAST64, None, ) +SYMBOL(SCNiLEAST8, None, ) +SYMBOL(SCNiLEAST8, None, ) +SYMBOL(SCNiMAX, None, ) +SYMBOL(SCNiMAX, None, ) +SYMBOL(SCNiPTR, None, ) +SYMBOL(SCNiPTR, None, ) +SYMBOL(SCNo16, None, ) +SYMBOL(SCNo16, None, ) +SYMBOL(SCNo32, None, ) +SYMBOL(SCNo32, None, ) +SYMBOL(SCNo64, None, ) +SYMBOL(SCNo64, None, ) +SYMBOL(SCNo8, None, ) +SYMBOL(SCNo8, None, ) +SYMBOL(SCNoFAST16, None, ) +SYMBOL(SCNoFAST16, None, ) +SYMBOL(SCNoFAST32, None, ) +SYMBOL(SCNoFAST32, None, ) +SYMBOL(SCNoFAST64, None, ) +SYMBOL(SCNoFAST64, None, ) +SYMBOL(SCNoFAST8, None, ) +SYMBOL(SCNoFAST8, None, ) +SYMBOL(SCNoLEAST16, None, ) +SYMBOL(SCNoLEAST16, None, ) +SYMBOL(SCNoLEAST32, None, ) +SYMBOL(SCNoLEAST32, None, ) +SYMBOL(SCNoLEAST64, None, ) +SYMBOL(SCNoLEAST64, None, ) +SYMBOL(SCNoLEAST8, None, ) +SYMBOL(SCNoLEAST8, None, ) +SYMBOL(SCNoMAX, None, ) +SYMBOL(SCNoMAX, None, ) +SYMBOL(SCNoPTR, None, ) +SYMBOL(SCNoPTR, None, ) +SYMBOL(SCNu16, None, ) +SYMBOL(SCNu16, None, ) +SYMBOL(SCNu32, None, ) +SYMBOL(SCNu32, None, ) +SYMBOL(SCNu64, None, ) +SYMBOL(SCNu64, None, ) +SYMBOL(SCNu8, None, ) +SYMBOL(SCNu8, None, ) +SYMBOL(SCNuFAST16, None, ) +SYMBOL(SCNuFAST16, None, ) +SYMBOL(SCNuFAST32, None, ) +SYMBOL(SCNuFAST32, None, ) +SYMBOL(SCNuFAST64, None, ) +SYMBOL(SCNuFAST64, None, ) +SYMBOL(SCNuFAST8, None, ) +SYMBOL(SCNuFAST8, None, ) +SYMBOL(SCNuLEAST16, None, ) +SYMBOL(SCNuLEAST16, None, ) +SYMBOL(SCNuLEAST32, None, ) +SYMBOL(SCNuLEAST32, None, ) +SYMBOL(SCNuLEAST64, None, ) +SYMBOL(SCNuLEAST64, None, ) +SYMBOL(SCNuLEAST8, None, ) +SYMBOL(SCNuLEAST8, None, ) +SYMBOL(SCNuMAX, None, ) +SYMBOL(SCNuMAX, None, ) +SYMBOL(SCNuPTR, None, ) +SYMBOL(SCNuPTR, None, ) +SYMBOL(SCNx16, None, ) +SYMBOL(SCNx16, None, ) +SYMBOL(SCNx32, None, ) +SYMBOL(SCNx32, None, ) +SYMBOL(SCNx64, None, ) +SYMBOL(SCNx64, None, ) +SYMBOL(SCNx8, None, ) +SYMBOL(SCNx8, None, ) +SYMBOL(SCNxFAST16, None, ) +SYMBOL(SCNxFAST16, None, ) +SYMBOL(SCNxFAST32, None, ) +SYMBOL(SCNxFAST32, None, ) +SYMBOL(SCNxFAST64, None, ) +SYMBOL(SCNxFAST64, None, ) +SYMBOL(SCNxFAST8, None, ) +SYMBOL(SCNxFAST8, None, ) +SYMBOL(SCNxLEAST16, None, ) +SYMBOL(SCNxLEAST16, None, ) +SYMBOL(SCNxLEAST32, None, ) +SYMBOL(SCNxLEAST32, None, ) +SYMBOL(SCNxLEAST64, None, ) +SYMBOL(SCNxLEAST64, None, ) +SYMBOL(SCNxLEAST8, None, ) +SYMBOL(SCNxLEAST8, None, ) +SYMBOL(SCNxMAX, None, ) +SYMBOL(SCNxMAX, None, ) +SYMBOL(SCNxPTR, None, ) +SYMBOL(SCNxPTR, None, ) SYMBOL(SEEK_CUR, None, ) SYMBOL(SEEK_END, None, ) SYMBOL(SEEK_SET, None, ) @@ -175,10 +505,20 @@ SYMBOL(TMP_MAX_S, None, ) SYMBOL(TSS_DTOR_ITERATIONS, None, ) SYMBOL(UCHAR_MAX, None, ) +SYMBOL(UINT16_C, None, ) +SYMBOL(UINT16_C, None, ) SYMBOL(UINT16_MAX, None, ) +SYMBOL(UINT32_C, None, ) +SYMBOL(UINT32_C, None, ) SYMBOL(UINT32_MAX, None, ) +SYMBOL(UINT64_C, None, ) +SYMBOL(UINT64_C, None, ) SYMBOL(UINT64_MAX, None, ) +SYMBOL(UINT8_C, None, ) +SYMBOL(UINT8_C, None, ) SYMBOL(UINT8_MAX, None, ) +SYMBOL(UINTMAX_C, None, ) +SYMBOL(UINTMAX_C, None, ) SYMBOL(UINTMAX_MAX, None, ) SYMBOL(UINTPTR_MAX, None, ) SYMBOL(UINT_FAST16_MAX, None, ) @@ -416,6 +756,8 @@ SYMBOL(ctime, None, ) SYMBOL(ctime_s, None, ) SYMBOL(difftime, None, ) +SYMBOL(div, None, ) +SYMBOL(div_t, None, ) SYMBOL(double_t, None, ) SYMBOL(erf, None, ) SYMBOL(erfc, None, ) @@ -424,6 +766,8 @@ SYMBOL(erff, None, ) SYMBOL(erfl, None, ) SYMBOL(errno, None, ) +SYMBOL(errno_t, None, ) +SYMBOL(errno_t, None, ) SYMBOL(exit, None, ) SYMBOL(exp, None, ) SYMBOL(exp2, None, ) @@ -525,6 +869,8 @@ SYMBOL(ilogbl, None, ) SYMBOL(imaginary, None, ) SYMBOL(imaxabs, None, ) +SYMBOL(imaxdiv, None, ) +SYMBOL(imaxdiv_t, None, ) SYMBOL(int16_t, None, ) SYMBOL(int32_t, None, ) SYMBOL(int64_t, None, ) @@ -581,10 +927,14 @@ SYMBOL(ldexp, None, ) SYMBOL(ldexpf, None, ) SYMBOL(ldexpl, None, ) +SYMBOL(ldiv, None, ) +SYMBOL(ldiv_t, None, ) SYMBOL(lgamma, None, ) SYMBOL(lgammaf, None, ) SYMBOL(lgammal, None, ) SYMBOL(llabs, None, ) +SYMBOL(lldiv, None, ) +SYMBOL(lldiv_t, None, ) SYMBOL(llrint, None, ) SYMBOL(llrintf, None, ) SYMBOL(llrintl, None, ) @@ -627,6 +977,8 @@ SYMBOL(mbsinit, None, ) SYMBOL(mbsrtowcs, None, ) SYMBOL(mbsrtowcs_s, None, ) +SYMBOL(mbstate_t, None, ) +SYMBOL(mbstate_t, None, ) SYMBOL(mbstowcs, None, ) SYMBOL(mbstowcs_s, None, ) SYMBOL(mbtowc, None, ) @@ -734,6 +1086,13 @@ SYMBOL(sinhf, None, ) SYMBOL(sinhl, None, ) SYMBOL(sinl, None, ) +SYMBOL(size_t, None, ) +SYMBOL(size_t, None, ) +SYMBOL(size_t, None, ) +SYMBOL(size_t, None, ) +SYMBOL(size_t, None, ) +SYMBOL(size_t, None, ) +SYMBOL(size_t, None, ) SYMBOL(snprintf, None, ) SYMBOL(snprintf_s, None, ) SYMBOL(snwprintf_s, None, ) diff --git a/clang/include/clang/Tooling/Inclusions/StdSymbolMap.inc b/clang/include/clang/Tooling/Inclusions/StdSymbolMap.inc --- a/clang/include/clang/Tooling/Inclusions/StdSymbolMap.inc +++ b/clang/include/clang/Tooling/Inclusions/StdSymbolMap.inc @@ -97,6 +97,11 @@ SYMBOL(atoi, std::, ) SYMBOL(atol, std::, ) SYMBOL(atoll, std::, ) +SYMBOL(atomic, std::, ) +SYMBOL(atomic_bool, std::, ) +SYMBOL(atomic_char, std::, ) +SYMBOL(atomic_char16_t, std::, ) +SYMBOL(atomic_char32_t, std::, ) SYMBOL(atomic_compare_exchange_strong, std::, ) SYMBOL(atomic_compare_exchange_strong_explicit, std::, ) SYMBOL(atomic_compare_exchange_weak, std::, ) @@ -119,14 +124,51 @@ SYMBOL(atomic_flag_test_and_set, std::, ) SYMBOL(atomic_flag_test_and_set_explicit, std::, ) SYMBOL(atomic_init, std::, ) +SYMBOL(atomic_int, std::, ) +SYMBOL(atomic_int16_t, std::, ) +SYMBOL(atomic_int32_t, std::, ) +SYMBOL(atomic_int64_t, std::, ) +SYMBOL(atomic_int8_t, std::, ) +SYMBOL(atomic_int_fast16_t, std::, ) +SYMBOL(atomic_int_fast32_t, std::, ) +SYMBOL(atomic_int_fast64_t, std::, ) +SYMBOL(atomic_int_fast8_t, std::, ) +SYMBOL(atomic_intmax_t, std::, ) +SYMBOL(atomic_intptr_t, std::, ) SYMBOL(atomic_is_lockfree, std::, ) +SYMBOL(atomic_llong, std::, ) SYMBOL(atomic_load, std::, ) SYMBOL(atomic_load_explicit, std::, ) +SYMBOL(atomic_long, std::, ) +SYMBOL(atomic_ptrdiff_t, std::, ) SYMBOL(atomic_ref, std::, ) +SYMBOL(atomic_schar, std::, ) +SYMBOL(atomic_short, std::, ) SYMBOL(atomic_signal_fence, std::, ) +SYMBOL(atomic_size_t, std::, ) SYMBOL(atomic_store, std::, ) SYMBOL(atomic_store_explicit, std::, ) SYMBOL(atomic_thread_fence, std::, ) +SYMBOL(atomic_uchar, std::, ) +SYMBOL(atomic_uint, std::, ) +SYMBOL(atomic_uint16_t, std::, ) +SYMBOL(atomic_uint32_t, std::, ) +SYMBOL(atomic_uint64_t, std::, ) +SYMBOL(atomic_uint8_t, std::, ) +SYMBOL(atomic_uint_fast16_t, std::, ) +SYMBOL(atomic_uint_fast32_t, std::, ) +SYMBOL(atomic_uint_fast64_t, std::, ) +SYMBOL(atomic_uint_fast8_t, std::, ) +SYMBOL(atomic_uint_least16_t, std::, ) +SYMBOL(atomic_uint_least32_t, std::, ) +SYMBOL(atomic_uint_least64_t, std::, ) +SYMBOL(atomic_uint_least8_t, std::, ) +SYMBOL(atomic_uintmax_t, std::, ) +SYMBOL(atomic_uintptr_t, std::, ) +SYMBOL(atomic_ullong, std::, ) +SYMBOL(atomic_ulong, std::, ) +SYMBOL(atomic_ushort, std::, ) +SYMBOL(atomic_wchar_t, std::, ) SYMBOL(atto, std::, ) SYMBOL(auto_ptr, std::, ) SYMBOL(back_insert_iterator, std::, ) @@ -226,6 +268,7 @@ SYMBOL(conjunction, std::, ) SYMBOL(conjunction_v, std::, ) SYMBOL(const_pointer_cast, std::, ) +SYMBOL(consume_header, std::, ) SYMBOL(contract_violation, std::, ) SYMBOL(copy, std::, ) SYMBOL(copy_backward, std::, ) @@ -279,6 +322,7 @@ SYMBOL(disjunction, std::, ) SYMBOL(disjunction_v, std::, ) SYMBOL(distance, std::, ) +SYMBOL(div, std::, ) SYMBOL(div_t, std::, ) SYMBOL(divides, std::, ) SYMBOL(domain_error, std::, ) @@ -403,6 +447,7 @@ SYMBOL(gcd, std::, ) SYMBOL(generate, std::, ) SYMBOL(generate_canonical, std::, ) +SYMBOL(generate_header, std::, ) SYMBOL(generate_n, std::, ) SYMBOL(generic_category, std::, ) SYMBOL(geometric_distribution, std::, ) @@ -711,6 +756,7 @@ SYMBOL(lgamma, std::, ) SYMBOL(linear_congruential_engine, std::, ) SYMBOL(list, std::, ) +SYMBOL(little_endian, std::, ) SYMBOL(llabs, std::, ) SYMBOL(lldiv, std::, ) SYMBOL(lldiv_t, std::, ) @@ -764,6 +810,8 @@ SYMBOL(mbrtowc, std::, ) SYMBOL(mbsinit, std::, ) SYMBOL(mbsrtowcs, std::, ) +SYMBOL(mbstate_t, std::, ) +SYMBOL(mbstate_t, std::, ) SYMBOL(mbstowcs, std::, ) SYMBOL(mbtowc, std::, ) SYMBOL(mega, std::, ) @@ -956,6 +1004,7 @@ SYMBOL(regex_traits, std::, ) SYMBOL(reinterpret_pointer_cast, std::, ) SYMBOL(remainder, std::, ) +SYMBOL(remove, std::, ) SYMBOL(remove_all_extents, std::, ) SYMBOL(remove_all_extents_t, std::, ) SYMBOL(remove_const, std::, ) @@ -1043,6 +1092,12 @@ SYMBOL(sin, std::, ) SYMBOL(sinh, std::, ) SYMBOL(size, std::, ) +SYMBOL(size_t, std::, ) +SYMBOL(size_t, std::, ) +SYMBOL(size_t, std::, ) +SYMBOL(size_t, std::, ) +SYMBOL(size_t, std::, ) +SYMBOL(size_t, std::, ) SYMBOL(skipws, std::, ) SYMBOL(slice, std::, ) SYMBOL(slice_array, std::, ) @@ -1104,6 +1159,7 @@ SYMBOL(student_t_distribution, std::, ) SYMBOL(sub_match, std::, ) SYMBOL(subtract_with_carry_engine, std::, ) +SYMBOL(swap, std::, ) SYMBOL(swap_ranges, std::, ) SYMBOL(swprintf, std::, ) SYMBOL(swscanf, std::, ) @@ -1288,6 +1344,8 @@ SYMBOL(wfilebuf, std::, ) SYMBOL(wfstream, std::, ) SYMBOL(wifstream, std::, ) +SYMBOL(wint_t, std::, ) +SYMBOL(wint_t, std::, ) SYMBOL(wios, std::, ) SYMBOL(wiostream, std::, ) SYMBOL(wistream, std::, ) diff --git a/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp b/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp --- a/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp +++ b/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp @@ -8,6 +8,7 @@ #include "clang/Tooling/Inclusions/StandardLibrary.h" #include "clang/AST/Decl.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Casting.h" @@ -17,7 +18,7 @@ static llvm::StringRef *HeaderNames; static std::pair *SymbolNames; -static unsigned *SymbolHeaderIDs; +static llvm::SmallVector *SymbolHeaderIDs; static llvm::DenseMap *HeaderIDs; // Maps symbol name -> Symbol::ID, within a namespace. using NSSymbolMap = llvm::DenseMap; @@ -46,18 +47,29 @@ return HeaderIDs->try_emplace(Header, HeaderIDs->size()).first->second; }; - auto Add = [&, SymIndex(0)](llvm::StringRef Name, llvm::StringRef NS, - llvm::StringRef HeaderName) mutable { + auto Add = [&, NextAvailSymIndex(0)](llvm::StringRef Name, llvm::StringRef NS, + llvm::StringRef HeaderName) mutable { if (NS == "None") NS = ""; + // Determine whether the symbol is new. This relies on symbols being + // ordered alpahbetically in the map. + unsigned SymIndex = NextAvailSymIndex; + if (NextAvailSymIndex > 0 && + SymbolNames[NextAvailSymIndex - 1].first == NS && + SymbolNames[NextAvailSymIndex - 1].second == Name) { + // Not a new symbol, use the same index. + SymIndex = NextAvailSymIndex - 1; + } else { + // New symbol, increment next available index. + ++NextAvailSymIndex; + } + SymbolNames[SymIndex] = {NS, Name}; - SymbolHeaderIDs[SymIndex] = AddHeader(HeaderName); + SymbolHeaderIDs[SymIndex].emplace_back(AddHeader(HeaderName)); NSSymbolMap &NSSymbols = AddNS(NS); NSSymbols.try_emplace(Name, SymIndex); - - ++SymIndex; }; #define SYMBOL(Name, NS, Header) Add(#Name, #NS, #Header); #include "clang/Tooling/Inclusions/CSymbolMap.inc" @@ -87,7 +99,7 @@ llvm::StringRef Symbol::scope() const { return SymbolNames[ID].first; } llvm::StringRef Symbol::name() const { return SymbolNames[ID].second; } std::optional Symbol::named(llvm::StringRef Scope, - llvm::StringRef Name) { + llvm::StringRef Name) { ensureInitialized(); if (NSSymbolMap *NSSymbols = NamespaceSymbols->lookup(Scope)) { auto It = NSSymbols->find(Name); @@ -96,9 +108,14 @@ } return std::nullopt; } -Header Symbol::header() const { return Header(SymbolHeaderIDs[ID]); } + +Header Symbol::header() const { return Header(SymbolHeaderIDs[ID][0]); } llvm::SmallVector
Symbol::headers() const { - return {header()}; // FIXME: multiple in case of ambiguity + llvm::SmallVector
result; + for (auto HeaderID : SymbolHeaderIDs[ID]) { + result.emplace_back(Header(HeaderID)); + } + return result; } Recognizer::Recognizer() { ensureInitialized(); } diff --git a/clang/tools/include-mapping/cppreference_parser.py b/clang/tools/include-mapping/cppreference_parser.py --- a/clang/tools/include-mapping/cppreference_parser.py +++ b/clang/tools/include-mapping/cppreference_parser.py @@ -36,7 +36,7 @@ return False -def _ParseSymbolPage(symbol_page_html, symbol_name): +def _ParseSymbolPage(symbol_page_html, symbol_name, header_to_accept): """Parse symbol page and retrieve the include header defined in this page. The symbol page provides header for the symbol, specifically in "Defined in header
" section. An example: @@ -47,7 +47,7 @@ Returns a list of headers. """ - headers = set() + symbol_headers = set() all_headers = set() soup = BeautifulSoup(symbol_page_html, "html.parser") @@ -58,32 +58,57 @@ # Defined in header .t-dsc-header # decl2 .t-dcl for table in soup.select('table.t-dcl-begin, table.t-dsc-begin'): - current_headers = [] - was_decl = False - for row in table.select('tr'): - if _HasClass(row, 't-dcl', 't-dsc'): - was_decl = True - # Symbols are in the first cell. - found_symbols = row.find('td').stripped_strings - if not symbol_name in found_symbols: - continue - headers.update(current_headers) - elif _HasClass(row, 't-dsc-header'): - # If we saw a decl since the last header, this is a new block of headers - # for a new block of decls. - if was_decl: - current_headers = [] - was_decl = False + rows = table.select('tr') + i = 0 + while i < len(rows): + start = i + current_headers = set() + while i < len(rows) and _HasClass(rows[i], 't-dsc-header'): + row = rows[i] # There are also .t-dsc-header for "defined in namespace". if not "Defined in header " in row.text: + i = i + 1 continue # The interesting header content (e.g. ) is wrapped in . for header_code in row.find_all("code"): - current_headers.append(header_code.text) + # FIXME: replace with proper handling of overloads + if header_to_accept != "" and header_code.text.strip("<>") != header_to_accept: + continue all_headers.add(header_code.text) - # If the symbol was never named, consider all named headers. - return headers or all_headers - + current_headers.add(header_code.text) + i = i + 1 + # Some tables have header rows, skip them. + while i < len(rows) and _HasClass(rows[i], 't-dsc-hitem'): + i = i + 1 + while i < len(rows) and (_HasClass(rows[i], 't-dcl', 't-dsc') + or not rows[i].has_attr("class")): + row = rows[i] + # Symbols are in the first cell. + raw_symbols = row.find('td').stripped_strings + found_symbols = [] + # Finding all text in is not enough, some strings contain more than + # one symbol (e.g., "div_t div" is parsed as single symbol). + for raw_symbol in raw_symbols: + symbols = raw_symbol.split(' ') + for symbol in symbols: + found_symbols.append(symbol.strip()) + if symbol_name in found_symbols: + # FIXME: only update symbol headers on first symbol discovery, assume + # same symbol occurence in a subsequent header block is an overload. + if len(symbol_headers) == 0: + symbol_headers.update(current_headers) + i = i + 1 + # No headers or symbols in this block + if i == start: + i = i + 1 + + # If the symbol was never named, consider all named headers. + # FIXME: only consider first symbol, assume further symbols are overloads + all_headers = sorted(list(all_headers)) + if len(all_headers) > 0: + all_headers = [all_headers[0]] + + return symbol_headers or all_headers def _ParseIndexPage(index_page_html): """Parse index page. @@ -113,9 +138,9 @@ return symbols -def _ReadSymbolPage(path, name): +def _ReadSymbolPage(path, name, header_to_accept): with open(path) as f: - return _ParseSymbolPage(f.read(), name) + return _ParseSymbolPage(f.read(), name, header_to_accept) def _GetSymbols(pool, root_dir, index_page_name, namespace, variants_to_accept): @@ -137,14 +162,14 @@ for symbol_name, symbol_page_path, variant in _ParseIndexPage(f.read()): # Variant symbols (e.g. the std::locale version of isalpha) add ambiguity. # FIXME: use these as a fallback rather than ignoring entirely. - variants_for_symbol = variants_to_accept.get( - (namespace or "") + symbol_name, ()) - if variant and variant not in variants_for_symbol: + header_to_accept = variants_to_accept.get( + (namespace or "") + symbol_name, "") + if variant and variant != header_to_accept: continue path = os.path.join(root_dir, symbol_page_path) if os.path.isfile(path): - results.append((symbol_name, - pool.apply_async(_ReadSymbolPage, (path, symbol_name)))) + results.append((symbol_name, pool.apply_async(_ReadSymbolPage, + (path, symbol_name, header_to_accept)))) else: sys.stderr.write("Discarding information for symbol: %s. Page %s does not exist.\n" % (symbol_name, path)) @@ -171,7 +196,7 @@ # those symbols. variants_to_accept = { # std::remove<> has variant algorithm. - "std::remove": ("algorithm"), + "std::remove": "algorithm", } symbols = [] # Run many workers to process individual symbol pages under the symbol index. diff --git a/clang/tools/include-mapping/gen_std.py b/clang/tools/include-mapping/gen_std.py --- a/clang/tools/include-mapping/gen_std.py +++ b/clang/tools/include-mapping/gen_std.py @@ -14,10 +14,7 @@ The generated files are located in clang/include/Tooling/Inclusions. Caveats and FIXMEs: - - only symbols directly in "std" namespace are added, we should also add std's - subnamespace symbols (e.g. chrono). - - symbols with multiple variants or defined in multiple headers aren't added, - e.g. std::move, std::swap + - symbols with multiple variants aren't added, e.g., std::move Usage: 1. Install BeautifulSoup dependency, see instruction: @@ -109,18 +106,15 @@ cppreference_modified_date = datetime.datetime.fromtimestamp( os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d') print(CODE_PREFIX % (args.symbols.upper(), cppreference_modified_date)) + # FIXME: take care of overloads for symbol in symbols: - if len(symbol.headers) == 1: - # SYMBOL(unqualified_name, namespace, header) - print("SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace, - symbol.headers[0])) - elif len(symbol.headers) == 0: + if len(symbol.headers) == 0: sys.stderr.write("No header found for symbol %s\n" % symbol.name) else: - # FIXME: support symbols with multiple headers (e.g. std::move). - sys.stderr.write("Ambiguous header for symbol %s: %s\n" % ( - symbol.name, ', '.join(symbol.headers))) - - + symbol.headers = sorted(symbol.headers) + for header in symbol.headers: + # SYMBOL(unqualified_name, namespace, header) + print("SYMBOL(%s, %s, %s)" % (symbol.name, symbol.namespace, + header)) if __name__ == '__main__': main()