diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h --- a/clang/lib/Format/FormatToken.h +++ b/clang/lib/Format/FormatToken.h @@ -928,6 +928,7 @@ kw___has_include_next = &IdentTable.get("__has_include_next"); kw_mark = &IdentTable.get("mark"); + kw_region = &IdentTable.get("region"); kw_extend = &IdentTable.get("extend"); kw_option = &IdentTable.get("option"); @@ -1046,6 +1047,7 @@ // Pragma keywords. IdentifierInfo *kw_mark; + IdentifierInfo *kw_region; // Proto keywords. IdentifierInfo *kw_extend; diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1223,7 +1223,7 @@ void parsePragma() { next(); // Consume "pragma". if (CurrentToken && - CurrentToken->isOneOf(Keywords.kw_mark, Keywords.kw_option)) { + CurrentToken->isOneOf(Keywords.kw_mark, Keywords.kw_option, Keywords.kw_region)) { bool IsMark = CurrentToken->is(Keywords.kw_mark); next(); // Consume "mark". next(); // Consume first token (so we fix leading whitespace). diff --git a/clang/test/Format/pragma-region.cpp b/clang/test/Format/pragma-region.cpp new file mode 100644 --- /dev/null +++ b/clang/test/Format/pragma-region.cpp @@ -0,0 +1,5 @@ +// RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -style="{ColumnLimit: 0}" \ +// RUN: | FileCheck -strict-whitespace %s + +// CHECK: {{^\#pragma\ region\ TEST\(FOO\ \:\ BAR\)}} +#pragma region TEST(FOO : BAR)