summaryrefslogtreecommitdiffstats
path: root/tests/cxx/macro_location_tpl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cxx/macro_location_tpl.cc')
-rw-r--r--tests/cxx/macro_location_tpl.cc46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/cxx/macro_location_tpl.cc b/tests/cxx/macro_location_tpl.cc
new file mode 100644
index 0000000..01a0a00
--- /dev/null
+++ b/tests/cxx/macro_location_tpl.cc
@@ -0,0 +1,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 */