aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/src_location.h
blob: 12ba6e063e92884e792f836ea78fe00fb28bc73b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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__)