Index: test/modularize/ProblemsDuplicate.cpp
===================================================================
--- test/modularize/ProblemsDuplicate.cpp	(revision 0)
+++ test/modularize/ProblemsDuplicate.cpp	(revision 0)
@@ -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
Index: test/modularize/InputNoProblems/SomeDecls.h
===================================================================
--- test/modularize/InputNoProblems/SomeDecls.h	(revision 0)
+++ test/modularize/InputNoProblems/SomeDecls.h	(revision 0)
@@ -0,0 +1,5 @@
+// SomeDecls.h - Declare a couple of functions - no modules problems.
+
+void FuncOne();
+
+int FuncTwo(int arg);
Index: test/modularize/InputNoProblems/SomeTypes.h
===================================================================
--- test/modularize/InputNoProblems/SomeTypes.h	(revision 0)
+++ test/modularize/InputNoProblems/SomeTypes.h	(revision 0)
@@ -0,0 +1,18 @@
+// SomeTypes.h - 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;
+};
Index: test/modularize/NoProblems.cpp
===================================================================
--- test/modularize/NoProblems.cpp	(revision 0)
+++ test/modularize/NoProblems.cpp	(revision 0)
@@ -0,0 +1,4 @@
+# RUN: modularize %s -x c++
+
+InputNoProblems/SomeTypes.h
+InputNoProblems/SomeDecls.h
Index: test/modularize/InputProblemsInconsistent/Header1.h
===================================================================
--- test/modularize/InputProblemsInconsistent/Header1.h	(revision 0)
+++ test/modularize/InputProblemsInconsistent/Header1.h	(revision 0)
@@ -0,0 +1,4 @@
+// Header1.h - 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"
Index: test/modularize/InputProblemsInconsistent/Header2.h
===================================================================
--- test/modularize/InputProblemsInconsistent/Header2.h	(revision 0)
+++ test/modularize/InputProblemsInconsistent/Header2.h	(revision 0)
@@ -0,0 +1,3 @@
+// Header2.h - Set up so the declaration in SubHeader.h is not defined.
+#define SYMBOL2 1
+#include "SubHeader.h"
Index: test/modularize/InputProblemsInconsistent/SubHeader.h
===================================================================
--- test/modularize/InputProblemsInconsistent/SubHeader.h	(revision 0)
+++ test/modularize/InputProblemsInconsistent/SubHeader.h	(revision 0)
@@ -0,0 +1,11 @@
+// SubHeader.h - 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
Index: test/modularize/ProblemsInconsistent.cpp
===================================================================
--- test/modularize/ProblemsInconsistent.cpp	(revision 0)
+++ test/modularize/ProblemsInconsistent.cpp	(revision 0)
@@ -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
Index: test/modularize/InputProblemsDuplicate/Header1.h
===================================================================
--- test/modularize/InputProblemsDuplicate/Header1.h	(revision 0)
+++ test/modularize/InputProblemsDuplicate/Header1.h	(revision 0)
@@ -0,0 +1,2 @@
+// Header1.h -  Same decl as in Header2.h.
+typedef int TypeInt;
Index: test/modularize/InputProblemsDuplicate/Header2.h
===================================================================
--- test/modularize/InputProblemsDuplicate/Header2.h	(revision 0)
+++ test/modularize/InputProblemsDuplicate/Header2.h	(revision 0)
@@ -0,0 +1,2 @@
+// Header2.h -  Same decl as in Header1.h.
+typedef int TypeInt;
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt	(revision 177198)
+++ test/CMakeLists.txt	(working copy)
@@ -22,7 +22,7 @@
   clang clang-headers FileCheck count not
 
   # Individual tools we test.
-  remove-cstr-calls cpp11-migrate clang-format
+  remove-cstr-calls cpp11-migrate clang-format modularize
   )
 
 add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression tests"
