]>
Commit | Line | Data |
---|---|---|
2166e589 | 1 | // Copyright (C) 2020-2023 Free Software Foundation, Inc. |
c6db68ee AC |
2 | |
3 | // This file is part of GCC. | |
4 | ||
5 | // GCC is free software; you can redistribute it and/or modify it under | |
6 | // the terms of the GNU General Public License as published by the Free | |
7 | // Software Foundation; either version 3, or (at your option) any later | |
8 | // version. | |
9 | ||
10 | // GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
11 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 | // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 | // for more details. | |
14 | ||
15 | // You should have received a copy of the GNU General Public License | |
16 | // along with GCC; see the file COPYING3. If not see | |
17 | // <http://www.gnu.org/licenses/>. | |
18 | ||
19 | #include "rust-macro.h" | |
20 | ||
21 | namespace Rust { | |
22 | namespace AST { | |
23 | ||
24 | BuiltinMacro | |
25 | builtin_macro_from_string (const std::string &identifier) | |
26 | { | |
27 | if (identifier == "assert") | |
28 | return BuiltinMacro::Assert; | |
29 | ||
30 | if (identifier == "file") | |
31 | return BuiltinMacro::File; | |
32 | ||
33 | if (identifier == "line") | |
34 | return BuiltinMacro::Line; | |
35 | ||
36 | if (identifier == "column") | |
37 | return BuiltinMacro::Column; | |
38 | ||
39 | if (identifier == "include_bytes") | |
40 | return BuiltinMacro::IncludeBytes; | |
41 | ||
42 | if (identifier == "include_str") | |
43 | return BuiltinMacro::IncludeStr; | |
44 | ||
f6e926a6 PEP |
45 | if (identifier == "stringify") |
46 | return BuiltinMacro::Stringify; | |
47 | ||
c6db68ee AC |
48 | if (identifier == "compile_error") |
49 | return BuiltinMacro::CompileError; | |
50 | ||
51 | if (identifier == "concat") | |
52 | return BuiltinMacro::Concat; | |
53 | ||
54 | if (identifier == "env") | |
55 | return BuiltinMacro::Env; | |
56 | ||
57 | if (identifier == "cfg") | |
58 | return BuiltinMacro::Cfg; | |
59 | ||
60 | if (identifier == "include") | |
61 | return BuiltinMacro::Include; | |
62 | ||
63 | gcc_unreachable (); | |
64 | } | |
65 | ||
66 | } // namespace AST | |
67 | } // namespace Rust |