Instantiator
Generate c++ template instantiations
Loading...
Searching...
No Matches
Param.hpp
Go to the documentation of this file.
1#ifndef PARAM_H_
2#define PARAM_H_
3
4#include <string>
5
6#include "fmt/color.h"
7#include "fmt/core.h"
8
9#include "clang/AST/Decl.h"
10#include "clang/AST/PrettyPrinter.h"
11
15struct Param
16{
18 std::string name = "";
19 bool is_lvalue_reference = false;
20 bool is_rvalue_reference = false;
22 bool is_reference = false;
23 bool is_const = false;
24 bool is_volatile = false;
25 bool is_restrict = false;
26 bool is_dependent = false;
27 std::string template_name = "";
28 bool is_template_param = false;
29 // bool is_templateparmvartype = false;
30 // clang::TypeDependenceScope::TypeDependence dependence = clang::TypeDependenceScope::TypeDependence::None;
31
37 static Param createFromParmVarDecl(const clang::ParmVarDecl* parm, clang::PrintingPolicy pp);
38
42 bool compare_cvr(const Param& other) const;
43
47 bool compare(const Param& other) const;
48
49 inline bool operator==(const Param& other) const { return this->compare(other); }
50};
51
52template <>
53class fmt::formatter<Param>
54{
55public:
56 constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
57 template <typename Context>
58 constexpr auto format(Param const& p, Context& ctx) const
59 {
60 return fmt::format_to(ctx.out(), "{}", p.name); //, p.is_const ? "const" : ""
61 }
62};
63
64#endif
constexpr auto format(Param const &p, Context &ctx) const
Definition Param.hpp:58
constexpr auto parse(format_parse_context &ctx)
Definition Param.hpp:56
Struct for the collection of all relevant data for a function parameter.
Definition Param.hpp:16
bool is_dependent
Definition Param.hpp:26
bool operator==(const Param &other) const
Definition Param.hpp:49
bool is_restrict
Definition Param.hpp:25
bool is_template_param
Definition Param.hpp:28
bool is_reference
Definition Param.hpp:22
bool compare(const Param &other) const
Definition Param.cpp:53
bool is_const
Definition Param.hpp:23
bool is_lvalue_reference
Definition Param.hpp:19
std::string name
Definition Param.hpp:18
bool compare_cvr(const Param &other) const
Definition Param.cpp:48
bool is_volatile
Definition Param.hpp:24
std::string template_name
Definition Param.hpp:27
static Param createFromParmVarDecl(const clang::ParmVarDecl *parm, clang::PrintingPolicy pp)
Definition Param.cpp:9
bool is_rvalue_reference
Definition Param.hpp:20
bool is_forwarding_reference
Definition Param.hpp:21