aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/src_location.h
blob: ed911e0169fce89498886e10f5b65fde3e09460f (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__)