blob: 9880752d6698cbe108846a3cdea227a4f93c8a41 [file] [log] [blame]
Ed Tanousdf5415f2021-12-01 12:50:35 -08001#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
14namespace bmcweb
15{
16using source_location = std::source_location;
17}
18
19#else
20#include <experimental/source_location>
21
22namespace bmcweb
23{
24using source_location = std::experimental::source_location;
25}
26
27#endif