[Lldb-commits] [lldb] [lldb] DRAFT - Remove 2nd "error: " and print caret (^) below last input line from the developer. (PR #72150)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 27 13:46:16 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff a0a1ff3ab40e347589b4e27d8fd350c600526735 047413349901684411fb260a49c996633b7b4dc0 -- lldb/include/lldb/Expression/DiagnosticManager.h lldb/include/lldb/Interpreter/CommandReturnObject.h lldb/include/lldb/Utility/Status.h lldb/source/Expression/UserExpression.cpp lldb/source/Interpreter/CommandInterpreter.cpp lldb/source/Interpreter/CommandReturnObject.cpp lldb/source/Utility/Status.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/include/lldb/Expression/DiagnosticManager.h b/lldb/include/lldb/Expression/DiagnosticManager.h
index 5eec90241a..79fa6bf24d 100644
--- a/lldb/include/lldb/Expression/DiagnosticManager.h
+++ b/lldb/include/lldb/Expression/DiagnosticManager.h
@@ -12,9 +12,9 @@
#include "lldb/lldb-defines.h"
#include "lldb/lldb-types.h"
+#include "lldb/Utility/Status.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
-#include "lldb/Utility/Status.h"
#include <string>
#include <vector>
diff --git a/lldb/include/lldb/Utility/Status.h b/lldb/include/lldb/Utility/Status.h
index 840177385b..c044146c85 100644
--- a/lldb/include/lldb/Utility/Status.h
+++ b/lldb/include/lldb/Utility/Status.h
@@ -25,71 +25,71 @@ class raw_ostream;
}
namespace lldb_private {
- enum DiagnosticOrigin {
- eDiagnosticOriginUnknown = 0,
- eDiagnosticOriginLLDB,
- eDiagnosticOriginClang,
- eDiagnosticOriginSwift,
- eDiagnosticOriginLLVM
- };
-
- enum DiagnosticSeverity {
- eDiagnosticSeverityError,
- eDiagnosticSeverityWarning,
- eDiagnosticSeverityRemark
- };
-
- class Diagnostic {
- friend class DiagnosticManager;
-
- public:
- DiagnosticOrigin getKind() const { return m_origin; }
-
- static bool classof(const Diagnostic *diag) {
- DiagnosticOrigin kind = diag->getKind();
- switch (kind) {
- case eDiagnosticOriginUnknown:
- case eDiagnosticOriginLLDB:
- case eDiagnosticOriginLLVM:
- return true;
- case eDiagnosticOriginClang:
- case eDiagnosticOriginSwift:
- return false;
- }
+enum DiagnosticOrigin {
+ eDiagnosticOriginUnknown = 0,
+ eDiagnosticOriginLLDB,
+ eDiagnosticOriginClang,
+ eDiagnosticOriginSwift,
+ eDiagnosticOriginLLVM
+};
+
+enum DiagnosticSeverity {
+ eDiagnosticSeverityError,
+ eDiagnosticSeverityWarning,
+ eDiagnosticSeverityRemark
+};
+
+class Diagnostic {
+ friend class DiagnosticManager;
+
+public:
+ DiagnosticOrigin getKind() const { return m_origin; }
+
+ static bool classof(const Diagnostic *diag) {
+ DiagnosticOrigin kind = diag->getKind();
+ switch (kind) {
+ case eDiagnosticOriginUnknown:
+ case eDiagnosticOriginLLDB:
+ case eDiagnosticOriginLLVM:
+ return true;
+ case eDiagnosticOriginClang:
+ case eDiagnosticOriginSwift:
+ return false;
}
+ }
- Diagnostic(llvm::StringRef message, DiagnosticSeverity severity,
- DiagnosticOrigin origin, uint32_t compiler_id)
- : m_message(message), m_severity(severity), m_origin(origin),
- m_compiler_id(compiler_id) {}
+ Diagnostic(llvm::StringRef message, DiagnosticSeverity severity,
+ DiagnosticOrigin origin, uint32_t compiler_id)
+ : m_message(message), m_severity(severity), m_origin(origin),
+ m_compiler_id(compiler_id) {}
- Diagnostic(const Diagnostic &rhs)
- : m_message(rhs.m_message), m_severity(rhs.m_severity),
- m_origin(rhs.m_origin), m_compiler_id(rhs.m_compiler_id) {}
+ Diagnostic(const Diagnostic &rhs)
+ : m_message(rhs.m_message), m_severity(rhs.m_severity),
+ m_origin(rhs.m_origin), m_compiler_id(rhs.m_compiler_id) {}
- virtual ~Diagnostic() = default;
+ virtual ~Diagnostic() = default;
- virtual bool HasFixIts() const { return false; }
+ virtual bool HasFixIts() const { return false; }
- DiagnosticSeverity GetSeverity() const { return m_severity; }
+ DiagnosticSeverity GetSeverity() const { return m_severity; }
- uint32_t GetCompilerID() const { return m_compiler_id; }
+ uint32_t GetCompilerID() const { return m_compiler_id; }
- llvm::StringRef GetMessage() const { return m_message; }
+ llvm::StringRef GetMessage() const { return m_message; }
- void AppendMessage(llvm::StringRef message,
- bool precede_with_newline = true) {
- if (precede_with_newline)
- m_message.push_back('\n');
- m_message += message;
- }
+ void AppendMessage(llvm::StringRef message,
+ bool precede_with_newline = true) {
+ if (precede_with_newline)
+ m_message.push_back('\n');
+ m_message += message;
+ }
- protected:
- std::string m_message;
- DiagnosticSeverity m_severity;
- DiagnosticOrigin m_origin;
- uint32_t m_compiler_id; // Compiler-specific diagnostic ID
- };
+protected:
+ std::string m_message;
+ DiagnosticSeverity m_severity;
+ DiagnosticOrigin m_origin;
+ uint32_t m_compiler_id; // Compiler-specific diagnostic ID
+};
/// \class Status Status.h "lldb/Utility/Status.h" An error handling class.
///
@@ -256,6 +256,7 @@ protected:
lldb::eErrorTypeInvalid; ///< The type of the above error code.
mutable std::string m_string; ///< A string representation of the error code.
std::vector<Diagnostic> m_diagnostics;
+
private:
explicit Status(const llvm::formatv_object_base &payload) {
SetErrorToGenericError();
diff --git a/lldb/source/Utility/Status.cpp b/lldb/source/Utility/Status.cpp
index 952c0d1d40..0fc81f2962 100644
--- a/lldb/source/Utility/Status.cpp
+++ b/lldb/source/Utility/Status.cpp
@@ -289,6 +289,4 @@ void Status::AddDiagnostic(Diagnostic diagnostic) {
m_diagnostics.push_back(diagnostic);
}
-std::vector<Diagnostic> Status::GetDiagnostics() const {
- return m_diagnostics;
-}
+std::vector<Diagnostic> Status::GetDiagnostics() const { return m_diagnostics; }
``````````
</details>
https://github.com/llvm/llvm-project/pull/72150
More information about the lldb-commits
mailing list