Switch the remaining modules tests over to -emit-module-from-map.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144795 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Modules/Inputs/category_bottom.h b/test/Modules/Inputs/category_bottom.h
new file mode 100644
index 0000000..20f7813
--- /dev/null
+++ b/test/Modules/Inputs/category_bottom.h
@@ -0,0 +1,11 @@
+__import_module__ category_left;
+
+@interface Foo(Bottom)
+-(void)bottom;
+@end
+
+__import_module__ category_right;
+
+@interface LeftFoo(Bottom)
+-(void)bottom;
+@end
diff --git a/test/Modules/Inputs/category_left.h b/test/Modules/Inputs/category_left.h
new file mode 100644
index 0000000..d388a03
--- /dev/null
+++ b/test/Modules/Inputs/category_left.h
@@ -0,0 +1,15 @@
+__import_module__ category_top;
+
+@interface Foo(Left)
+-(void)left;
+@end
+
+@interface LeftFoo
+-(void)left;
+@end
+
+@interface Foo(Duplicate)
+@end
+
+@interface Foo(Duplicate)
+@end
diff --git a/test/Modules/Inputs/category_right.h b/test/Modules/Inputs/category_right.h
new file mode 100644
index 0000000..a1a1377
--- /dev/null
+++ b/test/Modules/Inputs/category_right.h
@@ -0,0 +1,12 @@
+__import_module__ category_top;
+
+@interface Foo(Right1)
+-(void)right1;
+@end
+
+@interface Foo(Right2)
+-(void)right2;
+@end
+
+@interface Foo(Duplicate) // expected-warning {{duplicate definition of category}}
+@end
diff --git a/test/Modules/Inputs/category_top.h b/test/Modules/Inputs/category_top.h
new file mode 100644
index 0000000..df6a6d3
--- /dev/null
+++ b/test/Modules/Inputs/category_top.h
@@ -0,0 +1,6 @@
+@interface Foo
+@end
+
+@interface Foo(Top)
+-(void)top;
+@end
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index 13546b0..aefaf9d 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -10,3 +10,10 @@
 module module_private_left { umbrella "module_private_left.h" }
 module module_private_right { umbrella "module_private_right.h" }
 module macros { umbrella "macros.h" }
+module category_top { umbrella "category_top.h" }
+module category_left { umbrella "category_left.h" }
+module category_right { umbrella "category_right.h" }
+module category_bottom { umbrella "category_bottom.h" }
+module redeclarations_left { umbrella "redeclarations_left.h" }
+module redeclarations_right { umbrella "redeclarations_right.h" }
+module load_failure { umbrella "load_failure.h" }
diff --git a/test/Modules/Inputs/redeclarations_left.h b/test/Modules/Inputs/redeclarations_left.h
new file mode 100644
index 0000000..4dfbf1d
--- /dev/null
+++ b/test/Modules/Inputs/redeclarations_left.h
@@ -0,0 +1,2 @@
+@class NSObject;
+
diff --git a/test/Modules/Inputs/redeclarations_right.h b/test/Modules/Inputs/redeclarations_right.h
new file mode 100644
index 0000000..d3861fe
--- /dev/null
+++ b/test/Modules/Inputs/redeclarations_right.h
@@ -0,0 +1,2 @@
+@interface NSObject
+@end
diff --git a/test/Modules/load_failure.c b/test/Modules/load_failure.c
index d16bba7..d33b7cf 100644
--- a/test/Modules/load_failure.c
+++ b/test/Modules/load_failure.c
@@ -6,12 +6,13 @@
 __import_module__ load_failure;
 #endif
 
-// RUN: %clang_cc1 -x c++ -emit-module -o %T/load_failure.pcm %S/Inputs/load_failure.h
-// RUN: %clang_cc1 -fmodule-cache-path %T -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x c++ -fmodule-cache-path %t -fdisable-module-hash -emit-module-from-map -fmodule-name=load_failure %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s
 // CHECK-NONEXISTENT: load_failure.c:2:19: fatal error: module 'load_nonexistent' not found
 
