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 @@ -61,8 +61,9 @@ #include "CSymbolMap.inc" break; case Lang::CXX: -#include "StdSymbolMap.inc" #include "StdSpecialSymbolMap.inc" +#include "StdSymbolMap.inc" +#include "StdTsSymbolMap.inc" break; } #undef SYMBOL @@ -130,8 +131,9 @@ #include "CSymbolMap.inc" break; case Lang::CXX: -#include "StdSymbolMap.inc" #include "StdSpecialSymbolMap.inc" +#include "StdSymbolMap.inc" +#include "StdTsSymbolMap.inc" break; } #undef SYMBOL diff --git a/clang/lib/Tooling/Inclusions/Stdlib/StdTsSymbolMap.inc b/clang/lib/Tooling/Inclusions/Stdlib/StdTsSymbolMap.inc new file mode 100644 --- /dev/null +++ b/clang/lib/Tooling/Inclusions/Stdlib/StdTsSymbolMap.inc @@ -0,0 +1,54 @@ +// These are derived from N4100[fs.filesystem.synopsis], final +// draft for experimental filesystem. +// clang-format off +SYMBOL(absolute, std::experimental::filesystem::, ) +SYMBOL(canonical, std::experimental::filesystem::, ) +SYMBOL(copy, std::experimental::filesystem::, ) +SYMBOL(copy_file, std::experimental::filesystem::, ) +SYMBOL(copy_options, std::experimental::filesystem::, ) +SYMBOL(copy_symlink, std::experimental::filesystem::, ) +SYMBOL(create_directories, std::experimental::filesystem::, ) +SYMBOL(create_directory, std::experimental::filesystem::, ) +SYMBOL(create_directory_symlink, std::experimental::filesystem::, ) +SYMBOL(create_hard_link, std::experimental::filesystem::, ) +SYMBOL(create_symlink, std::experimental::filesystem::, ) +SYMBOL(current_path, std::experimental::filesystem::, ) +SYMBOL(directory_entry, std::experimental::filesystem::, ) +SYMBOL(directory_iterator, std::experimental::filesystem::, ) +SYMBOL(directory_options, std::experimental::filesystem::, ) +SYMBOL(equivalent, std::experimental::filesystem::, ) +SYMBOL(exists, std::experimental::filesystem::, ) +SYMBOL(file_size, std::experimental::filesystem::, ) +SYMBOL(file_status, std::experimental::filesystem::, ) +SYMBOL(file_time_type, std::experimental::filesystem::, ) +SYMBOL(file_type, std::experimental::filesystem::, ) +SYMBOL(filesystem_error, std::experimental::filesystem::, ) +SYMBOL(hard_link_count, std::experimental::filesystem::, ) +SYMBOL(is_block_file, std::experimental::filesystem::, ) +SYMBOL(is_character_file, std::experimental::filesystem::, ) +SYMBOL(is_directory, std::experimental::filesystem::, ) +SYMBOL(is_empty, std::experimental::filesystem::, ) +SYMBOL(is_fifo, std::experimental::filesystem::, ) +SYMBOL(is_other, std::experimental::filesystem::, ) +SYMBOL(is_regular_file, std::experimental::filesystem::, ) +SYMBOL(is_socket, std::experimental::filesystem::, ) +SYMBOL(is_symlink, std::experimental::filesystem::, ) +SYMBOL(last_write_time, std::experimental::filesystem::, ) +SYMBOL(path, std::experimental::filesystem::, ) +SYMBOL(permissions, std::experimental::filesystem::, ) +SYMBOL(perms, std::experimental::filesystem::, ) +SYMBOL(read_symlink, std::experimental::filesystem::, ) +SYMBOL(recursive_directory_iterator, std::experimental::filesystem::, ) +SYMBOL(remove, std::experimental::filesystem::, ) +SYMBOL(remove_all, std::experimental::filesystem::, ) +SYMBOL(rename, std::experimental::filesystem::, ) +SYMBOL(resize_file, std::experimental::filesystem::, ) +SYMBOL(space, std::experimental::filesystem::, ) +SYMBOL(space_info, std::experimental::filesystem::, ) +SYMBOL(status, std::experimental::filesystem::, ) +SYMBOL(status_known, std::experimental::filesystem::, ) +SYMBOL(symlink_status, std::experimental::filesystem::, ) +SYMBOL(system_complete, std::experimental::filesystem::, ) +SYMBOL(temp_directory_path, std::experimental::filesystem::, ) +SYMBOL(u8path, std::experimental::filesystem::, ) +// clang-format on diff --git a/clang/unittests/Tooling/StandardLibraryTest.cpp b/clang/unittests/Tooling/StandardLibraryTest.cpp --- a/clang/unittests/Tooling/StandardLibraryTest.cpp +++ b/clang/unittests/Tooling/StandardLibraryTest.cpp @@ -79,6 +79,23 @@ EXPECT_FALSE(stdlib::Header::named("", stdlib::Lang::CXX)); } +TEST(StdlibTest, Experimental) { + EXPECT_FALSE( + stdlib::Header::named("", stdlib::Lang::C)); + EXPECT_TRUE( + stdlib::Header::named("", stdlib::Lang::CXX)); + + auto Symbol = stdlib::Symbol::named("std::experimental::filesystem::", + "system_complete"); + EXPECT_TRUE(Symbol); + EXPECT_EQ(Symbol->scope(), "std::experimental::filesystem::"); + EXPECT_EQ(Symbol->name(), "system_complete"); + EXPECT_EQ(Symbol->header(), + stdlib::Header::named("")); + EXPECT_EQ(Symbol->qualifiedName(), + "std::experimental::filesystem::system_complete"); +} + TEST(StdlibTest, CCompat) { EXPECT_THAT( stdlib::Symbol::named("", "int16_t", stdlib::Lang::CXX)->headers(),