summaryrefslogtreecommitdiffstats
path: root/tests/cxx/typedef_chain_in_template.cc
blob: a1ebd61afe42c6735d1f8e3a09e17c973381240a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//===--- typedef_chain_in_template.cc - test input file for iwyu ----------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// IWYU_ARGS: -I .

// Tests that if template declares a typedef depending on template argument,
// IWYU follows the typedef chain and uses underlying type that is not a
// typedef depending on template argument.  Usually such typedefs are template
// implementation details and template clients should not use these typedefs
// directly.

#include "tests/cxx/typedef_chain_in_template-d1.h"
#include "tests/cxx/typedef_chain_in_template-d2.h"
#include "tests/cxx/typedef_chain_in_template-d3.h"
#include "tests/cxx/typedef_chain_in_template-d4.h"
#include "tests/cxx/typedef_chain_class.h"
// Unused include to trigger IWYU summary telling what symbols are used from
// every file.
#include "tests/cxx/direct.h"

void UsageAsWithLibstdcpp() {
  ContainerAsLibstdcpp<TypedefChainClass> c;
  c.GetContent().Method();
}

void UsageAsWithLibcpp() {
  ContainerAsLibcpp<TypedefChainClass> c;
  c.GetContent().Method();
}

void UsageWithShorterTypedefChain() {
  ContainerShortTypedefChain<TypedefChainClass> c;
  c.GetContent1().Method();
  c.GetContent2().Method();
}

void UsageWithLongerTypedefChain() {
  ContainerLongTypedefChain<TypedefChainClass> c;
  c.GetContent1().Method();
  c.GetContent2().Method();
}

/**** IWYU_SUMMARY

tests/cxx/typedef_chain_in_template.cc should add these lines:

tests/cxx/typedef_chain_in_template.cc should remove these lines:
- #include "tests/cxx/direct.h"  // lines XX-XX

The full include-list for tests/cxx/typedef_chain_in_template.cc:
#include "tests/cxx/typedef_chain_class.h"  // for TypedefChainClass
#include "tests/cxx/typedef_chain_in_template-d1.h"  // for ContainerAsLibstdcpp
#include "tests/cxx/typedef_chain_in_template-d2.h"  // for ContainerAsLibcpp
#include "tests/cxx/typedef_chain_in_template-d3.h"  // for ContainerShortTypedefChain
#include "tests/cxx/typedef_chain_in_template-d4.h"  // for ContainerLongTypedefChain

***** IWYU_SUMMARY */