summaryrefslogtreecommitdiffstats
path: root/test/modularize
diff options
context:
space:
mode:
authorJohn Thompson <John.Thompson.JTSoftware@gmail.com>2013-09-18 18:19:43 +0000
committerJohn Thompson <John.Thompson.JTSoftware@gmail.com>2013-09-18 18:19:43 +0000
commita97aeb732d5704a831ba7d9ece67b817e2e69870 (patch)
tree341c2b96b9120e37b33616ea7e214325a083b6d6 /test/modularize
parent48e835a263d5cba2ac429ce559901bf786277781 (diff)
Check for #include in extern and namespace blocks.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@190950 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/modularize')
-rw-r--r--test/modularize/Inputs/Empty.h1
-rw-r--r--test/modularize/Inputs/IncludeInExtern.h3
-rw-r--r--test/modularize/Inputs/IncludeInNamespace.h3
-rw-r--r--test/modularize/ProblemsExternC.modularize12
-rw-r--r--test/modularize/ProblemsNamespace.modularize12
5 files changed, 31 insertions, 0 deletions
diff --git a/test/modularize/Inputs/Empty.h b/test/modularize/Inputs/Empty.h
new file mode 100644
index 00000000..d74d27d9
--- /dev/null
+++ b/test/modularize/Inputs/Empty.h
@@ -0,0 +1 @@
+// Empty header for testing #include directives in blocks.
diff --git a/test/modularize/Inputs/IncludeInExtern.h b/test/modularize/Inputs/IncludeInExtern.h
new file mode 100644
index 00000000..da7de8fa
--- /dev/null
+++ b/test/modularize/Inputs/IncludeInExtern.h
@@ -0,0 +1,3 @@
+extern "C" {
+ #include "Empty.h"
+}
diff --git a/test/modularize/Inputs/IncludeInNamespace.h b/test/modularize/Inputs/IncludeInNamespace.h
new file mode 100644
index 00000000..21225288
--- /dev/null
+++ b/test/modularize/Inputs/IncludeInNamespace.h
@@ -0,0 +1,3 @@
+namespace MyNamespace {
+ #include "Empty.h"
+}
diff --git a/test/modularize/ProblemsExternC.modularize b/test/modularize/ProblemsExternC.modularize
new file mode 100644
index 00000000..e16dcfdb
--- /dev/null
+++ b/test/modularize/ProblemsExternC.modularize
@@ -0,0 +1,12 @@
+# RUN: not modularize %s -x c++ 2>&1 | FileCheck %s
+
+Inputs/IncludeInExtern.h
+
+# CHECK: {{.*}}{{[/\\]}}Inputs{{[/\\]}}IncludeInExtern.h:2:3
+# CHECK-NEXT: #include "Empty.h"
+# CHECK-NEXT: ^
+# CHECK-NEXT: error: Include directive within extern "C" {}.
+# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}IncludeInExtern.h:1:1
+# CHECK-NEXT: extern "C" {
+# CHECK-NEXT: ^
+# CHECK-NEXT: The "extern "C" {}" block is here.
diff --git a/test/modularize/ProblemsNamespace.modularize b/test/modularize/ProblemsNamespace.modularize
new file mode 100644
index 00000000..193402b9
--- /dev/null
+++ b/test/modularize/ProblemsNamespace.modularize
@@ -0,0 +1,12 @@
+# RUN: not modularize %s -x c++ 2>&1 | FileCheck %s
+
+Inputs/IncludeInNamespace.h
+
+# CHECK: {{.*}}{{[/\\]}}Inputs{{[/\\]}}IncludeInNamespace.h:2:3
+# CHECK-NEXT: #include "Empty.h"
+# CHECK-NEXT: ^
+# CHECK-NEXT: error: Include directive within namespace MyNamespace {}.
+# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}IncludeInNamespace.h:1:1
+# CHECK-NEXT: namespace MyNamespace {
+# CHECK-NEXT: ^
+# CHECK-NEXT: The "namespace MyNamespace {}" block is here.