[MS] Mangle return adjusting thunks with the public access specifier

MSVC does this, so we should too.

Fixes PR40138

llvm-svn: 350071
diff --git a/clang/test/CodeGenCXX/mangle-ms-thunks-covariant.cpp b/clang/test/CodeGenCXX/mangle-ms-thunks-covariant.cpp
new file mode 100644
index 0000000..47b1a38
--- /dev/null
+++ b/clang/test/CodeGenCXX/mangle-ms-thunks-covariant.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fno-rtti-data -std=c++11 -fms-extensions -emit-llvm %s -o - -triple=x86_64-pc-win32 -fms-compatibility-version=19.00 | FileCheck %s --check-prefix=CHECK
+
+namespace t1 {
+struct A {
+public:
+  virtual ~A();
+  virtual A *f();
+};
+struct B {
+public:
+  virtual ~B();
+
+private:
+  virtual B *f();
+};
+struct C : A, B {
+  virtual ~C();
+
+protected:
+  virtual C *f();
+};
+C c;
+}
+// Main external C::f impl:
+// CHECK-DAG: "?f@C@t1@@MEAAPEAU12@XZ"
+// New slot in C's vftable for B, returns C* directly:
+// CHECK-DAG: "?f@C@t1@@O7EAAPEAU12@XZ"
+// Return-adjusting thunk in C's vftable for B:
+// CHECK-DAG: "?f@C@t1@@W7EAAPEAUB@2@XZ"