summaryrefslogtreecommitdiffstats
path: root/tests/cxx/macro_location_tpl.cc
blob: 01a0a006382b67859d2a04fdf686e487333f9cc4 (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
//===--- macro_location_tpl.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.
//
//===----------------------------------------------------------------------===//

// Expands on macro_location test case to also cover template scenarios.  Macro
// uses are attributed to spelling location, but forward-declarations of primary
// templates also work as author intent hints for template specializations used
// inside the macro.

// IWYU_ARGS: -I .

#include "tests/cxx/macro_location_tpl-d2.h"
#include "tests/cxx/macro_location_tpl-d1.h"

void use_macro_with_template_spec() {
  // IWYU: FUNC_TEMPLATE_SPEC_EXPANSION is defined...*macro_location_tpl-i1.h
  FUNC_TEMPLATE_SPEC_EXPANSION;

  // IWYU: FUNC_TEMPLATE_SPEC_SPELLING is defined...*macro_location_tpl-i1.h
  FUNC_TEMPLATE_SPEC_SPELLING;

  // IWYU: CLASS_TEMPLATE_SPEC_EXPANSION is defined...*macro_location_tpl-i1.h
  CLASS_TEMPLATE_SPEC_EXPANSION;

  // IWYU: CLASS_TEMPLATE_SPEC_SPELLING is defined...*macro_location_tpl-i1.h
  CLASS_TEMPLATE_SPEC_SPELLING;
}

/**** IWYU_SUMMARY

tests/cxx/macro_location_tpl.cc should add these lines:
#include "tests/cxx/macro_location_tpl-i1.h"

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

The full include-list for tests/cxx/macro_location_tpl.cc:
#include "tests/cxx/macro_location_tpl-d2.h"  // for ExpansionTemplate, expansion_template
#include "tests/cxx/macro_location_tpl-i1.h"  // for CLASS_TEMPLATE_SPEC_EXPANSION, CLASS_TEMPLATE_SPEC_SPELLING, FUNC_TEMPLATE_SPEC_EXPANSION, FUNC_TEMPLATE_SPEC_SPELLING

***** IWYU_SUMMARY */