summaryrefslogtreecommitdiff
path: root/include/clang/Basic/Diagnostic.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:49:41 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:49:41 +0000
commit45b533945f0851ec234ca846e1af5ee1e4df0b6e (patch)
tree0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /include/clang/Basic/Diagnostic.h
parent7e86edd64bfae4e324224452e4ea879b3371a4bd (diff)
Notes
Diffstat (limited to 'include/clang/Basic/Diagnostic.h')
-rw-r--r--include/clang/Basic/Diagnostic.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index 3b7c282d37ad..1d6c19bc9539 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -864,28 +864,27 @@ public:
/// the common fields to registers, eliminating increments of the NumArgs field,
/// for example.
class DiagnosticBuilder {
- mutable DiagnosticsEngine *DiagObj;
- mutable unsigned NumArgs;
+ mutable DiagnosticsEngine *DiagObj = nullptr;
+ mutable unsigned NumArgs = 0;
/// \brief Status variable indicating if this diagnostic is still active.
///
// NOTE: This field is redundant with DiagObj (IsActive iff (DiagObj == 0)),
// but LLVM is not currently smart enough to eliminate the null check that
// Emit() would end up with if we used that as our status variable.
- mutable bool IsActive;
+ mutable bool IsActive = false;
/// \brief Flag indicating that this diagnostic is being emitted via a
/// call to ForceEmit.
- mutable bool IsForceEmit;
+ mutable bool IsForceEmit = false;
void operator=(const DiagnosticBuilder &) = delete;
friend class DiagnosticsEngine;
- DiagnosticBuilder()
- : DiagObj(nullptr), NumArgs(0), IsActive(false), IsForceEmit(false) {}
+ DiagnosticBuilder() = default;
explicit DiagnosticBuilder(DiagnosticsEngine *diagObj)
- : DiagObj(diagObj), NumArgs(0), IsActive(true), IsForceEmit(false) {
+ : DiagObj(diagObj), IsActive(true) {
assert(diagObj && "DiagnosticBuilder requires a valid DiagnosticsEngine!");
diagObj->DiagRanges.clear();
diagObj->DiagFixItHints.clear();
@@ -1077,14 +1076,14 @@ operator<<(const DiagnosticBuilder &DB, T *DC) {
}
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
- const SourceRange &R) {
+ SourceRange R) {
DB.AddSourceRange(CharSourceRange::getTokenRange(R));
return DB;
}
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
ArrayRef<SourceRange> Ranges) {
- for (const SourceRange &R: Ranges)
+ for (SourceRange R : Ranges)
DB.AddSourceRange(CharSourceRange::getTokenRange(R));
return DB;
}
@@ -1264,7 +1263,7 @@ class StoredDiagnostic {
std::vector<FixItHint> FixIts;
public:
- StoredDiagnostic();
+ StoredDiagnostic() = default;
StoredDiagnostic(DiagnosticsEngine::Level Level, const Diagnostic &Info);
StoredDiagnostic(DiagnosticsEngine::Level Level, unsigned ID,
StringRef Message);
@@ -1272,7 +1271,6 @@ public:
StringRef Message, FullSourceLoc Loc,
ArrayRef<CharSourceRange> Ranges,
ArrayRef<FixItHint> Fixits);
- ~StoredDiagnostic();
/// \brief Evaluates true when this object stores a diagnostic.
explicit operator bool() const { return Message.size() > 0; }