summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang-tools-extra/test/CMakeLists.txt2
-rw-r--r--clang-tools-extra/test/modularize/InputNoProblems/SomeDecls.h5
-rw-r--r--clang-tools-extra/test/modularize/InputNoProblems/SomeTypes.h16
-rw-r--r--clang-tools-extra/test/modularize/InputProblemsDuplicate/Header1.h2
-rw-r--r--clang-tools-extra/test/modularize/InputProblemsDuplicate/Header2.h2
-rw-r--r--clang-tools-extra/test/modularize/InputProblemsInconsistent/Header1.h4
-rw-r--r--clang-tools-extra/test/modularize/InputProblemsInconsistent/Header2.h3
-rw-r--r--clang-tools-extra/test/modularize/InputProblemsInconsistent/SubHeader.h11
-rw-r--r--clang-tools-extra/test/modularize/NoProblems.cpp5
-rw-r--r--clang-tools-extra/test/modularize/ProblemsDuplicate.cpp6
-rw-r--r--clang-tools-extra/test/modularize/ProblemsInconsistent.cpp10
11 files changed, 65 insertions, 1 deletions
diff --git a/clang-tools-extra/test/CMakeLists.txt b/clang-tools-extra/test/CMakeLists.txt
index 7433f9c2608..50c0966fb74 100644
--- a/clang-tools-extra/test/CMakeLists.txt
+++ b/clang-tools-extra/test/CMakeLists.txt
@@ -22,7 +22,7 @@ set(CLANG_TOOLS_TEST_DEPS
clang clang-headers FileCheck count not
# Individual tools we test.
- remove-cstr-calls cpp11-migrate
+ remove-cstr-calls cpp11-migrate modularize
)
add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression tests"
diff --git a/clang-tools-extra/test/modularize/InputNoProblems/SomeDecls.h b/clang-tools-extra/test/modularize/InputNoProblems/SomeDecls.h
new file mode 100644
index 00000000000..af4d994d916
--- /dev/null
+++ b/clang-tools-extra/test/modularize/InputNoProblems/SomeDecls.h
@@ -0,0 +1,5 @@
+// Declare a couple of functions - no modules problems.
+
+void FuncOne();
+
+int FuncTwo(int arg);
diff --git a/clang-tools-extra/test/modularize/InputNoProblems/SomeTypes.h b/clang-tools-extra/test/modularize/InputNoProblems/SomeTypes.h
new file mode 100644
index 00000000000..46c4316fc93
--- /dev/null
+++ b/clang-tools-extra/test/modularize/InputNoProblems/SomeTypes.h
@@ -0,0 +1,16 @@
+// Define a few different kinds of types - no modules problems.
+
+typedef int TypeInt;
+
+typedef TypeInt NestedTypeInt;
+
+struct TypeStruct {
+ int Member;
+};
+
+class TypeClass {
+public:
+ TypeClass() : Member(0) {}
+private:
+ int Member;
+};
diff --git a/clang-tools-extra/test/modularize/InputProblemsDuplicate/Header1.h b/clang-tools-extra/test/modularize/InputProblemsDuplicate/Header1.h
new file mode 100644
index 00000000000..ad41bb13ab6
--- /dev/null
+++ b/clang-tools-extra/test/modularize/InputProblemsDuplicate/Header1.h
@@ -0,0 +1,2 @@
+// Same decl as in Header2.h.
+typedef int TypeInt;
diff --git a/clang-tools-extra/test/modularize/InputProblemsDuplicate/Header2.h b/clang-tools-extra/test/modularize/InputProblemsDuplicate/Header2.h
new file mode 100644
index 00000000000..938bb22f48f
--- /dev/null
+++ b/clang-tools-extra/test/modularize/InputProblemsDuplicate/Header2.h
@@ -0,0 +1,2 @@
+// Same decl as in Header1.h.
+typedef int TypeInt;
diff --git a/clang-tools-extra/test/modularize/InputProblemsInconsistent/Header1.h b/clang-tools-extra/test/modularize/InputProblemsInconsistent/Header1.h
new file mode 100644
index 00000000000..67629829557
--- /dev/null
+++ b/clang-tools-extra/test/modularize/InputProblemsInconsistent/Header1.h
@@ -0,0 +1,4 @@
+// Define symbol such that a declaration exists when this header
+// is included, but not when Header2.h is included.
+#define SYMBOL1 1
+#include "SubHeader.h"
diff --git a/clang-tools-extra/test/modularize/InputProblemsInconsistent/Header2.h b/clang-tools-extra/test/modularize/InputProblemsInconsistent/Header2.h
new file mode 100644
index 00000000000..aa59ff9141a
--- /dev/null
+++ b/clang-tools-extra/test/modularize/InputProblemsInconsistent/Header2.h
@@ -0,0 +1,3 @@
+// Set up so the declaration in SubHeader.h is not defined.
+#define SYMBOL2 1
+#include "SubHeader.h"
diff --git a/clang-tools-extra/test/modularize/InputProblemsInconsistent/SubHeader.h b/clang-tools-extra/test/modularize/InputProblemsInconsistent/SubHeader.h
new file mode 100644
index 00000000000..1395e489c78
--- /dev/null
+++ b/clang-tools-extra/test/modularize/InputProblemsInconsistent/SubHeader.h
@@ -0,0 +1,11 @@
+// Set up so TypeInt only defined during Header1.h include.
+#ifdef SYMBOL1
+#define SYMBOL 1
+#endif
+#ifdef SYMBOL2
+#define SYMBOL 2
+#endif
+
+#if SYMBOL == 1
+typedef int TypeInt;
+#endif
diff --git a/clang-tools-extra/test/modularize/NoProblems.cpp b/clang-tools-extra/test/modularize/NoProblems.cpp
new file mode 100644
index 00000000000..ad0a314fe43
--- /dev/null
+++ b/clang-tools-extra/test/modularize/NoProblems.cpp
@@ -0,0 +1,5 @@
+# RUN: modularize %s -x c++
+# RUN: modularize -prefix=%p %s -x c++
+
+InputNoProblems/SomeTypes.h
+InputNoProblems/SomeDecls.h
diff --git a/clang-tools-extra/test/modularize/ProblemsDuplicate.cpp b/clang-tools-extra/test/modularize/ProblemsDuplicate.cpp
new file mode 100644
index 00000000000..85a29bf4efb
--- /dev/null
+++ b/clang-tools-extra/test/modularize/ProblemsDuplicate.cpp
@@ -0,0 +1,6 @@
+# RUN: modularize %s -x c++ 2>&1 | FileCheck %s
+
+InputProblemsDuplicate/Header1.h
+InputProblemsDuplicate/Header2.h
+
+# CHECK: error: 'TypeInt' defined at both {{.*}}{{[/\\]}}InputProblemsDuplicate{{[/\\]}}Header1.h:2:13 and {{.*}}{{[/\\]}}InputProblemsDuplicate{{[/\\]}}Header2.h:2:13
diff --git a/clang-tools-extra/test/modularize/ProblemsInconsistent.cpp b/clang-tools-extra/test/modularize/ProblemsInconsistent.cpp
new file mode 100644
index 00000000000..d79601418d5
--- /dev/null
+++ b/clang-tools-extra/test/modularize/ProblemsInconsistent.cpp
@@ -0,0 +1,10 @@
+# RUN: modularize %s -x c++ 2>&1 | FileCheck %s
+
+InputProblemsInconsistent/Header1.h
+InputProblemsInconsistent/Header2.h
+
+# CHECK: error: 'SYMBOL' defined at both {{.*}}{{[/\\]}}InputProblemsInconsistent{{[/\\]}}SubHeader.h:3:9 and {{.*}}{{[/\\]}}InputProblemsInconsistent/SubHeader.h:6:9
+# CHECK-NEXT: error: header '{{.*}}{{[/\\]}}InputProblemsInconsistent{{[/\\]}}SubHeader.h' has different contents dependening on how it was included
+# CHECK-NEXT: note: 'SYMBOL' in {{.*}}{{[/\\]}}InputProblemsInconsistent{{[/\\]}}SubHeader.h at 3:9 not always provided
+# CHECK-NEXT: note: 'SYMBOL' in {{.*}}{{[/\\]}}InputProblemsInconsistent{{[/\\]}}SubHeader.h at 6:9 not always provided
+# CHECK-NEXT: note: 'TypeInt' in {{.*}}{{[/\\]}}InputProblemsInconsistent{{[/\\]}}SubHeader.h at 10:13 not always provided
OpenPOWER on IntegriCloud