Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/lldb/Utility/StructuredData.h b/linux-x64/clang/include/lldb/Utility/StructuredData.h
index 75eb2f7..4d03af1 100644
--- a/linux-x64/clang/include/lldb/Utility/StructuredData.h
+++ b/linux-x64/clang/include/lldb/Utility/StructuredData.h
@@ -6,13 +6,15 @@
//
//===----------------------------------------------------------------------===//
-#ifndef liblldb_StructuredData_h_
-#define liblldb_StructuredData_h_
+#ifndef LLDB_UTILITY_STRUCTUREDDATA_H
+#define LLDB_UTILITY_STRUCTUREDDATA_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/JSON.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Stream.h"
#include "lldb/lldb-enumerations.h"
#include <cassert>
@@ -28,7 +30,6 @@
namespace lldb_private {
class Status;
-class Stream;
}
namespace lldb_private {
@@ -150,7 +151,12 @@
void DumpToStdout(bool pretty_print = true) const;
- virtual void Dump(Stream &s, bool pretty_print = true) const = 0;
+ virtual void Serialize(llvm::json::OStream &s) const = 0;
+
+ void Dump(lldb_private::Stream &s, bool pretty_print = true) const {
+ llvm::json::OStream jso(s.AsRawOstream(), pretty_print ? 2 : 0);
+ Serialize(jso);
+ }
private:
lldb::StructuredDataType m_type;
@@ -265,11 +271,11 @@
return false;
}
- void Push(ObjectSP item) { m_items.push_back(item); }
+ void Push(const ObjectSP &item) { m_items.push_back(item); }
- void AddItem(ObjectSP item) { m_items.push_back(item); }
+ void AddItem(const ObjectSP &item) { m_items.push_back(item); }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
typedef std::vector<ObjectSP> collection;
@@ -287,7 +293,7 @@
uint64_t GetValue() { return m_value; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
uint64_t m_value;
@@ -304,7 +310,7 @@
double GetValue() { return m_value; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
double m_value;
@@ -321,7 +327,7 @@
bool GetValue() { return m_value; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
bool m_value;
@@ -333,11 +339,11 @@
explicit String(llvm::StringRef S)
: Object(lldb::eStructuredDataTypeString), m_value(S) {}
- void SetValue(llvm::StringRef S) { m_value = S; }
+ void SetValue(llvm::StringRef S) { m_value = std::string(S); }
llvm::StringRef GetValue() { return m_value; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
std::string m_value;
@@ -487,7 +493,7 @@
void AddItem(llvm::StringRef key, ObjectSP value_sp) {
ConstString key_cs(key);
- m_dict[key_cs] = value_sp;
+ m_dict[key_cs] = std::move(value_sp);
}
void AddIntegerItem(llvm::StringRef key, uint64_t value) {
@@ -506,7 +512,7 @@
AddItem(key, std::make_shared<Boolean>(value));
}
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
protected:
typedef std::map<ConstString, ObjectSP> collection;
@@ -521,7 +527,7 @@
bool IsValid() const override { return false; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
};
class Generic : public Object {
@@ -535,17 +541,16 @@
bool IsValid() const override { return m_object != nullptr; }
- void Dump(Stream &s, bool pretty_print = true) const override;
+ void Serialize(llvm::json::OStream &s) const override;
private:
void *m_object;
};
- static ObjectSP ParseJSON(std::string json_text);
-
+ static ObjectSP ParseJSON(const std::string &json_text);
static ObjectSP ParseJSONFromFile(const FileSpec &file, Status &error);
};
} // namespace lldb_private
-#endif // liblldb_StructuredData_h_
+#endif // LLDB_UTILITY_STRUCTUREDDATA_H