Index: include/clang/CodeGen/CodeGenOptions.h
===================================================================
--- include/clang/CodeGen/CodeGenOptions.h	(revision 105767)
+++ include/clang/CodeGen/CodeGenOptions.h	(working copy)
@@ -78,6 +78,9 @@
   /// The ABI to use for passing floating point arguments.
   std::string FloatABI;
 
+  /// The C++ ABI for which to generate code.
+  std::string CXXABI;
+
   /// The float precision limit to use, if non-empty.
   std::string LimitFloatPrecision;
 
@@ -120,6 +123,7 @@
     VerifyModule = 1;
 
     Inlining = NoInlining;
+    CXXABI = "itanium";
     RelocationModel = "pic";
   }
 
Index: include/clang/Driver/CC1Options.td
===================================================================
--- include/clang/Driver/CC1Options.td	(revision 105767)
+++ include/clang/Driver/CC1Options.td	(working copy)
@@ -383,6 +383,8 @@
   HelpText<"Language standard to compile for">;
 def fmath_errno : Flag<"-fmath-errno">,
   HelpText<"Require math functions to indicate errors by setting errno">;
+def fms_cxx_abi : Flag<"-fms-c++-abi">,
+  HelpText<"Generate code for the Microsoft Visual C++ ABI">;
 def fms_extensions : Flag<"-fms-extensions">,
   HelpText<"Accept some non-standard constructs used in Microsoft header files ">;
 def main_file_name : Separate<"-main-file-name">,
Index: lib/Frontend/CompilerInvocation.cpp
===================================================================
--- lib/Frontend/CompilerInvocation.cpp	(revision 105767)
+++ lib/Frontend/CompilerInvocation.cpp	(working copy)
@@ -803,6 +803,8 @@
   Opts.DisableLLVMOpts = Args.hasArg(OPT_disable_llvm_optzns);
   Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
   Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags);
+  if (Args.hasArg(OPT_fms_cxx_abi))
+    Opts.CXXABI = "microsoft";
   Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants);
   Opts.NoCommon = Args.hasArg(OPT_fno_common);
   Opts.NoImplicitFloat = Args.hasArg(OPT_no_implicit_float);
Index: lib/CodeGen/MicrosoftCXXABI.cpp
===================================================================
--- lib/CodeGen/MicrosoftCXXABI.cpp	(revision 105767)
+++ lib/CodeGen/MicrosoftCXXABI.cpp	(working copy)
@@ -124,7 +124,7 @@
   assert(false && "Can't yet mangle destructors!");
 }
 
-CXXABI *CreateMicrosoftCXXABI(CodeGenModule &CGM) {
+CXXABI *clang::CodeGen::CreateMicrosoftCXXABI(CodeGenModule &CGM) {
   return new MicrosoftCXXABI(CGM);
 }
 
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp	(revision 105767)
+++ lib/CodeGen/CodeGenModule.cpp	(working copy)
@@ -86,8 +86,10 @@
 }
 
 void CodeGenModule::createCXXABI() {
-  // For now, just create an Itanium ABI.
-  ABI = CreateItaniumCXXABI(*this);
+  if (CodeGenOpts.CXXABI == "microsoft")
+    ABI = CreateMicrosoftCXXABI(*this);
+  else
+    ABI = CreateItaniumCXXABI(*this);
 }
 
 void CodeGenModule::Release() {
