-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathlexer-helper.cpp
More file actions
35 lines (27 loc) · 870 Bytes
/
Copy pathlexer-helper.cpp
File metadata and controls
35 lines (27 loc) · 870 Bytes
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
30
31
32
33
34
35
#include "lexer-helper.h"
#include <map>
#include <set>
#include <string>
extern std::set<std::string> gMacroNames;
extern std::set<std::string> gKnownApiDecorNames;
extern std::map<std::string, int> gDefinedNames;
extern std::set<std::string> gUndefinedNames;
extern std::set<std::string> gIgnorableMacroNames;
extern std::map<std::string, int> gRenamedKeywords;
MacroDefineInfo GetMacroDefineInfo(const std::string& id)
{
if (gUndefinedNames.count(id))
return MacroDefineInfo::kUndefined;
if (gDefinedNames.count(id))
return MacroDefineInfo::kDefined;
return MacroDefineInfo::kNoInfo;
}
std::optional<int> GetIdValue(const std::string& id)
{
if (gUndefinedNames.count(id))
return std::nullopt;
const auto itr = gDefinedNames.find(id);
if (itr == gDefinedNames.end())
return std::nullopt;
return itr->second;
}