When a type alias is added for a generic type (via a using statement) the include graph currently doesn't record the usage of the type alias but only of the underlying type.
Given the usage of myvec below
#include "myvec.h"
void func() {
myvec<int> mv;
}
And the declaration of myvec in the header myvec.h
#pragma once
#include <vector>
template <typename T>
using myvec = std::vector<T>;
clangmetatool will not notice that myvec.h is used at all.
When a type alias is added for a generic type (via a using statement) the include graph currently doesn't record the usage of the type alias but only of the underlying type.
Given the usage of myvec below
And the declaration of myvec in the header
myvec.h
clangmetatool will not notice that
myvec.h
is used at all.It tries to find the declaration of
myvec
but ends up finding the declaration ofstd::vector
(see https://github.com/bloomberg/clangmetatool/blob/cb17e415ffbc6b98c2f307f2aaff4be5cd56af0a/src/collectors/include_graph/include_graph_util.cpp#L240-L259).This PR fixes this by matching both the usage of type and its declaration.
Testing performed See the attached test case
Signed-off-by: Kojo Adams kadams85@bloomberg.net