Skip to content

Commit

Permalink
Continue std::formatter for AST nodes
Browse files Browse the repository at this point in the history
- requires Clang/libc++19, see https://godbolt.org/z/rc1sszThT
  • Loading branch information
ibis-hdl committed Jan 1, 2025
1 parent c156c8c commit a9e6f3c
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 121 deletions.
1 change: 1 addition & 0 deletions .vscode/dictionaries/project_words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ libcpp
MAXSIZE
msvc
NOCOMPRESS
nullary
pkgs
ptrace
pwsh
Expand Down
28 changes: 19 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,8 @@
]
},
"files.associations": {
"format": "cpp",
"source_location": "cpp",
"vector": "cpp",
"future": "cpp",
"system_error": "cpp",
"algorithm": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
Expand Down Expand Up @@ -181,11 +177,12 @@
"cwctype": "cpp",
"deque": "cpp",
"exception": "cpp",
"resumable": "cpp",
"filesystem": "cpp",
"format": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"functional": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
Expand All @@ -198,26 +195,33 @@
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ostream": "cpp",
"print": "cpp",
"queue": "cpp",
"random": "cpp",
"ranges": "cpp",
"ratio": "cpp",
"regex": "cpp",
"resumable": "cpp",
"set": "cpp",
"shared_mutex": "cpp",
"source_location": "cpp",
"span": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stdfloat": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"string": "cpp",
"string_view": "cpp",
"strstream": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
Expand All @@ -228,6 +232,7 @@
"utility": "cpp",
"valarray": "cpp",
"variant": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
Expand All @@ -243,8 +248,13 @@
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"any": "cpp",
"memory_resource": "cpp",
"*.ipp": "cpp"
"*.ipp": "cpp",
"*.tcc": "cpp",
"__bit_reference": "cpp",
"__node_handle": "cpp",
"__split_buffer": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__verbose_abort": "cpp"
}
}
5 changes: 3 additions & 2 deletions source/common/src/file_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ std::time_t file_loader::timesstamp(fs::path const& filename) const

// See [How to convert std::filesystem::file_time_type to time_t?](
// https://stackoverflow.com/questions/61030383/how-to-convert-stdfilesystemfile-time-type-to-time-t)
if constexpr (ibis::build_compiler_has_libcpp) {
if constexpr (ibis::build_compiler_has_libcpp == true) {
// handle libc++ compile error: no member named 'clock_cast' in namespace 'std::chrono'
auto const to_time_t = [](fs::file_time_type time_point) {
using namespace std::chrono;
Expand All @@ -210,9 +210,10 @@ std::time_t file_loader::timesstamp(fs::path const& filename) const
return sys_time;
}
else {
#if !defined(_LIBCPP_VERSION) // hide "faulty code" from Clang/libc++ (clock_cast<> won't found)
auto const sys_time = chrono::clock_cast<chrono::system_clock>(file_time);

return chrono::system_clock::to_time_t(sys_time);
#endif
}
}

Expand Down
3 changes: 2 additions & 1 deletion source/util/include/ibis/util/platform.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ constexpr ibis::platform_compiler build_compiler_variant = platform_compiler::Cl
///
/// Some code parts require special handling for use with libc++, namely macOS
///
#ifdef _LIBCPP_VERSION
#if defined(_LIBCPP_VERSION)
// [How to detect -stdlib=libc++ in the preprocessor?](
// https://stackoverflow.com/questions/31657499/how-to-detect-stdlib-libc-in-the-preprocessor)
constexpr bool build_compiler_has_libcpp = true;
// #pragma message "libc++"
#else
constexpr bool build_compiler_has_libcpp = false;
#endif
Expand Down
Loading

0 comments on commit a9e6f3c

Please sign in to comment.