aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Format/Format.h
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-01-10 23:11:41 +0000
committerNico Weber <nicolasweber@gmx.de>2013-01-10 23:11:41 +0000
commitcd52bdaaf076b0082c07c6b3d88937fb737054f1 (patch)
treefca5b9845970173d5ca3678e4ff7517407ff14b3 /include/clang/Format/Format.h
parent664566c37f81d70226df22c12aa05d1603b620f3 (diff)
Formatter: Put spaces in ObjC method decls in the right place for Google style.
Objective-C method declarations look like this: - (returntype)name:(type)argname anothername:(type)arg2name; In google style, there's no space after the leading '-' but one after "(returntype)" instead (but none after the argument types), see http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Method_Declarations_and_Definitions Not inserting the space after '-' is easy, but to insert the space after the return type, the formatter needs to know that a closing parenthesis ends the return type. To do this, I tweaked the code in parse() to check for this, which in turn required moving detection of TT_ObjCMethodSpecifier from annotate() to parse(), because parse() runs before annotate(). (To keep things interesting, the return type is optional, but it's almost always there in practice.) http://llvm-reviews.chandlerc.com/D280 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172140 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Format/Format.h')
-rw-r--r--include/clang/Format/Format.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/clang/Format/Format.h b/include/clang/Format/Format.h
index 0c13dbeaca..0bafd6c773 100644
--- a/include/clang/Format/Format.h
+++ b/include/clang/Format/Format.h
@@ -59,6 +59,10 @@ struct FormatStyle {
/// \brief Add a space in front of an Objective-C protocol list, i.e. use
/// Foo <Protocol> instead of Foo<Protocol>.
bool ObjCSpaceBeforeProtocolList;
+
+ /// \brief Add a space in front method return types, i.e. use
+ /// + (id)init instead of +(id) init
+ bool ObjCSpaceBeforeReturnType;
};
/// \brief Returns a format style complying with the LLVM coding standards: