-
-
Notifications
You must be signed in to change notification settings - Fork 229
/
InsightsBase.h
55 lines (42 loc) · 1.68 KB
/
InsightsBase.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
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
/******************************************************************************
*
* C++ Insights, copyright (C) by Andreas Fertig
* Distributed under an MIT license. See LICENSE for details
*
****************************************************************************/
#ifndef INSIGHTS_BASE_H
#define INSIGHTS_BASE_H
//-----------------------------------------------------------------------------
#include "clang/AST/AST.h"
#include "clang/AST/ASTContext.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include <unordered_map>
#include "InsightsStrongTypes.h"
#include "OutputFormatHelper.h"
//-----------------------------------------------------------------------------
namespace clang::insights {
class InsightsBase
{
protected:
Rewriter& mRewrite;
explicit InsightsBase(Rewriter& rewriter)
: mRewrite{rewriter}
, mMap{}
{
}
STRONG_BOOL(SkipConstexpr);
public:
static void GenerateFunctionPrototype(OutputFormatHelper& outputFormatHelper, const FunctionDecl& FD);
protected:
bool SkipIfAlreadySeen(const Stmt* stmt);
private:
std::unordered_map<intptr_t, bool> mMap;
};
//-----------------------------------------------------------------------------
#define SKIP_IF_ALREADY_SEEN(expr) \
if(SkipIfAlreadySeen(expr)) { \
return; \
}
//-----------------------------------------------------------------------------
} // namespace clang::insights
#endif /* INSIGHTS_BASE_H */