Index: include/clang/Format/Format.h =================================================================== --- include/clang/Format/Format.h +++ include/clang/Format/Format.h @@ -2083,6 +2083,10 @@ /// http://www.gnu.org/prep/standards/standards.html FormatStyle getGNUStyle(); +/// Returns a format style complying with NetBSD Coding Standards: +/// http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style?rev=HEAD&content-type=text/x-cvsweb-markup +FormatStyle getNetBSDStyle(); + /// Returns style indicating formatting should be not applied at all. FormatStyle getNoStyle(); Index: lib/Format/Format.cpp =================================================================== --- lib/Format/Format.cpp +++ lib/Format/Format.cpp @@ -1023,6 +1023,23 @@ return Style; } +FormatStyle getNetBSDStyle() { + FormatStyle NetBSDStyle = getLLVMStyle(); + NetBSDStyle.AlignTrailingComments = true; + NetBSDStyle.AlwaysBreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; + NetBSDStyle.AlignConsecutiveMacros = true; + NetBSDStyle.BreakBeforeBraces = FormatStyle::BS_Mozilla; + NetBSDStyle.ColumnLimit = 80; + NetBSDStyle.ContinuationIndentWidth = 4; + NetBSDStyle.Cpp11BracedListStyle = false; + NetBSDStyle.FixNamespaceComments = true; + NetBSDStyle.IndentCaseLabels = false; + NetBSDStyle.IndentWidth = 8; + NetBSDStyle.TabWidth = 8; + NetBSDStyle.UseTab = FormatStyle::UT_Always; + return NetBSDStyle; +} + FormatStyle getNoStyle() { FormatStyle NoStyle = getLLVMStyle(); NoStyle.DisableFormat = true; @@ -1047,6 +1064,8 @@ *Style = getGNUStyle(); } else if (Name.equals_lower("microsoft")) { *Style = getMicrosoftStyle(Language); + } else if (Name.equals_lower("netbsd")) { + *Style = getNetBSDStyle(); } else if (Name.equals_lower("none")) { *Style = getNoStyle(); } else {