Skip to content

Commit

Permalink
fix: propagate current dependency mode when extracting typedefs as a …
Browse files Browse the repository at this point in the history
…dependency
  • Loading branch information
sdkrystian committed May 27, 2024
1 parent d456f87 commit 7820d6a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/AST/ASTVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1835,8 +1835,13 @@ class ASTVisitor

I.Name = extractName(D);

// When a symbol has a dependency on a typedef, we also
// consider the symbol to have a dependency on the aliased
// type. Therefore, we propagate the current dependency mode
// when building the TypeInfo for the aliased type
I.Type = buildTypeInfo(
D->getUnderlyingType());
D->getUnderlyingType(),
currentMode());

#if 0
if(I.Type.Name.empty())
Expand Down
15 changes: 15 additions & 0 deletions test-files/old-tests/dependency-propagation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace N
{
template<typename T>
struct A { };

template<typename T>
using B = A<T>;

template<typename T>
using C = B<T>;

struct D { };
}

struct E : N::C<int> { };
25 changes: 25 additions & 0 deletions test-files/old-tests/dependency-propagation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<mrdocs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://github.com/cppalliance/mrdocs/raw/develop/mrdocs.rnc">
<namespace id="//////////////////////////8=">
<struct name="E" id="KJWEqOD/QXinlGIqVHqmIlA5Z6E=">
<file path="dependency-propagation.cpp" line="15" class="def"/>
<base>
<type id="1aINBgFfB9zQVkEDJdB0DyLWTmQ=" name="N::C&lt;int&gt;"/>
</base>
</struct>
<namespace name="N" id="rjlMNXAaWNMkQYMTJzRA1DR0DiE=">
<alias name="C" id="1aINBgFfB9zQVkEDJdB0DyLWTmQ=">
<file path="dependency-propagation.cpp" line="10" class="def"/>
<type id="YZjBn7yW7NyL8yCKqswVvbiptNM=" name="N::B&lt;T&gt;"/>
</alias>
<alias name="B" id="YZjBn7yW7NyL8yCKqswVvbiptNM=">
<file path="dependency-propagation.cpp" line="7" class="def"/>
<type id="P3wHAbrIf4CGxTZs+lXT5a3t2K0=" name="N::A&lt;T&gt;"/>
</alias>
<struct name="A" id="P3wHAbrIf4CGxTZs+lXT5a3t2K0=">
<file path="dependency-propagation.cpp" line="4" class="def"/>
</struct>
</namespace>
</namespace>
</mrdocs>
5 changes: 5 additions & 0 deletions test-files/old-tests/dependency-propagation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
filters:
symbols:
exclude:
- 'N'
referenced-declarations: dependency

0 comments on commit 7820d6a

Please sign in to comment.