Report aliased template parameter
Template-nested typedef can't be responsible for any parameter of the template, because an exact type is known only on template specialization.
This commit is contained in:
parent
e0ae900e84
commit
0f7a7aba8c
3
iwyu.cc
3
iwyu.cc
|
@ -1433,7 +1433,8 @@ class IwyuBaseAstVisitor : public BaseAstVisitor<Derived> {
|
|||
|
||||
const Type* deref_type
|
||||
= RemovePointersAndReferencesAsWritten(underlying_type);
|
||||
if (CodeAuthorWantsJustAForwardDeclare(deref_type, GetLocation(decl))) {
|
||||
if (isa<SubstTemplateTypeParmType>(deref_type) ||
|
||||
CodeAuthorWantsJustAForwardDeclare(deref_type, GetLocation(decl))) {
|
||||
retval.insert(deref_type);
|
||||
// TODO(csilvers): include template type-args if appropriate.
|
||||
// This requires doing an iwyu visit of the instantiated
|
||||
|
|
|
@ -43,7 +43,7 @@ void Declarations() {
|
|||
// of corresponding template argument type.
|
||||
|
||||
// TODO: full Class2 type info isn't needed here
|
||||
// TODO: IWYU: Class1 is...*typedef_in_template-i1.h
|
||||
// IWYU: Class1 is...*typedef_in_template-i1.h
|
||||
// IWYU: Class1 needs a declaration
|
||||
// IWYU: Class2 is...*typedef_in_template-i2.h
|
||||
// IWYU: Class2 needs a declaration
|
||||
|
@ -55,7 +55,7 @@ void Declarations() {
|
|||
Container<Class1, Class2>::pair_type pt;
|
||||
|
||||
// TODO: full Class2 type info isn't needed here
|
||||
// TODO: IWYU: Class1 is...*typedef_in_template-i1.h
|
||||
// IWYU: Class1 is...*typedef_in_template-i1.h
|
||||
// IWYU: Class1 needs a declaration
|
||||
// IWYU: Class2 is...*typedef_in_template-i2.h
|
||||
// IWYU: Class2 needs a declaration
|
||||
|
@ -110,8 +110,8 @@ NestedUseOfAliasedParameter<IndirectClass> c;
|
|||
|
||||
tests/cxx/typedef_in_template.cc should add these lines:
|
||||
#include "tests/cxx/indirect.h"
|
||||
#include "tests/cxx/typedef_in_template-i1.h"
|
||||
#include "tests/cxx/typedef_in_template-i2.h"
|
||||
class Class1;
|
||||
|
||||
tests/cxx/typedef_in_template.cc should remove these lines:
|
||||
- #include "tests/cxx/direct.h" // lines XX-XX
|
||||
|
@ -120,7 +120,7 @@ tests/cxx/typedef_in_template.cc should remove these lines:
|
|||
|
||||
The full include-list for tests/cxx/typedef_in_template.cc:
|
||||
#include "tests/cxx/indirect.h" // for IndirectClass
|
||||
#include "tests/cxx/typedef_in_template-i1.h" // for Class1
|
||||
#include "tests/cxx/typedef_in_template-i2.h" // for Class2, Pair
|
||||
class Class1;
|
||||
|
||||
***** IWYU_SUMMARY */
|
||||
|
|
Loading…
Reference in New Issue