Skip to content

[NFC] Run code formatter on Diagnostic.h/cpp ProfileList.cpp SpecialCaseList.cpp #140316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 29 additions & 37 deletions clang/include/clang/Basic/Diagnostic.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,31 +92,29 @@ class FixItHint {
/// modification is known.
FixItHint() = default;

bool isNull() const {
return !RemoveRange.isValid();
}
bool isNull() const { return !RemoveRange.isValid(); }

/// Create a code modification hint that inserts the given
/// code string at a specific location.
static FixItHint CreateInsertion(SourceLocation InsertionLoc,
StringRef Code,
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code,
bool BeforePreviousInsertions = false) {
FixItHint Hint;
Hint.RemoveRange =
CharSourceRange::getCharRange(InsertionLoc, InsertionLoc);
CharSourceRange::getCharRange(InsertionLoc, InsertionLoc);
Hint.CodeToInsert = std::string(Code);
Hint.BeforePreviousInsertions = BeforePreviousInsertions;
return Hint;
}

/// Create a code modification hint that inserts the given
/// code from \p FromRange at a specific location.
static FixItHint CreateInsertionFromRange(SourceLocation InsertionLoc,
CharSourceRange FromRange,
bool BeforePreviousInsertions = false) {
static FixItHint
CreateInsertionFromRange(SourceLocation InsertionLoc,
CharSourceRange FromRange,
bool BeforePreviousInsertions = false) {
FixItHint Hint;
Hint.RemoveRange =
CharSourceRange::getCharRange(InsertionLoc, InsertionLoc);
CharSourceRange::getCharRange(InsertionLoc, InsertionLoc);
Hint.InsertFromRange = FromRange;
Hint.BeforePreviousInsertions = BeforePreviousInsertions;
return Hint;
Expand All @@ -143,8 +141,7 @@ class FixItHint {
return Hint;
}

static FixItHint CreateReplacement(SourceRange RemoveRange,
StringRef Code) {
static FixItHint CreateReplacement(SourceRange RemoveRange, StringRef Code) {
return CreateReplacement(CharSourceRange::getTokenRange(RemoveRange), Code);
}
};
Expand Down Expand Up @@ -553,13 +550,11 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
/// avoid redundancy across arguments.
///
/// This is a hack to avoid a layering violation between libbasic and libsema.
using ArgToStringFnTy = void (*)(
ArgumentKind Kind, intptr_t Val,
StringRef Modifier, StringRef Argument,
ArrayRef<ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output,
void *Cookie,
ArrayRef<intptr_t> QualTypeVals);
using ArgToStringFnTy = void (*)(ArgumentKind Kind, intptr_t Val,
StringRef Modifier, StringRef Argument,
ArrayRef<ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output, void *Cookie,
ArrayRef<intptr_t> QualTypeVals);

void *ArgToStringCookie = nullptr;
ArgToStringFnTy ArgToStringFn;
Expand Down Expand Up @@ -656,9 +651,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {

/// Retrieve the maximum number of template instantiation
/// notes to emit along with a given diagnostic.
unsigned getTemplateBacktraceLimit() const {
return TemplateBacktraceLimit;
}
unsigned getTemplateBacktraceLimit() const { return TemplateBacktraceLimit; }

/// Specify the maximum number of constexpr evaluation
/// notes to emit along with a given diagnostic.
Expand Down Expand Up @@ -744,9 +737,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
/// fails.
///
/// By default, we show all candidates.
void setShowOverloads(OverloadsShown Val) {
ShowOverloads = Val;
}
void setShowOverloads(OverloadsShown Val) { ShowOverloads = Val; }
OverloadsShown getShowOverloads() const { return ShowOverloads; }

/// When a call or operator fails, print out up to this many candidate
Expand Down Expand Up @@ -885,9 +876,7 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
unsigned getNumErrors() const { return NumErrors; }
unsigned getNumWarnings() const { return NumWarnings; }

void setNumWarnings(unsigned NumWarnings) {
this->NumWarnings = NumWarnings;
}
void setNumWarnings(unsigned NumWarnings) { this->NumWarnings = NumWarnings; }

/// Return an ID for a diagnostic with the specified format string and
/// level.
Expand All @@ -907,9 +896,8 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {

/// Converts a diagnostic argument (as an intptr_t) into the string
/// that represents it.
void ConvertArgToString(ArgumentKind Kind, intptr_t Val,
StringRef Modifier, StringRef Argument,
ArrayRef<ArgumentValue> PrevArgs,
void ConvertArgToString(ArgumentKind Kind, intptr_t Val, StringRef Modifier,
StringRef Argument, ArrayRef<ArgumentValue> PrevArgs,
SmallVectorImpl<char> &Output,
ArrayRef<intptr_t> QualTypeVals) const {
ArgToStringFn(Kind, Val, Modifier, Argument, PrevArgs, Output,
Expand Down Expand Up @@ -1074,8 +1062,9 @@ class DiagnosticErrorTrap {
unsigned NumUnrecoverableErrors;

public:
explicit DiagnosticErrorTrap(DiagnosticsEngine &Diag)
: Diag(Diag) { reset(); }
explicit DiagnosticErrorTrap(DiagnosticsEngine &Diag) : Diag(Diag) {
reset();
}

/// Determine whether any errors have occurred since this
/// object instance was created.
Expand Down Expand Up @@ -1278,7 +1267,8 @@ class DiagnosticBuilder : public StreamingDiagnostic {
bool Emit() {
// If this diagnostic is inactive, then its soul was stolen by the copy ctor
// (or by a subclass, as in SemaDiagnosticBuilder).
if (!isActive()) return false;
if (!isActive())
return false;

// Process the diagnostic.
bool Result = DiagObj->EmitDiagnostic(*this, IsForceEmit);
Expand Down Expand Up @@ -1553,7 +1543,9 @@ class Diagnostic {
unsigned getID() const { return DiagID; }
const SourceLocation &getLocation() const { return DiagLoc; }
bool hasSourceManager() const { return DiagObj->hasSourceManager(); }
SourceManager &getSourceManager() const { return DiagObj->getSourceManager();}
SourceManager &getSourceManager() const {
return DiagObj->getSourceManager();
}

unsigned getNumArgs() const { return DiagStorage.NumDiagArgs; }

Expand Down Expand Up @@ -1709,8 +1701,8 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const StoredDiagnostic &);
/// formats and prints fully processed diagnostics.
class DiagnosticConsumer {
protected:
unsigned NumWarnings = 0; ///< Number of warnings reported
unsigned NumErrors = 0; ///< Number of errors reported
unsigned NumWarnings = 0; ///< Number of warnings reported
unsigned NumErrors = 0; ///< Number of errors reported

public:
DiagnosticConsumer() = default;
Expand Down
Loading