summaryrefslogtreecommitdiffstats
path: root/tests/cxx/typedef_chain_no_follow.cc
blob: 963f2e16ef1c382c95fab7dc09403e2c7ee36071 (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
//===--- typedef_chain_no_follow.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.
//
//===----------------------------------------------------------------------===//

// Tests cases when IWYU should not follow typedef chain and should not suggest
// to include a file for underlying typedef type.

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

void TypedefDeclaredInGlobalNamespace() {
  TypedefChainTypedef tct;
  tct.Method();
}

// Tests how we handle a typedef declared in a class.  Main purpose is to make
// sure we handle typedefs in templates the same way as typedefs in classes
// when typedef does not depend on template argument.
void TypedefDeclaredInClass() {
  NonContainer1 nc;
  nc.GetTypedefChainClass().Method();
}

// Tests that we don't follow typedef chain and don't suggest to use
// TypedefChainClass directly.
void TypedefDeclaredInTemplate() {
  NonContainer2<int> nc;
  nc.GetTypedefChainClass().Method();
}

/**** IWYU_SUMMARY

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

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

The full include-list for tests/cxx/typedef_chain_no_follow.cc:
#include "tests/cxx/typedef_chain_no_follow-d1.h"  // for TypedefChainTypedef
#include "tests/cxx/typedef_chain_no_follow-d2.h"  // for NonContainer1, NonContainer1::value_type
#include "tests/cxx/typedef_chain_no_follow-d3.h"  // for NonContainer2, NonContainer2::value_type

***** IWYU_SUMMARY */