diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-08-18 20:24:06 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-08-18 20:24:06 +0000 |
commit | dbe1a794f1e6610c8549b117ba6d1e325a0350ba (patch) | |
tree | 132eb39110556e1da662e6de1ff712183f422b7f | |
parent | 2878bf44b1ca34e9ec0dd8f6e076b06d26c8d708 (diff) | |
download | bcm5719-llvm-dbe1a794f1e6610c8549b117ba6d1e325a0350ba.tar.gz bcm5719-llvm-dbe1a794f1e6610c8549b117ba6d1e325a0350ba.zip |
Simplify Diagnostic's ctors a bit by using in-class initializers for its members
llvm-svn: 245339
-rw-r--r-- | clang/include/clang/Basic/Diagnostic.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 8e6bc2dea2e..c80eb967997 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/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(); |