/
FuncEntries.cpp
61 lines (50 loc) · 1.36 KB
/
FuncEntries.cpp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "FuncEntries.h"
#include <cstdio>
#include <map>
//C++11 extentions are useful, but setting the standard to be C++11 breaks
//compilation, so lets just sweep these errors under a rug for now
#pragma clang diagnostic ignored "-Wc++11-extensions"
void FuncEntry::display(void) const
{
printf("%40s\t%d\t%d\t%d\n", name.c_str(), RT|ext_RT, nRT, defined);
}
class FuncEntriesImpl
{
public:
std::map<std::string, FuncEntry> fmap;
};
FuncEntries::FuncEntries(void)
:impl(new FuncEntriesImpl)
{}
FuncEntries::~FuncEntries(void)
{
delete impl;
}
void FuncEntries::print(void) const
{
printf("%40s\t%s\t%s\t%s\n", "Fn. Name", "RT", "nRT", "defined");
for(auto pair : impl->fmap)
pair.second.display();
}
bool FuncEntries::has(std::string fname)
{
return impl->fmap.find(fname)!=impl->fmap.end();
}
void FuncEntries::add(std::string fname, class TranslationUnit *tu, class clang::FunctionDecl *fdecl)
{
if(impl->fmap.find(fname) == impl->fmap.end())
impl->fmap.insert(std::pair<std::string, FuncEntry>(fname,FuncEntry(fname, tu, fdecl)));
}
FuncEntry &FuncEntries::operator[](std::string fname)
{
return impl->fmap[fname];
}
typedef std::map<std::string, FuncEntry>::iterator miterator;
miterator FuncEntries::begin(void)
{
return impl->fmap.begin();
}
miterator FuncEntries::end(void)
{
return impl->fmap.end();
}