Make clang-format place func names at line start

This commit is contained in:
Nigel Tao committed 2018-07-14 10:33:06 +10:00
1 parent 8a6e177701
commit d73353024c
3 files changed
+212 -197

No files matched your search

+4 -1
View File
@@ -738,7 +738,10 @@ func (g *gen) writeCppImpls(b *buffer) error {
structID := n.QID()[1]
structName := structID.Str(g.tm)
b.printf("inline void %s%s::check_wuffs_version(size_t sizeof_star_self, uint64_t wuffs_version) {\n",
// The empty // comment makes clang-format place the function name
// at the start of a line.
b.writes("inline void //\n")
b.printf("%s%s::check_wuffs_version(size_t sizeof_star_self, uint64_t wuffs_version) {\n",
g.pkgPrefix, structName)
b.printf("%s%s__check_wuffs_version(this, sizeof_star_self, wuffs_version);\n",
g.pkgPrefix, structName)
+6
View File
@@ -99,6 +99,12 @@ func (g *gen) writeFuncSignature(b *buffer, n *a.Func, cpp uint32) error {
return fmt.Errorf("TODO: multiple return values")
}
if cpp != cppInsideStruct {
// The empty // comment makes clang-format place the function name at
// the start of a line.
b.writes("//\n")
}
switch cpp {
case cppNone:
b.writes(g.funcCName(n))