diff options
author | Devtools Arcadia <[email protected]> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <[email protected]> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /util/system/src_location.h |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'util/system/src_location.h')
-rw-r--r-- | util/system/src_location.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/util/system/src_location.h b/util/system/src_location.h new file mode 100644 index 00000000000..12ba6e063e9 --- /dev/null +++ b/util/system/src_location.h @@ -0,0 +1,25 @@ +#pragma once + +#include "src_root.h" + +#include <util/generic/strbuf.h> + +struct TSourceLocation { + constexpr TSourceLocation(const TStringBuf f, int l) noexcept + : File(f) + , Line(l) + { + } + + TStringBuf File; + int Line; +}; + +// __SOURCE_FILE__ should be used instead of __FILE__ +#if !defined(__NVCC__) + #define __SOURCE_FILE__ (__SOURCE_FILE_IMPL__.As<TStringBuf>()) +#else + #define __SOURCE_FILE__ (__SOURCE_FILE_IMPL__.template As<TStringBuf>()) +#endif + +#define __LOCATION__ ::TSourceLocation(__SOURCE_FILE__, __LINE__) |