Ed Tanous | df5415f | 2021-12-01 12:50:35 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | // As of clang-12, clang still doesn't support std::source_location, which |
| 4 | // means that clang-tidy also doesn't support std::source_location. |
| 5 | // Inside the libstdc++ implementation of <source_location> is this check of |
| 6 | // __builtin_source_location to determine if the compiler supports the |
| 7 | // necessary bits for std::source_location, and if not the header ends up doing |
| 8 | // nothing. Use this same builtin-check to detect when we're running under |
| 9 | // an "older" clang and fallback to std::experimental::source_location instead. |
| 10 | |
| 11 | #if __has_builtin(__builtin_source_location) |
| 12 | #include <source_location> |
| 13 | |
| 14 | namespace bmcweb |
| 15 | { |
| 16 | using source_location = std::source_location; |
| 17 | } |
| 18 | |
| 19 | #else |
| 20 | #include <experimental/source_location> |
| 21 | |
| 22 | namespace bmcweb |
| 23 | { |
| 24 | using source_location = std::experimental::source_location; |
| 25 | } |
| 26 | |
| 27 | #endif |