Skip to content

Commit

Permalink
fix empty CC in configure why building
Browse files Browse the repository at this point in the history
  • Loading branch information
thientc committed Nov 29, 2022
1 parent 0ddfeb7 commit beac7a4
Show file tree
Hide file tree
Showing 9 changed files with 3,124 additions and 297 deletions.
33 changes: 25 additions & 8 deletions src/Checkers/lib/FutagAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,28 @@ void FutagAnalyzer::CollectBasicFunctionInfo(
futag::DataTypeDetail datatypeDetail =
futag::getDataTypeDetail(paramQualType);
// Write parameter name, its type and if it is template parameter or not

vector<futag::GenTypeInfo> gen_list_for_param =
futag::getGenType(paramQualType);
json gen_list_json = json::array();
for (auto &g : gen_list_for_param) {
gen_list_json.push_back(
{{"type_name", g.type_name},
{"base_type_name", g.base_type_name},
{"length", g.length},
{"local_qualifier", g.local_qualifier},
{"gen_type", g.gen_type},
{"gen_type_name", GetFutagGenTypeFromIdx(g.gen_type)}});
}

basicFunctionInfo["params"].push_back(
{{"param_name", currParam->getQualifiedNameAsString()},
{"param_type", paramQualType.getAsString()},
{"generator_type", datatypeDetail.generator_type},
{"array_size", datatypeDetail.array_size},
{"parent_type", datatypeDetail.parent_type},
{"parent_gen", datatypeDetail.parent_gen},
{"canonical_type", paramQualType.getCanonicalType().getAsString()},
{"gen_list", gen_list_json},
{"param_usage", "UNKNOWN"}});

// Try to determine argument usage
Expand Down Expand Up @@ -520,20 +534,23 @@ void FutagAnalyzer::VisitRecord(const RecordDecl *RD,
{"is_simple", futag::isSimpleRecord(RD)},
{"hash", hash},
{"fields", json::array()}});

json &currentStruct = mTypesInfo["records"].back();
for (auto it = RD->getDefinition()->field_begin();
it != RD->getDefinition()->field_end(); it++) {
json gen_list_json = json::array();
if (futag::isSimpleType(it->getType())) {
vector<futag::GenFieldInfo> gen_list_for_field =
vector<futag::GenTypeInfo> gen_list_for_field =
futag::getGenField(it->getType());

for (auto g : gen_list_for_field) {
gen_list_json.push_back({{"curr_type_name", g.curr_type_name},
{"base_type_name", g.base_type_name},
{"length", g.length},
{"local_qualifier", g.local_qualifier},
{"gen_type", g.gen_type}});
for (auto &g : gen_list_for_field) {
gen_list_json.push_back(
{{"type_name", g.type_name},
{"base_type_name", g.base_type_name},
{"length", g.length},
{"local_qualifier", g.local_qualifier},
{"gen_type", g.gen_type},
{"gen_type_name", GetFutagGenTypeFromIdx(g.gen_type)}});
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/clang/include/Futag/Basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ namespace futag
{
FutagGenType gen_type;
std::string base_type_name; // Unqualified type or Element type of array or Pointee type
std::string curr_type_name; // current type
std::string type_name; // current type
std::string local_qualifier;
uint64_t length; // Length of array
} GenFieldInfo;
} GenTypeInfo;

vector<GenFieldInfo> getGenField(QualType type);
vector<GenFieldInfo> getGenType(QualType type);
vector<GenTypeInfo> getGenField(QualType type);
vector<GenTypeInfo> getGenType(QualType type);

std::string GetFutagGenTypeFromIdx(FutagGenType idx);

Expand Down
Loading

0 comments on commit beac7a4

Please sign in to comment.