From: David Blaikie Date: Tue, 18 Aug 2015 20:24:06 +0000 (+0000) Subject: Simplify Diagnostic's ctors a bit by using in-class initializers for its members X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94830c268c0354df5cb17acef7eef7ff69b3d925;p=clang Simplify Diagnostic's ctors a bit by using in-class initializers for its members git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245339 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index 8e6bc2dea2..c80eb96799 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();