diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1489,6 +1489,7 @@ break; case FormatStyle::LK_Verilog: LLVMStyle.IndentCaseLabels = true; + LLVMStyle.SpacesInContainerLiterals = false; break; default: break; 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 @@ -1722,8 +1722,9 @@ case tok::kw_while: return false; case tok::identifier: - return VerilogExtraKeywords.find(Tok.Tok.getIdentifierInfo()) == - VerilogExtraKeywords.end(); + return isWordLike(Tok) && + VerilogExtraKeywords.find(Tok.Tok.getIdentifierInfo()) == + VerilogExtraKeywords.end(); default: // getIdentifierInfo returns non-null for both identifiers and keywords. return Tok.Tok.getIdentifierInfo(); diff --git a/clang/unittests/Format/FormatTestVerilog.cpp b/clang/unittests/Format/FormatTestVerilog.cpp --- a/clang/unittests/Format/FormatTestVerilog.cpp +++ b/clang/unittests/Format/FormatTestVerilog.cpp @@ -916,6 +916,25 @@ verifyFormat("{<