-
Notifications
You must be signed in to change notification settings - Fork 8
/
utils.h
29 lines (22 loc) · 823 Bytes
/
utils.h
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
26
27
28
29
#ifndef UTILS_H
#define UTILS_H
#include <algorithm>
#include <string>
inline void strlower(std::string& str)
{
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
}
std::string GetPath(const std::string& fileName);
[[noreturn]] void InternalCompilerError(const char* file, int line, const std::string& msg);
[[noreturn]] void InternalCompilerError(const char* file, int line, const std::string& condStr,
const std::string& msg);
inline void iceIf(const char* file, int line, bool cond, const std::string& condStr, const std::string& msg)
{
if (cond)
{
InternalCompilerError(file, line, condStr, msg);
}
}
#define ICE(msg) InternalCompilerError(__FILE__, __LINE__, msg)
#define ICE_IF(cond, msg) iceIf(__FILE__, __LINE__, cond, #cond, msg)
#endif