Update tests in preparation for using the MS ABI for Win32 targets

In preparation for making the Win32 triple imply MS ABI mode,
make all tests pass in this mode, or make them use the Itanium
mode explicitly.

Differential Revision: http://llvm-reviews.chandlerc.com/D2401

llvm-svn: 199130
diff --git a/clang/test/SemaTemplate/inject-templated-friend-post.cpp b/clang/test/SemaTemplate/inject-templated-friend-post.cpp
index c86f718..b0aca68 100644
--- a/clang/test/SemaTemplate/inject-templated-friend-post.cpp
+++ b/clang/test/SemaTemplate/inject-templated-friend-post.cpp
@@ -1,12 +1,17 @@
-// RUN: %clang %s -std=c++98 -S -emit-llvm -o - | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
-// RUN: %clang %s -std=c++98 -S -emit-llvm -o - -DPROTOTYPE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
-// RUN: %clang %s -std=c++98 -S -emit-llvm -o - -DINSTANTIATE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
-// RUN: %clang %s -std=c++98 -S -emit-llvm -o - -DPROTOTYPE -DINSTANTIATE | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
+// RUN: %clang_cc1 %s -std=c++98 -cxx-abi itanium -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -std=c++98 -cxx-abi itanium -emit-llvm -o - -DPROTOTYPE | FileCheck --check-prefix=CHECK-PROTOTYPE %s
+// RUN: %clang_cc1 %s -std=c++98 -cxx-abi itanium -emit-llvm -o - -DINSTANTIATE | FileCheck --check-prefix=CHECK-INSTANTIATE %s
+// RUN: %clang_cc1 %s -std=c++98 -cxx-abi itanium -emit-llvm -o - -DPROTOTYPE -DINSTANTIATE | FileCheck --check-prefix=CHECK-PROTOTYPE-INSTANTIATE %s
 // RUN: %clang_cc1 %s -DREDEFINE -verify
 // RUN: %clang_cc1 %s -DPROTOTYPE -DREDEFINE -verify
 // PR8007: friend function not instantiated, reordered version.
 // Corresponds to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38392
 
+// CHECK: define linkonce_odr{{.*}}_ZlsR11std_ostreamRK8StreamerI3FooE
+// CHECK-PROTOTYPE: define linkonce_odr{{.*}}_ZlsR11std_ostreamRK8StreamerI3FooE
+// CHECK-INSTANTIATE: define linkonce_odr{{.*}}_ZlsR11std_ostreamRK8StreamerI3FooE
+// CHECK-PROTOTYPE-INSTANTIATE: define linkonce_odr{{.*}}_ZlsR11std_ostreamRK8StreamerI3FooE
+
 struct std_ostream
 {
   int dummy;
diff --git a/clang/test/SemaTemplate/inject-templated-friend.cpp b/clang/test/SemaTemplate/inject-templated-friend.cpp
index 7be613b..037d6675 100644
--- a/clang/test/SemaTemplate/inject-templated-friend.cpp
+++ b/clang/test/SemaTemplate/inject-templated-friend.cpp
@@ -1,7 +1,9 @@
-// RUN: %clang %s -S -emit-llvm -o - | grep -e "define linkonce_odr.*_ZlsR11std_ostreamRK8StreamerI3FooE"
+// RUN: %clang_cc1 %s -emit-llvm -cxx-abi itanium -o - | FileCheck %s
 // RUN: %clang_cc1 %s -DREDEFINE -verify
 // PR8007: friend function not instantiated.
 
+// CHECK: define linkonce_odr{{.*}}_ZlsR11std_ostreamRK8StreamerI3FooE
+
 struct std_ostream
 {
   int dummy;
diff --git a/clang/test/SemaTemplate/instantiate-complete.cpp b/clang/test/SemaTemplate/instantiate-complete.cpp
index 68d5ae3..0e169b9 100644
--- a/clang/test/SemaTemplate/instantiate-complete.cpp
+++ b/clang/test/SemaTemplate/instantiate-complete.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -cxx-abi itanium -fsyntax-only -verify %s
+// RUN: %clang_cc1 -cxx-abi microsoft -DMSABI -fsyntax-only -verify %s
 
 // Tests various places where requiring a complete type involves
 // instantiation of that type.
@@ -7,6 +8,9 @@
 struct X {
   X(T);
 
+#ifdef MSABI
+// expected-error@+2{{data member instantiated with function type 'long (long)'}}
+#endif
   T f; // expected-error{{data member instantiated with function type 'float (int)'}} \
        // expected-error{{data member instantiated with function type 'int (int)'}} \
        // expected-error{{data member instantiated with function type 'char (char)'}} \
@@ -40,7 +44,11 @@
 
 void test_memptr(X<long> *p1, long X<long>::*pm1,
                  X<long(long)> *p2, 
+#ifdef MSABI
+                 long (X<long(long)>::*pm2)(long)) { // expected-note{{in instantiation of template class 'X<long (long)>' requested here}}
+#else
                  long (X<long(long)>::*pm2)(long)) {
+#endif
   (void)(p1->*pm1);
 }
 
diff --git a/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp b/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
index 5f43ea2..59a0a60 100644
--- a/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
+++ b/clang/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
@@ -1,8 +1,11 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -ftemplate-depth 16 -fcxx-exceptions -fexceptions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -cxx-abi itanium -std=c++11 -ftemplate-depth 16 -fcxx-exceptions -fexceptions %s
 
 // DR1330: an exception specification for a function template is only
 // instantiated when it is needed.
 
+// Note: the test is Itanium-specific because it depends on key functions in the
+// PR12763 namespace.
+
 template<typename T> void f1(T*) throw(T); // expected-error{{incomplete type 'Incomplete' is not allowed in exception specification}}
 struct Incomplete; // expected-note{{forward}}
 
diff --git a/clang/test/SemaTemplate/virtual-member-functions.cpp b/clang/test/SemaTemplate/virtual-member-functions.cpp
index 439d8f8..005cd58 100644
--- a/clang/test/SemaTemplate/virtual-member-functions.cpp
+++ b/clang/test/SemaTemplate/virtual-member-functions.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -cxx-abi itanium -fsyntax-only -verify %s
+// RUN: %clang_cc1 -cxx-abi microsoft -DMSABI -fsyntax-only -verify %s
 
 namespace PR5557 {
 template <class T> struct A {
@@ -71,8 +72,13 @@
 
   int f() { return B<int>::value; }
 
+#ifdef MSABI
+  void test_typeid(B<float>::Inner bfi) { // expected-note{{implicit destructor}}
+    (void)typeid(bfi);
+#else
   void test_typeid(B<float>::Inner bfi) {
     (void)typeid(bfi); // expected-note{{implicit destructor}}
+#endif
   }
 
   template<typename T>
@@ -80,7 +86,7 @@
     void f() { }
   };
 
-  void test_X(X<int> xi, X<float> xf) {
+  void test_X(X<int> &xi, X<float> &xf) {
     xi.f();
   }
 }