LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 17888 - option to ensure function body is never on one line
Summary: option to ensure function body is never on one line
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Formatter (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Alexander Kornienko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-11 19:17 PST by Val Markovic
Modified: 2013-11-20 10:45 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Val Markovic 2013-11-11 19:17:02 PST
Given the following content:

TranslationUnitStore::~TranslationUnitStore() {
  RemoveAll();
}

std::string TextToInsertInBuffer() {
  return original_string_;
}

std::string MainCompletionText() {
  return everything_except_return_type_;
}

std::string ExtraMenuInfo() {
  return return_type_;
}

std::string DetailedInfoForPreviewWindow() {
  return detailed_info_;
}


clang-format will produce this:

TranslationUnitStore::~TranslationUnitStore() { RemoveAll(); }

std::string TextToInsertInBuffer() { return original_string_; }

std::string MainCompletionText() { return everything_except_return_type_; }

std::string ExtraMenuInfo() { return return_type_; }

std::string DetailedInfoForPreviewWindow() { return detailed_info_; }


I see no set of options I can set to prevent clang-format from doing that. In fact, I'd love it if there was an option that would expand such inlined function bodies.
Comment 1 Alexander Kornienko 2013-11-20 10:34:21 PST
AllowShortFunctionsOnASingleLine was added in r195256.
Comment 2 Val Markovic 2013-11-20 10:45:55 PST
Thank you for the quick fix!