Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -571,8 +571,6 @@ Builder.defineMacro("_MSC_VER", Twine(Opts.MSCVersion)); if (Opts.MicrosoftExt) { - Builder.defineMacro("_MSC_EXTENSIONS"); - if (Opts.CPlusPlus11) { Builder.defineMacro("_RVALUE_REFERENCES_V2_SUPPORTED"); Builder.defineMacro("_RVALUE_REFERENCES_SUPPORTED"); Index: lib/Frontend/InitPreprocessor.cpp =================================================================== --- lib/Frontend/InitPreprocessor.cpp +++ lib/Frontend/InitPreprocessor.cpp @@ -508,6 +508,8 @@ } if (LangOpts.MicrosoftExt) { + Builder.defineMacro("_MSC_EXTENSIONS"); + // Both __PRETTY_FUNCTION__ and __FUNCTION__ are GCC extensions, however // VC++ appears to only like __FUNCTION__. Builder.defineMacro("__PRETTY_FUNCTION__", "__FUNCTION__"); Index: test/Preprocessor/predefined-macros.c =================================================================== --- test/Preprocessor/predefined-macros.c +++ test/Preprocessor/predefined-macros.c @@ -10,6 +10,9 @@ // CHECK-MS: #define _WIN32 1 // CHECK-MS-NOT: #define __GNUC__ // +// RUN: %clang_cc1 %s -E -dM -fms-extensions -o - | FileCheck %s --check-prefix=CHECK-MS-EXT +// CHECK-MS-EXT: #define _MSC_EXTENSIONS 1 +// // RUN: %clang_cc1 %s -E -dM -ffast-math -o - \ // RUN: | FileCheck %s --check-prefix=CHECK-FAST-MATH // CHECK-FAST-MATH: #define __FAST_MATH__