Skip to content

Commit c44c0d0

Browse files
committed
Added multithreaded calculation to efferent coupling, with non-root paths excluded.
1 parent a8f8897 commit c44c0d0

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

plugins/cpp/model/include/model/cppfunction.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ struct CppFunctionParamTypeView
109109

110110
#pragma db view \
111111
object(CppFunction) \
112-
object(CppAstNode : CppFunction::astNodeId == CppAstNode::id) \
113112
object(CppVariable = Locals : CppFunction::locals)
114113
struct CppFunctionLocalTypeView
115114
{

plugins/cpp_metrics/parser/src/cppmetricsparser.cpp

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -374,39 +374,25 @@ void CppMetricsParser::efferentTypeLevel()
374374
getFilterPathsQuery<model::CohesionCppRecordView>(),
375375
[&, this](const MetricsTasks<model::CohesionCppRecordView>& tasks)
376376
{
377-
typedef odb::query<cc::model::CppMemberType> MemTypeQuery;
378-
typedef odb::query<cc::model::CppInheritanceCount> InheritanceQuery;
379-
typedef odb::query<cc::model::CppFunctionParamTypeView> ParamQuery;
380-
typedef odb::query<cc::model::CppFunctionLocalTypeView> LocalQuery;
381-
typedef odb::query<cc::model::CppFunction> FuncQuery;
382-
383377
util::OdbTransaction{_ctx.db}([&, this]
384378
{
379+
typedef odb::query<cc::model::CppMemberType> MemTypeQuery;
380+
typedef odb::query<cc::model::CppInheritanceCount> InheritanceQuery;
381+
typedef odb::query<cc::model::CppFunctionParamTypeView> ParamQuery;
382+
typedef odb::query<cc::model::CppFunctionLocalTypeView> LocalQuery;
383+
typedef odb::query<cc::model::CppFunction> FuncQuery;
384+
385385
std::set<std::uint64_t> dependentTypes;
386-
for (const model::CohesionCppRecordView& type
387-
: _ctx.db->query<model::CohesionCppRecordView>())
386+
for (const model::CohesionCppRecordView& type : tasks)
388387
{
389-
// Skip types that were included from external libraries.
390-
391-
//const auto typeFile = _ctx.db->query_one<model::File>(
392-
//odb::query<model::File>::id == type.location.file->id);
393-
//if (!cc::util::isRootedUnderAnyOf(_inputPaths, type.file.path))
394-
//continue;
395-
/*type.location.file.load();
396-
const auto typeFile = _ctx.db->query_one<model::File>(
397-
odb::query<model::File>::id == type.location.file->id);
398-
if (!typeFile || !cc::util::isRootedUnderAnyOf(_inputPaths, typeFile->path))
399-
continue;*/
400-
//if (!cc::util::isRootedUnderAnyOf(_inputPaths, type.filePath))
401-
//continue;
402-
403388
dependentTypes.clear();
404389

405390
// Count parent types
406391
auto inheritanceView = _ctx.db->query<model::CppInheritanceCount>(
407392
InheritanceQuery::derived == type.entityHash);
408393

409-
// Count unique type attributes
394+
// Count unique attribute types
395+
// and unique types in function parameters and local variables
410396
for (const model::CppMemberType& mem: _ctx.db->query<model::CppMemberType>(
411397
MemTypeQuery::typeHash == type.entityHash))
412398
{

0 commit comments

Comments
 (0)