diff options
Diffstat (limited to 'include/clang/Basic/Diagnostic.h')
| -rw-r--r-- | include/clang/Basic/Diagnostic.h | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index a516721ace6d5..5a707007e463f 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -1,9 +1,8 @@ //===- Diagnostic.h - C Language Family Diagnostic Handling -----*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -26,6 +25,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/Error.h" #include <cassert> #include <cstdint> #include <limits> @@ -210,8 +210,8 @@ private: // Used by __extension__ unsigned char AllExtensionsSilenced = 0; - // Suppress diagnostics after a fatal error? - bool SuppressAfterFatalError = true; + // Treat fatal errors like errors. + bool FatalsAsError = false; // Suppress all diagnostics. bool SuppressAllDiagnostics = false; @@ -615,9 +615,11 @@ public: void setErrorsAsFatal(bool Val) { GetCurDiagState()->ErrorsAsFatal = Val; } bool getErrorsAsFatal() const { return GetCurDiagState()->ErrorsAsFatal; } - /// When set to true (the default), suppress further diagnostics after - /// a fatal error. - void setSuppressAfterFatalError(bool Val) { SuppressAfterFatalError = Val; } + /// \brief When set to true, any fatal error reported is made an error. + /// + /// This setting takes precedence over the setErrorsAsFatal setting above. + void setFatalsAsError(bool Val) { FatalsAsError = Val; } + bool getFatalsAsError() const { return FatalsAsError; } /// When set to true mask warnings that come from system headers. void setSuppressSystemWarnings(bool Val) { @@ -1302,6 +1304,12 @@ inline DiagnosticBuilder DiagnosticsEngine::Report(SourceLocation Loc, return DiagnosticBuilder(this); } +inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, + llvm::Error &&E) { + DB.AddString(toString(std::move(E))); + return DB; +} + inline DiagnosticBuilder DiagnosticsEngine::Report(unsigned DiagID) { return Report(SourceLocation(), DiagID); } |
