Merge pull request #21 from bkryza/fix-cpp-type-kind-logging
Fix cpp type kind logging
This commit is contained in:
@@ -18,7 +18,9 @@ set(UML_HEADERS_DIR ${PROJECT_SOURCE_DIR}/src/uml)
|
|||||||
option(LLVM_CONFIG_PATH "Path to custom llvm-config executable")
|
option(LLVM_CONFIG_PATH "Path to custom llvm-config executable")
|
||||||
|
|
||||||
if(LLVM_CONFIG_PATH)
|
if(LLVM_CONFIG_PATH)
|
||||||
|
message(STATUS "Using llvm-config from ${LLVM_CONFIG_PATH}")
|
||||||
set(LIBCLANG_LLVM_CONFIG_EXECUTABLE ${LLVM_CONFIG_PATH})
|
set(LIBCLANG_LLVM_CONFIG_EXECUTABLE ${LLVM_CONFIG_PATH})
|
||||||
|
set(LLVM_CONFIG_BINARY ${LLVM_CONFIG_PATH})
|
||||||
endif(LLVM_CONFIG_PATH)
|
endif(LLVM_CONFIG_PATH)
|
||||||
|
|
||||||
message(STATUS "Checking for fmt...")
|
message(STATUS "Checking for fmt...")
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ release/clang-uml --help
|
|||||||
# To build using a specific installed version of LLVM use:
|
# To build using a specific installed version of LLVM use:
|
||||||
LLVM_CONFIG_PATH=/usr/bin/llvm-config-13 make release
|
LLVM_CONFIG_PATH=/usr/bin/llvm-config-13 make release
|
||||||
|
|
||||||
|
# To build on macos, it is necessary to provide also path to LLVM cmake directory, e.g.:
|
||||||
|
export LLVM_PREFIX="/usr/local/Cellar/llvm@12/12.0.1_1"
|
||||||
|
LLVM_CONFIG_PATH="${LLVM_PREFIX}/bin/llvm-config" CMAKE_PREFIX_PATH="${LLVM_PREFIX}/lib/cmake/llvm/" make test
|
||||||
|
|
||||||
# Optionally
|
# Optionally
|
||||||
make install
|
make install
|
||||||
# or
|
# or
|
||||||
|
|||||||
@@ -728,10 +728,8 @@ void translation_unit_visitor::process_field(
|
|||||||
|
|
||||||
auto tr_declaration = cppast::to_string(tr);
|
auto tr_declaration = cppast::to_string(tr);
|
||||||
|
|
||||||
#ifndef __APPLE__
|
|
||||||
LOG_DBG("Processing field {} with unreferenced type of kind {}", mv.name(),
|
LOG_DBG("Processing field {} with unreferenced type of kind {}", mv.name(),
|
||||||
tr.kind());
|
cx::to_string(tr.kind()));
|
||||||
#endif
|
|
||||||
|
|
||||||
if (tr.kind() == cppast::cpp_type_kind::builtin_t) {
|
if (tr.kind() == cppast::cpp_type_kind::builtin_t) {
|
||||||
LOG_DBG("Builtin type found for field: {}", m.name());
|
LOG_DBG("Builtin type found for field: {}", m.name());
|
||||||
@@ -1214,10 +1212,8 @@ bool translation_unit_visitor::find_relationships(const cppast::cpp_type &t_,
|
|||||||
const auto fn =
|
const auto fn =
|
||||||
cx::util::full_name(cppast::remove_cv(t_), ctx.entity_index(), false);
|
cx::util::full_name(cppast::remove_cv(t_), ctx.entity_index(), false);
|
||||||
|
|
||||||
#ifndef __APPLE__
|
|
||||||
LOG_DBG("Finding relationships for type {}, {}, {}", cppast::to_string(t_),
|
LOG_DBG("Finding relationships for type {}, {}, {}", cppast::to_string(t_),
|
||||||
t_.kind(), fn);
|
cx::to_string(t_.kind()), fn);
|
||||||
#endif
|
|
||||||
|
|
||||||
relationship_t relationship_type = relationship_hint;
|
relationship_t relationship_type = relationship_hint;
|
||||||
const auto &t = cppast::remove_cv(cx::util::unreferenced(t_));
|
const auto &t = cppast::remove_cv(cx::util::unreferenced(t_));
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
package(const package &) = delete;
|
package(const package &) = delete;
|
||||||
package(package &&) = default;
|
package(package &&) = default;
|
||||||
package &operator=(const package &) = delete;
|
package &operator=(const package &) = delete;
|
||||||
package &operator=(package &&) = default;
|
package &operator=(package &&) = delete;
|
||||||
|
|
||||||
std::string full_name(bool relative) const override;
|
std::string full_name(bool relative) const override;
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,47 @@ std::string to_string(CXString &&cxs)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string to_string(cppast::cpp_type_kind t)
|
||||||
|
{
|
||||||
|
using namespace cppast;
|
||||||
|
switch (t) {
|
||||||
|
case cpp_type_kind::builtin_t:
|
||||||
|
return "builtin";
|
||||||
|
case cpp_type_kind::user_defined_t:
|
||||||
|
return "user_defined";
|
||||||
|
case cpp_type_kind::auto_t:
|
||||||
|
return "auto";
|
||||||
|
case cpp_type_kind::decltype_t:
|
||||||
|
return "decltype";
|
||||||
|
case cpp_type_kind::decltype_auto_t:
|
||||||
|
return "decltype_auto";
|
||||||
|
case cpp_type_kind::cv_qualified_t:
|
||||||
|
return "cv_qualified";
|
||||||
|
case cpp_type_kind::pointer_t:
|
||||||
|
return "pointer";
|
||||||
|
case cpp_type_kind::reference_t:
|
||||||
|
return "reference";
|
||||||
|
case cpp_type_kind::array_t:
|
||||||
|
return "array";
|
||||||
|
case cpp_type_kind::function_t:
|
||||||
|
return "function";
|
||||||
|
case cpp_type_kind::member_function_t:
|
||||||
|
return "member_function";
|
||||||
|
case cpp_type_kind::member_object_t:
|
||||||
|
return "member_object";
|
||||||
|
case cpp_type_kind::template_parameter_t:
|
||||||
|
return "template_parameter";
|
||||||
|
case cpp_type_kind::template_instantiation_t:
|
||||||
|
return "template_instantiation";
|
||||||
|
case cpp_type_kind::dependent_t:
|
||||||
|
return "dependent";
|
||||||
|
case cpp_type_kind::unexposed_t:
|
||||||
|
return "unexposed";
|
||||||
|
default:
|
||||||
|
return "invalid";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string full_name(
|
std::string full_name(
|
||||||
const common::model::namespace_ ¤t_ns, const cppast::cpp_entity &e)
|
const common::model::namespace_ ¤t_ns, const cppast::cpp_entity &e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ namespace util {
|
|||||||
*/
|
*/
|
||||||
std::string to_string(CXString &&cxs);
|
std::string to_string(CXString &&cxs);
|
||||||
|
|
||||||
|
std::string to_string(cppast::cpp_type_kind t);
|
||||||
|
|
||||||
std::string full_name(
|
std::string full_name(
|
||||||
const common::model::namespace_ ¤t_ns, const cppast::cpp_entity &e);
|
const common::model::namespace_ ¤t_ns, const cppast::cpp_entity &e);
|
||||||
|
|
||||||
|
|||||||
@@ -379,10 +379,8 @@ bool translation_unit_visitor::find_relationships(const cppast::cpp_type &t_,
|
|||||||
|
|
||||||
const auto fn_ns = cx::util::ns(cppast::remove_cv(t_), ctx.entity_index());
|
const auto fn_ns = cx::util::ns(cppast::remove_cv(t_), ctx.entity_index());
|
||||||
|
|
||||||
#ifndef __APPLE__
|
|
||||||
LOG_DBG("Finding relationships for type {}, {}, {}", cppast::to_string(t_),
|
LOG_DBG("Finding relationships for type {}, {}, {}", cppast::to_string(t_),
|
||||||
t_.kind(), fn);
|
cx::to_string(t_.kind()), fn);
|
||||||
#endif
|
|
||||||
|
|
||||||
relationship_t relationship_type = relationship_hint;
|
relationship_t relationship_type = relationship_hint;
|
||||||
const auto &t = cppast::remove_cv(cx::util::unreferenced(t_));
|
const auto &t = cppast::remove_cv(cx::util::unreferenced(t_));
|
||||||
|
|||||||
Reference in New Issue
Block a user