Index: include/clang/Basic/LangOptions.def =================================================================== --- include/clang/Basic/LangOptions.def +++ include/clang/Basic/LangOptions.def @@ -85,6 +85,7 @@ LANGOPT(C17 , 1, 0, "C17") LANGOPT(MSVCCompat , 1, 0, "Microsoft Visual C++ full compatibility mode") LANGOPT(MicrosoftExt , 1, 0, "Microsoft C++ extensions") +BENIGN_LANGOPT(MicrosoftPragmaRegion, 1, 0, "region pragma support") LANGOPT(AsmBlocks , 1, 0, "Microsoft inline asm blocks") LANGOPT(Borland , 1, 0, "Borland extensions") LANGOPT(CPlusPlus , 1, 0, "C++") Index: lib/Frontend/CompilerInvocation.cpp =================================================================== --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -2160,6 +2160,7 @@ Opts.MSVCCompat = Args.hasArg(OPT_fms_compatibility); Opts.MicrosoftExt = Opts.MSVCCompat || Args.hasArg(OPT_fms_extensions); + Opts.MicrosoftPragmaRegion = Opts.MicrosoftExt || T.isPS4(); Opts.AsmBlocks = Args.hasArg(OPT_fasm_blocks) || Opts.MicrosoftExt; Opts.MSCompatibilityVersion = 0; if (const Arg *A = Args.getLastArg(OPT_fms_compatibility_version)) { Index: lib/Lex/Pragma.cpp =================================================================== --- lib/Lex/Pragma.cpp +++ lib/Lex/Pragma.cpp @@ -1781,6 +1781,10 @@ if (LangOpts.MicrosoftExt) { AddPragmaHandler(new PragmaWarningHandler()); AddPragmaHandler(new PragmaIncludeAliasHandler()); + } + + // Region support. + if (LangOpts.MicrosoftPragmaRegion) { AddPragmaHandler(new PragmaRegionHandler("region")); AddPragmaHandler(new PragmaRegionHandler("endregion")); } Index: test/Frontend/region-pragmas.c =================================================================== --- test/Frontend/region-pragmas.c +++ test/Frontend/region-pragmas.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -triple x86_64-scei-ps4 -Wall -verify %s +// RUN: %clang_cc1 -fms-compatibility -Wall -verify %s +// RUN: %clang_cc1 -Wall -Wno-unknown-pragmas -verify %s +// expected-no-diagnostics + +#pragma region foo +#pragma endregion foo