зеркало из https://github.com/microsoft/clang-1.git
Fix clang-format segfault.
When annotating "lines" starting with ":", clang-format would segfault. This could actually happen in valid code, e.g. #define A : git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177283 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
74c8b794be
Коммит
cf6d76af80
|
@ -319,6 +319,8 @@ private:
|
|||
Tok->Type = TT_ObjCMethodSpecifier;
|
||||
break;
|
||||
case tok::colon:
|
||||
if (Tok->Parent == NULL)
|
||||
return false;
|
||||
// Colons from ?: are handled in parseConditional().
|
||||
if (Tok->Parent->is(tok::r_paren) && Contexts.size() == 1) {
|
||||
Tok->Type = TT_CtorInitializerColon;
|
||||
|
|
|
@ -1068,6 +1068,8 @@ TEST_F(FormatTest, EmptyLinesInMacroDefinitions) {
|
|||
}
|
||||
|
||||
TEST_F(FormatTest, MacroDefinitionsWithIncompleteCode) {
|
||||
verifyFormat("#define A :");
|
||||
|
||||
// FIXME: Improve formatting of case labels in macros.
|
||||
verifyFormat("#define SOMECASES \\\n"
|
||||
"case 1: \\\n"
|
||||
|
|
Загрузка…
Ссылка в новой задаче