-// RUN: not %clang_cc1 -fmodule-cache-path %T -fdisable-module-hash %s -DFAILURE 2> %t
-// RUN: FileCheck -check-prefix=CHECK-FAILURE %s < %t
+// RUN: not %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -DFAILURE 2> %t.out
+// RUN: FileCheck -check-prefix=CHECK-FAILURE %s < %t.out
 
 // FIXME: Clean up diagnostic text below and give it a location
 // CHECK-FAILURE: error: C99 was disabled in PCH file but is currently enabled
diff --git a/test/Modules/objc-categories.m b/test/Modules/objc-categories.m
index 87aaa5c..598687d 100644
--- a/test/Modules/objc-categories.m
+++ b/test/Modules/objc-categories.m
@@ -1,77 +1,17 @@
-// RUN: mkdir -p %t
-// RUN: %clang_cc1 -emit-module -o %t/diamond_top.pcm %s -D MODULE_TOP
-// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_left.pcm %s -D MODULE_LEFT
-// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_right.pcm %s -D MODULE_RIGHT
-// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/diamond_bottom.pcm %s -D MODULE_BOTTOM
-// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -verify
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodule-cache-path %t -x objective-c -fmodule-name=category_top -emit-module-from-map %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodule-cache-path %t -x objective-c -fmodule-name=category_left -emit-module-from-map %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodule-cache-path %t -x objective-c -fmodule-name=category_right -emit-module-from-map %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodule-cache-path %t -x objective-c -fmodule-name=category_bottom -emit-module-from-map %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodule-cache-path %t %s -verify
 
-/*============================================================================*/
-#ifdef MODULE_TOP
+__import_module__ category_bottom;
 
-@interface Foo
-@end
 
-@interface Foo(Top)
--(void)top;
-@end
-
-/*============================================================================*/
-#elif defined(MODULE_LEFT)
-
-__import_module__ diamond_top;
-
-@interface Foo(Left)
--(void)left;
-@end
-
-@interface LeftFoo
--(void)left;
-@end
-
-@interface Foo(Duplicate) // expected-note {{previous definition}}
-@end
-
-@interface Foo(Duplicate)
-@end
-
-/*============================================================================*/
-#elif defined(MODULE_RIGHT)
-
-__import_module__ diamond_top;
-
-@interface Foo(Right1)
--(void)right1;
-@end
-
-@interface Foo(Right2)
--(void)right2;
-@end
-
-@interface Foo(Duplicate) // expected-warning {{duplicate definition of category}}
-@end
-
-/*============================================================================*/
-#elif defined(MODULE_BOTTOM)
-
-__import_module__ diamond_left;
-
-@interface Foo(Bottom)
--(void)bottom;
-@end
-
-__import_module__ diamond_right;
-
-@interface LeftFoo(Bottom)
--(void)bottom;
-@end
-
-/*============================================================================*/
-#else
-
-__import_module__ diamond_bottom;
+// in category_left.h: expected-note {{previous definition}}
 
 @interface Foo(Source)
--(void)source;
+-(void)source; 
 @end
 
 void test(Foo *foo, LeftFoo *leftFoo) {
@@ -85,5 +25,3 @@
   [leftFoo left];
   [leftFoo bottom];
 }
-
-#endif
diff --git a/test/Modules/redeclarations.m b/test/Modules/redeclarations.m
index 1a37230..da856ac 100644
--- a/test/Modules/redeclarations.m
+++ b/test/Modules/redeclarations.m
@@ -1,22 +1,11 @@
-#ifdef MODULE_LEFT
-@class NSObject;
-#endif
-
-#ifdef MODULE_RIGHT
-@interface NSObject
-@end
-#endif
-
-#ifdef APP
-__import_module__ Right;
-__import_module__ Left;
+__import_module__ redeclarations_left;
+__import_module__ redeclarations_right;
 
 @interface MyObject : NSObject
 @end
-#endif
 
 // RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/Left.pcm -DMODULE_LEFT %s
-// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -emit-module -o %t/Right.pcm -DMODULE_RIGHT %s
-// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash -DAPP %s -verify
+// RUN: %clang_cc1 -x objective-c -fmodule-cache-path %t -emit-module-from-map -fmodule-name=redeclarations_left %S/Inputs/module.map
+// RUN: %clang_cc1 -x objective-c -fmodule-cache-path %t -emit-module-from-map -fmodule-name=redeclarations_right %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodule-cache-path %t %s -verify