Skip to content

Commit 11c1f0f

Browse files
committed
Format
1 parent cd3c82d commit 11c1f0f

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

include/swift/AST/DiagnosticConsumer.h

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,11 @@ class FileSpecificDiagnosticConsumer : public DiagnosticConsumer {
210210
/// Index into Subconsumers vector for this subconsumer.
211211
/// Should be const but then the sort won't compile.
212212
/*const*/ unsigned subconsumerIndex;
213-
213+
214214
public:
215215
unsigned getSubconsumerIndex() const { return subconsumerIndex; }
216-
217-
ConsumerAndRange(const CharSourceRange range,
218-
unsigned subconsumerIndex)
216+
217+
ConsumerAndRange(const CharSourceRange range, unsigned subconsumerIndex)
219218
: range(range), subconsumerIndex(subconsumerIndex) {}
220219

221220
/// Compare according to range:
@@ -236,12 +235,12 @@ class FileSpecificDiagnosticConsumer : public DiagnosticConsumer {
236235
return compare(getRawLoc(range.getEnd()).getPointer(),
237236
getRawLoc(loc).getPointer());
238237
}
239-
238+
240239
bool contains(const SourceLoc loc) const { return range.contains(loc); }
241240
};
242241

243242
private:
244-
Subconsumer &operator[](const ConsumerAndRange& consumerAndRange) {
243+
Subconsumer &operator[](const ConsumerAndRange &consumerAndRange) {
245244
return Subconsumers[consumerAndRange.getSubconsumerIndex()];
246245
}
247246
/// The consumers owned by this FileSpecificDiagnosticConsumer, sorted by
@@ -262,8 +261,7 @@ class FileSpecificDiagnosticConsumer : public DiagnosticConsumer {
262261
///
263262
/// If None, Note diagnostics are sent to every consumer.
264263
/// If null, diagnostics are suppressed.
265-
Optional<ConsumerAndRange *>
266-
ConsumerSpecificInfoForSubsequentNotes = None;
264+
Optional<ConsumerAndRange *> ConsumerSpecificInfoForSubsequentNotes = None;
267265

268266
bool HasAnErrorBeenConsumed = false;
269267

@@ -295,9 +293,8 @@ class FileSpecificDiagnosticConsumer : public DiagnosticConsumer {
295293
/// Returns nullptr if diagnostic is to be suppressed,
296294
/// None if diagnostic is to be distributed to every consumer,
297295
/// a particular consumer if diagnostic goes there.
298-
Optional<ConsumerAndRange *>
299-
consumerAndRangeForLocation(SourceManager &SM,
300-
SourceLoc loc) const;
296+
Optional<ConsumerAndRange *> consumerAndRangeForLocation(SourceManager &SM,
297+
SourceLoc loc) const;
301298
};
302299

303300
} // end namespace swift

lib/AST/DiagnosticConsumer.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,15 @@ FileSpecificDiagnosticConsumer::consumerAndRangeForLocation(
146146
// that /might/ contain 'loc'. Specifically, since the ranges are sorted
147147
// by end location, it's looking for the first range where the end location
148148
// is greater than or equal to 'loc'.
149-
const ConsumerAndRange *possiblyContainingRangeIter =
150-
std::lower_bound(
151-
ConsumersOrderedByRange.begin(), ConsumersOrderedByRange.end(), loc,
152-
[](const ConsumerAndRange &entry, SourceLoc loc) -> bool {
153-
return entry.endsAfter(loc);
154-
});
149+
const ConsumerAndRange *possiblyContainingRangeIter = std::lower_bound(
150+
ConsumersOrderedByRange.begin(), ConsumersOrderedByRange.end(), loc,
151+
[](const ConsumerAndRange &entry, SourceLoc loc) -> bool {
152+
return entry.endsAfter(loc);
153+
});
155154

156155
if (possiblyContainingRangeIter != ConsumersOrderedByRange.end() &&
157156
possiblyContainingRangeIter->contains(loc)) {
158-
return const_cast<ConsumerAndRange *>(
159-
possiblyContainingRangeIter);
157+
return const_cast<ConsumerAndRange *>(possiblyContainingRangeIter);
160158
}
161159

162160
return None;
@@ -182,7 +180,8 @@ void FileSpecificDiagnosticConsumer::handleDiagnostic(
182180
break;
183181
}
184182
if (consumerAndRange.hasValue()) {
185-
(*this)[*consumerAndRange.getValue()].handleDiagnostic(SM,Loc, Kind, FormatString, FormatArgs, Info);
183+
(*this)[*consumerAndRange.getValue()].handleDiagnostic(
184+
SM, Loc, Kind, FormatString, FormatArgs, Info);
186185
return;
187186
}
188187
for (auto &subconsumer : Subconsumers)

lib/FrontendTool/FrontendTool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,7 @@ static std::unique_ptr<DiagnosticConsumer>
15861586
createDispatchingDiagnosticConsumerIfNeeded(
15871587
const FrontendInputsAndOutputs &inputsAndOutputs,
15881588
llvm::function_ref<std::unique_ptr<DiagnosticConsumer>(const InputFile &)>
1589-
maybeCreateConsumerForDiagnosticsFrom) {
1589+
maybeCreateConsumerForDiagnosticsFrom) {
15901590

15911591
// The "4" here is somewhat arbitrary. In practice we're going to have one
15921592
// sub-consumer for each diagnostic file we're trying to output, which (again

0 commit comments

Comments
 (0)