[PATCH] D139999: [clang-format][NFC] Don't run any passes if Environment::make fails
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 14 00:30:39 PST 2022
owenpan created this revision.
owenpan added reviewers: MyDeveloperDay, HazardyKnusperkeks, rymiel.
owenpan added a project: clang-format.
Herald added a project: All.
owenpan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D139999
Files:
clang/lib/Format/Format.cpp
Index: clang/lib/Format/Format.cpp
===================================================================
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -3382,6 +3382,11 @@
return {tooling::Replacements(), 0};
}
+ auto Env = Environment::make(Code, FileName, Ranges, FirstStartColumn,
+ NextStartColumn, LastStartColumn);
+ if (!Env)
+ return {};
+
typedef std::function<std::pair<tooling::Replacements, unsigned>(
const Environment &)>
AnalyzerPass;
@@ -3452,10 +3457,6 @@
});
}
- auto Env = Environment::make(Code, FileName, Ranges, FirstStartColumn,
- NextStartColumn, LastStartColumn);
- if (!Env)
- return {};
std::optional<std::string> CurrentCode;
tooling::Replacements Fixes;
unsigned Penalty = 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139999.482731.patch
Type: text/x-patch
Size: 839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221214/d161384e/attachment-0001.bin>
More information about the cfe-commits
mailing list