summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp')
-rw-r--r--clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
index 0881e677d14..3ca26801afb 100644
--- a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
+++ b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
@@ -208,8 +208,15 @@ int main(int argc, char **argv) {
// Determine a formatting style from options.
format::FormatStyle FormatStyle;
- if (DoFormat)
- FormatStyle = format::getStyle(FormatStyleOpt, FormatStyleConfig, "LLVM");
+ if (DoFormat) {
+ auto FormatStyleOrError =
+ format::getStyle(FormatStyleOpt, FormatStyleConfig, "LLVM");
+ if (!FormatStyleOrError) {
+ llvm::errs() << llvm::toString(FormatStyleOrError.takeError()) << "\n";
+ return 1;
+ }
+ FormatStyle = *FormatStyleOrError;
+ }
TUReplacements TURs;
TUReplacementFiles TUFiles;
OpenPOWER on IntegriCloud