r323577 - Always allow "#pragma region".
Matt Davis via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 26 16:25:29 PST 2018
Author: mattd
Date: Fri Jan 26 16:25:29 2018
New Revision: 323577
URL: http://llvm.org/viewvc/llvm-project?rev=323577&view=rev
Log:
Always allow "#pragma region".
Summary:
Both MS and PS4 targets are capable of recognizing the
existence of: #pragma region, #pragma endregion.
Since this pragma is only a hint for certain editors, and has no logic,
it seems helpful to permit this pragma in all cases, not just MS compatibility mode.
Reviewers: rnk, rsmith, majnemer
Reviewed By: majnemer
Subscribers: Quuxplusone, probinson, majnemer, cfe-commits
Differential Revision: https://reviews.llvm.org/D42248
Added:
cfe/trunk/test/Frontend/region-pragmas.c
Modified:
cfe/trunk/lib/Lex/Pragma.cpp
Modified: cfe/trunk/lib/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Pragma.cpp?rev=323577&r1=323576&r2=323577&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Pragma.cpp (original)
+++ cfe/trunk/lib/Lex/Pragma.cpp Fri Jan 26 16:25:29 2018
@@ -1776,13 +1776,15 @@ void Preprocessor::RegisterBuiltinPragma
ModuleHandler->AddPragma(new PragmaModuleEndHandler());
ModuleHandler->AddPragma(new PragmaModuleBuildHandler());
ModuleHandler->AddPragma(new PragmaModuleLoadHandler());
+
+ // Add region pragmas.
+ AddPragmaHandler(new PragmaRegionHandler("region"));
+ AddPragmaHandler(new PragmaRegionHandler("endregion"));
// MS extensions.
if (LangOpts.MicrosoftExt) {
AddPragmaHandler(new PragmaWarningHandler());
AddPragmaHandler(new PragmaIncludeAliasHandler());
- AddPragmaHandler(new PragmaRegionHandler("region"));
- AddPragmaHandler(new PragmaRegionHandler("endregion"));
}
// Pragmas added by plugins
Added: cfe/trunk/test/Frontend/region-pragmas.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/region-pragmas.c?rev=323577&view=auto
==============================================================================
--- cfe/trunk/test/Frontend/region-pragmas.c (added)
+++ cfe/trunk/test/Frontend/region-pragmas.c Fri Jan 26 16:25:29 2018
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -Wall -verify %s
+// expected-no-diagnostics
+
+#pragma region foo
+#pragma endregion foo
More information about the cfe-commits
mailing list