From: Hans Wennborg <hans@hanshq.net>
Date: Thu, 8 Aug 2013 19:54:30 +0000 (+0000)
Subject: clang-cl: use MS C++ ABI
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f0f9891b683646f734acb74d938460b354ded3bb;p=clang

clang-cl: use MS C++ ABI

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188000 91177308-0d34-0410-b5e6-96231b3b80d8
---

diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 83e6aedf45..7724a1e681 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -3723,6 +3723,10 @@ void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs) const {
   // users want.  The /Za flag to cl.exe turns this off, but it's not
   // implemented in clang.
   CmdArgs.push_back("--dependent-lib=oldnames");
+
+  // FIXME: Make this default for the win32 triple.
+  CmdArgs.push_back("-cxx-abi");
+  CmdArgs.push_back("microsoft");
 }
 
 void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
diff --git a/test/Driver/cl.c b/test/Driver/cl.c
index c811dbe3e7..3605197811 100644
--- a/test/Driver/cl.c
+++ b/test/Driver/cl.c
@@ -5,6 +5,9 @@
 // expand the ? into a one-letter filename in the root directory, and make
 // the test fail is such a file or directory exists.
 
+// Note: %s must be preceded by --, otherwise it may be interpreted as a
+// command-line option, e.g. on Mac where %s is commonly under /Users.
+
 // Check that clang-cl options are not available by default.
 // RUN: %clang -help | FileCheck %s -check-prefix=DEFAULT
 // DEFAULT-NOT: CL.EXE COMPATIBILITY OPTIONS
@@ -26,3 +29,6 @@
 // are not available in clang-cl.
 // DEFAULT: -fapple-kext
 // CL-NOT: -fapple-kext
+
+// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=ABI %s
+// ABI: "-cxx-abi" "microsoft"