Skip to content

Commit af06854

Browse files
committed
clang-format
1 parent 983aa78 commit af06854

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

clang/include/clang/Basic/Sarif.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,9 @@ class SarifResult {
369369
SarifResult setRelatedLocations(llvm::ArrayRef<CharSourceRange> DiagLocs) {
370370
#ifndef NDEBUG
371371
for (const auto &Loc : DiagLocs) {
372-
assert(Loc.isCharRange() &&
373-
"SARIF RelatedLocations require character granular source ranges!");
372+
assert(
373+
Loc.isCharRange() &&
374+
"SARIF RelatedLocations require character granular source ranges!");
374375
}
375376
#endif
376377
RelatedLocations.assign(DiagLocs.begin(), DiagLocs.end());

clang/include/clang/Frontend/SARIFDiagnostic.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,20 @@ class SARIFDiagnostic : public DiagnosticRenderer {
6363
ArrayRef<CharSourceRange> Ranges,
6464
const Diagnostic &Diag);
6565

66-
SarifResult addRelatedLocationToResult(SarifResult Result,
67-
FullSourceLoc Loc, PresumedLoc PLoc);
68-
69-
llvm::SmallVector<CharSourceRange> getSarifLocation(FullSourceLoc Loc, PresumedLoc PLoc,
70-
ArrayRef<CharSourceRange> Ranges);
66+
SarifResult addRelatedLocationToResult(SarifResult Result, FullSourceLoc Loc,
67+
PresumedLoc PLoc);
68+
69+
llvm::SmallVector<CharSourceRange>
70+
getSarifLocation(FullSourceLoc Loc, PresumedLoc PLoc,
71+
ArrayRef<CharSourceRange> Ranges);
7172

7273
SarifRule addDiagnosticLevelToRule(SarifRule Rule,
7374
DiagnosticsEngine::Level Level);
7475

7576
llvm::StringRef emitFilename(StringRef Filename, const SourceManager &SM);
76-
77-
llvm::SmallVector<std::pair<FullSourceLoc, PresumedLoc>> RelatedLocationsCache;
77+
78+
llvm::SmallVector<std::pair<FullSourceLoc, PresumedLoc>>
79+
RelatedLocationsCache;
7880
};
7981

8082
} // end namespace clang

clang/lib/Frontend/SARIFDiagnostic.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void SARIFDiagnostic::emitDiagnosticMessage(
5858
if (Loc.isValid())
5959
Result = addLocationToResult(Result, Loc, PLoc, Ranges, *Diag);
6060

61-
for (auto& [RelLoc, RelPLoc] : RelatedLocationsCache)
61+
for (auto &[RelLoc, RelPLoc] : RelatedLocationsCache)
6262
Result = addRelatedLocationToResult(Result, RelLoc, RelPLoc);
6363
RelatedLocationsCache.clear();
6464

@@ -78,7 +78,7 @@ void SARIFDiagnostic::emitIncludeLocation(FullSourceLoc Loc, PresumedLoc PLoc) {
7878
RelatedLocationsCache.push_back({Loc, PLoc});
7979
}
8080

81-
void SARIFDiagnostic::emitImportLocation(FullSourceLoc Loc, PresumedLoc PLoc,
81+
void SARIFDiagnostic::emitImportLocation(FullSourceLoc Loc, PresumedLoc PLoc,
8282
StringRef ModuleName) {
8383
RelatedLocationsCache.push_back({Loc, PLoc});
8484
}
@@ -90,14 +90,16 @@ SarifResult SARIFDiagnostic::addLocationToResult(
9090
return Result.setLocations(Locations);
9191
}
9292

93-
SarifResult SARIFDiagnostic::addRelatedLocationToResult(
94-
SarifResult Result, FullSourceLoc Loc, PresumedLoc PLoc) {
93+
SarifResult SARIFDiagnostic::addRelatedLocationToResult(SarifResult Result,
94+
FullSourceLoc Loc,
95+
PresumedLoc PLoc) {
9596
auto Locations = getSarifLocation(Loc, PLoc, {});
9697
return Result.setRelatedLocations(Locations);
9798
}
9899

99-
llvm::SmallVector<CharSourceRange> SARIFDiagnostic::getSarifLocation(
100-
FullSourceLoc Loc, PresumedLoc PLoc, ArrayRef<CharSourceRange> Ranges) {
100+
llvm::SmallVector<CharSourceRange>
101+
SARIFDiagnostic::getSarifLocation(FullSourceLoc Loc, PresumedLoc PLoc,
102+
ArrayRef<CharSourceRange> Ranges) {
101103
SmallVector<CharSourceRange> Locations = {};
102104

103105
if (PLoc.isInvalid()) {
@@ -161,7 +163,7 @@ llvm::SmallVector<CharSourceRange> SARIFDiagnostic::getSarifLocation(
161163
SourceLocation DiagLoc = SM.translateLineCol(FID, PLoc.getLine(), ColNo);
162164

163165
// FIXME(llvm-project/issues/57366): Properly process #line directives.
164-
CharSourceRange Range = {SourceRange{DiagLoc, DiagLoc}, /* ITR = */false};
166+
CharSourceRange Range = {SourceRange{DiagLoc, DiagLoc}, /* ITR = */ false};
165167
if (Range.isValid())
166168
Locations.push_back(std::move(Range));
167169

0 commit comments

Comments
 (0)