summaryrefslogtreecommitdiffstats
path: root/tests/cxx/system_namespaces.cc
blob: f5a1f0c62ade0fbd51cda8449d0560e27b3e7533 (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
//===--- system_namespaces.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 that we correctly replace forward declares with #includes for
// items in a system namespace: std or __gnu_cxx or the like.

#include "tests/cxx/system_namespaces-d1.h"
#include "tests/cxx/system_namespaces-d2.h"
#include "tests/cxx/system_namespaces-d3.h"

std::StdClass* foo = 0;

__gnu_cxx::SystemClass* bar = 0;

typedef int __system_type;
notsys_ns::TplClass<__system_type>* baz = 0;


// The summary is where all the action is on this test.  Only TplClass
// should be replaceable by a forward-declare, because only it is
// exposing a symbol in a non-system namespace.

/**** IWYU_SUMMARY

tests/cxx/system_namespaces.cc should add these lines:
namespace notsys_ns { template <typename T> class TplClass; }

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

The full include-list for tests/cxx/system_namespaces.cc:
#include "tests/cxx/system_namespaces-d1.h"  // for StdClass
#include "tests/cxx/system_namespaces-d2.h"  // for SystemClass
namespace notsys_ns { template <typename T> class TplClass; }

***** IWYU_SUMMARY */