blob: 6e778f4e4180ece9194ebfb90ff93d2e955535f9 (
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
|
//===--- re_fwd_decl.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 .
// If we use a class in a way that only requires a forward-declaration,
// and the class is defined in some file we directly #include, we don't
// need the forward-decl here. But if it's only *declared* in a file
// we directly #include, we *do* need the forward-decl.
#include "tests/cxx/re_fwd_decl.h"
#include "tests/cxx/re_fwd_decl-d1.h"
Direct* d = 0;
// IWYU: Indirect needs a declaration
Indirect* i = 0;
// This is not an iwyu violation because it's declared in the .h file
DeclaredInH* dih = 0;
// This forces us to #include re_fwd_decl-d1.h. Without this, iwyu would
// just suggest replacing the #include with 'class Direct'.
FullUse fu;
/**** IWYU_SUMMARY
tests/cxx/re_fwd_decl.cc should add these lines:
class Indirect;
tests/cxx/re_fwd_decl.cc should remove these lines:
The full include-list for tests/cxx/re_fwd_decl.cc:
#include "tests/cxx/re_fwd_decl.h"
#include "tests/cxx/re_fwd_decl-d1.h" // for Direct (ptr only), FullUse
class Indirect;
***** IWYU_SUMMARY */
|