summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2017-04-19 18:56:44 +0000
committerJim Ingham <jingham@apple.com>2017-04-19 18:56:44 +0000
commit7197b5baa0f6a515dae4dc99f1596773ffb052d4 (patch)
tree88547fe3edad5e00b5219a3420ba221e0ef2be2d
parentf9dfc4e86cc515c7eb08de0b8a7227f59457d4f9 (diff)
Add CopyDiagnostic to the DiagnosticManager.
From Gregor Milos (gmilos@apple.com), for: https://reviews.llvm.org/D32078 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@300733 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/lldb/Expression/DiagnosticManager.h2
-rw-r--r--source/Expression/DiagnosticManager.cpp9
2 files changed, 11 insertions, 0 deletions
diff --git a/include/lldb/Expression/DiagnosticManager.h b/include/lldb/Expression/DiagnosticManager.h
index d9024e649..83e67df26 100644
--- a/include/lldb/Expression/DiagnosticManager.h
+++ b/include/lldb/Expression/DiagnosticManager.h
@@ -128,6 +128,8 @@ public:
m_diagnostics.push_back(diagnostic);
}
+ void CopyDiagnostics(DiagnosticManager &otherDiagnostics);
+
size_t Printf(DiagnosticSeverity severity, const char *format, ...)
__attribute__((format(printf, 3, 4)));
size_t PutString(DiagnosticSeverity severity, llvm::StringRef str);
diff --git a/source/Expression/DiagnosticManager.cpp b/source/Expression/DiagnosticManager.cpp
index 5ade0817b..ae20feb91 100644
--- a/source/Expression/DiagnosticManager.cpp
+++ b/source/Expression/DiagnosticManager.cpp
@@ -79,3 +79,12 @@ size_t DiagnosticManager::PutString(DiagnosticSeverity severity,
AddDiagnostic(str, severity, eDiagnosticOriginLLDB);
return str.size();
}
+
+void DiagnosticManager::CopyDiagnostics(DiagnosticManager &otherDiagnostics) {
+ for (const DiagnosticList::value_type &other_diagnostic:
+ otherDiagnostics.Diagnostics()) {
+ AddDiagnostic(
+ other_diagnostic->GetMessage(), other_diagnostic->GetSeverity(),
+ other_diagnostic->getKind(), other_diagnostic->GetCompilerID());
+ }
+}