src_location.h 552 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include "src_root.h"
  3. #include <util/generic/strbuf.h>
  4. struct TSourceLocation {
  5. constexpr TSourceLocation(const TStringBuf f, int l) noexcept
  6. : File(f)
  7. , Line(l)
  8. {
  9. }
  10. TStringBuf File;
  11. int Line;
  12. };
  13. // __SOURCE_FILE__ should be used instead of __FILE__
  14. #if !defined(__NVCC__)
  15. #define __SOURCE_FILE__ (__SOURCE_FILE_IMPL__.As<TStringBuf>())
  16. #else
  17. #define __SOURCE_FILE__ (__SOURCE_FILE_IMPL__.template As<TStringBuf>())
  18. #endif
  19. #define __LOCATION__ ::TSourceLocation(__SOURCE_FILE__, __LINE__)