Beautifier: added support for fallback-style option for clang-format

Task-number: QTCREATORBUG-17813
Change-Id: I36adee4889d1b851171d34852eed29639c68b574
Reviewed-by: Lorenz Haas <lorenz.haas@histomatics.de>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Przemyslaw Gorszkowski
2017-03-01 20:40:27 +01:00
parent 666648e997
commit 163b2c027d
6 changed files with 142 additions and 89 deletions

View File

@@ -137,7 +137,14 @@ Command ClangFormat::command() const
command.setProcessing(Command::PipeProcessing);
if (m_settings->usePredefinedStyle()) {
command.addOption("-style=" + m_settings->predefinedStyle());
const QString predefinedStyle = m_settings->predefinedStyle();
command.addOption("-style=" + predefinedStyle);
if (predefinedStyle == "File") {
const QString fallbackStyle = m_settings->fallbackStyle();
if (fallbackStyle != "Default")
command.addOption("-fallback-style=" + fallbackStyle);
}
command.addOption("-assume-filename=%file");
} else {
command.addOption("-style=file");