15 clang::CXXCtorInitializer *ctor_init) {
23 clang::Expr *expr{ctor_init->getInit()->IgnoreImplicit()};
30 if (
auto init_expr_list = clang::dyn_cast<clang::InitListExpr>(expr)) {
32 clang::Expr **iexpr_set{init_expr_list->getInits()};
34 for (std::size_t i{0}; i < init_expr_list->getNumInits(); ++i) {
35 LLVM_DEBUG(llvm::dbgs() <<
"Iterate over init 1d lists: " << i <<
"\n";);
36 clang::Expr *iexpr{iexpr_set[i]};
40 if (
auto cexpr = clang::dyn_cast<clang::CXXConstructExpr>(iexpr)) {
41 clang::CXXConstructExpr *nested_cexpr{
42 clang::dyn_cast<clang::CXXConstructExpr>(
43 cexpr->getArg(0)->IgnoreImplicit())};
45 auto cxxbindexpr{clang::dyn_cast<clang::CXXBindTemporaryExpr>(
46 nested_cexpr->getArg(0)->IgnoreParenImpCasts())};
48 auto cxxctor{clang::dyn_cast<clang::CXXConstructExpr>(
49 cxxbindexpr->getSubExpr()->IgnoreParenImpCasts())};
50 clang::StringLiteral *slit{clang::dyn_cast<clang::StringLiteral>(
51 cxxctor->getArg(0)->IgnoreImpCasts())};
55 LLVM_DEBUG(llvm::dbgs()
56 <<
"Argument 1d: [" << i <<
", "
57 <<
"x, x ] " << slit->getString().str() <<
" \n";);
59 IndexPairType(slit->getString().str(), std::make_tuple(i, 0, 0)));
64 if (
auto init_expr_list_2d =
65 clang::dyn_cast<clang::InitListExpr>(iexpr)) {
66 clang::Expr **iexpr_2d_set{init_expr_list_2d->getInits()};
67 for (std::size_t j{0}; j < init_expr_list_2d->getNumInits(); ++j) {
68 LLVM_DEBUG(llvm::dbgs()
69 <<
"Iterate over 2d init lists: " << j <<
"\n";);
70 clang::Expr *iexpr_2d{iexpr_2d_set[j]};
74 clang::CXXConstructExpr *peel{
75 clang::dyn_cast<clang::CXXConstructExpr>(iexpr_2d)};
76 clang::CXXConstructExpr *cexpr{
nullptr};
79 peel = clang::dyn_cast<clang::CXXConstructExpr>(
80 peel->getArg(0)->IgnoreImplicit());
82 llvm::dbgs() <<
"unwrap 2d dump\n";
87 llvm::dbgs() <<
"0 arg dump\n";
88 clang::StringLiteral *slit{clang::dyn_cast<clang::StringLiteral>(
89 cexpr->getArg(0)->IgnoreImpCasts())};
90 LLVM_DEBUG(llvm::dbgs()
91 <<
"Argument 2d: [" << i <<
", " << j <<
"] "
92 << slit->getString().str() <<
" \n";);
94 std::make_tuple(i, j, 0)));
98 if (
auto init_expr_list_3d =
99 clang::dyn_cast<clang::InitListExpr>(iexpr_2d)) {
100 clang::Expr **iexpr_3d_set{init_expr_list_3d->getInits()};
101 init_expr_list_3d->dump();
102 for (std::size_t k{0}; k < init_expr_list_3d->getNumInits(); ++k) {
103 LLVM_DEBUG(llvm::dbgs()
104 <<
"Iterate over 3d init lists: " << k <<
"\n";);
105 clang::Expr *iexpr_3d{iexpr_3d_set[k]};
108 clang::CXXConstructExpr *peel{
109 clang::dyn_cast<clang::CXXConstructExpr>(iexpr_3d)};
110 clang::CXXConstructExpr *cexpr{
nullptr};
113 peel = clang::dyn_cast<clang::CXXConstructExpr>(
114 peel->getArg(0)->IgnoreImplicit());
116 llvm::dbgs() <<
"unwrap 3d dump\n";
129 clang::StringLiteral *slit{
130 clang::dyn_cast<clang::StringLiteral>(
131 cexpr->getArg(0)->IgnoreImpCasts())};
133 LLVM_DEBUG(llvm::dbgs() <<
"Argument 3d: [" << i <<
", " << j
135 << slit->getString().str() <<
" \n";);
137 std::make_tuple(i, j, k)));
152 clang::QualType field_type{fd->getType()};
153 clang::QualType save_field_type = field_type;
154 if (field_type->isReferenceType()) {
156 field_type = field_type->getPointeeType()
157 ->getLocallyUnqualifiedSingleStepDesugaredType();
160 auto array_type{clang::dyn_cast<clang::ConstantArrayType>(field_type)};
161 while (array_type !=
nullptr) {
162 llvm::APInt array_size{};
163 array_size = array_type->getSize();
164 LLVM_DEBUG(llvm::dbgs() <<
"Size of array: " << array_size <<
"\n";);
166 clang::dyn_cast<clang::ConstantArrayType>(array_type->getElementType());
168 sizes.push_back(array_size);
178 auto arr_sub_expr{clang::dyn_cast<clang::ArraySubscriptExpr>(expr)};
179 while (arr_sub_expr !=
nullptr) {
180 arr_sub_expr->getIdx()->dump();
187 clang::dyn_cast<clang::IntegerLiteral>(arr_sub_expr->getIdx())};
188 auto decl_ref_expr{clang::dyn_cast<clang::DeclRefExpr>(
189 arr_sub_expr->getIdx()->IgnoreImpCasts())};
194 subscripts.insert(subscripts.begin(), arr_sub_expr->getIdx());
198 LLVM_DEBUG(llvm::dbgs()
200 << decl_ref_expr->getNameInfo().getName().getAsString()
202 subscripts.insert(subscripts.begin(), decl_ref_expr);
211 arr_sub_expr = clang::dyn_cast<clang::ArraySubscriptExpr>(
212 arr_sub_expr->getBase()->IgnoreParenImpCasts());