aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/LanguageRuntime/Java
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/source/Plugins/LanguageRuntime/Java
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadllvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/Java')
-rw-r--r--lldb/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp237
-rw-r--r--lldb/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h80
2 files changed, 143 insertions, 174 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp
index 07312a8..36c30a9 100644
--- a/lldb/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp
@@ -23,154 +23,135 @@
using namespace lldb;
using namespace lldb_private;
-JavaLanguageRuntime::JavaLanguageRuntime(Process *process) : LanguageRuntime(process)
-{
-}
+JavaLanguageRuntime::JavaLanguageRuntime(Process *process)
+ : LanguageRuntime(process) {}
LanguageRuntime *
-JavaLanguageRuntime::CreateInstance(Process *process, lldb::LanguageType language)
-{
- if (language == eLanguageTypeJava)
- return new JavaLanguageRuntime(process);
- return nullptr;
+JavaLanguageRuntime::CreateInstance(Process *process,
+ lldb::LanguageType language) {
+ if (language == eLanguageTypeJava)
+ return new JavaLanguageRuntime(process);
+ return nullptr;
}
-void
-JavaLanguageRuntime::Initialize()
-{
- PluginManager::RegisterPlugin(GetPluginNameStatic(), "Java language runtime", CreateInstance);
+void JavaLanguageRuntime::Initialize() {
+ PluginManager::RegisterPlugin(GetPluginNameStatic(), "Java language runtime",
+ CreateInstance);
}
-void
-JavaLanguageRuntime::Terminate()
-{
- PluginManager::UnregisterPlugin(CreateInstance);
+void JavaLanguageRuntime::Terminate() {
+ PluginManager::UnregisterPlugin(CreateInstance);
}
-lldb_private::ConstString
-JavaLanguageRuntime::GetPluginNameStatic()
-{
- static ConstString g_name("java");
- return g_name;
+lldb_private::ConstString JavaLanguageRuntime::GetPluginNameStatic() {
+ static ConstString g_name("java");
+ return g_name;
}
-lldb_private::ConstString
-JavaLanguageRuntime::GetPluginName()
-{
- return GetPluginNameStatic();
+lldb_private::ConstString JavaLanguageRuntime::GetPluginName() {
+ return GetPluginNameStatic();
}
-uint32_t
-JavaLanguageRuntime::GetPluginVersion()
-{
- return 1;
-}
+uint32_t JavaLanguageRuntime::GetPluginVersion() { return 1; }
-bool
-JavaLanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value)
-{
- return true;
+bool JavaLanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
+ return true;
}
-static ConstString
-GetDynamicTypeId(ExecutionContext *exe_ctx, Target *target, ValueObject &in_value)
-{
- SymbolContext sc;
- TypeList class_types;
- llvm::DenseSet<SymbolFile *> searched_symbol_files;
- size_t num_matches = target->GetImages().FindTypes(sc, ConstString("Object"),
- true, // name_is_fully_qualified
- UINT32_MAX, searched_symbol_files, class_types);
- for (size_t i = 0; i < num_matches; ++i)
- {
- TypeSP type_sp = class_types.GetTypeAtIndex(i);
- CompilerType compiler_type = type_sp->GetFullCompilerType();
-
- if (compiler_type.GetMinimumLanguage() != eLanguageTypeJava ||
- compiler_type.GetTypeName() != ConstString("java::lang::Object"))
- continue;
-
- if (compiler_type.GetCompleteType() && compiler_type.IsCompleteType())
- {
- uint64_t type_id = JavaASTContext::CalculateDynamicTypeId(exe_ctx, compiler_type, in_value);
- if (type_id != UINT64_MAX)
- {
- char id[32];
- snprintf(id, sizeof(id), "0x%" PRIX64, type_id);
- return ConstString(id);
- }
- }
+static ConstString GetDynamicTypeId(ExecutionContext *exe_ctx, Target *target,
+ ValueObject &in_value) {
+ SymbolContext sc;
+ TypeList class_types;
+ llvm::DenseSet<SymbolFile *> searched_symbol_files;
+ size_t num_matches = target->GetImages().FindTypes(
+ sc, ConstString("Object"),
+ true, // name_is_fully_qualified
+ UINT32_MAX, searched_symbol_files, class_types);
+ for (size_t i = 0; i < num_matches; ++i) {
+ TypeSP type_sp = class_types.GetTypeAtIndex(i);
+ CompilerType compiler_type = type_sp->GetFullCompilerType();
+
+ if (compiler_type.GetMinimumLanguage() != eLanguageTypeJava ||
+ compiler_type.GetTypeName() != ConstString("java::lang::Object"))
+ continue;
+
+ if (compiler_type.GetCompleteType() && compiler_type.IsCompleteType()) {
+ uint64_t type_id = JavaASTContext::CalculateDynamicTypeId(
+ exe_ctx, compiler_type, in_value);
+ if (type_id != UINT64_MAX) {
+ char id[32];
+ snprintf(id, sizeof(id), "0x%" PRIX64, type_id);
+ return ConstString(id);
+ }
}
- return ConstString();
+ }
+ return ConstString();
}
-bool
-JavaLanguageRuntime::GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
- TypeAndOrName &class_type_or_name, Address &dynamic_address,
- Value::ValueType &value_type)
-{
- class_type_or_name.Clear();
-
- // null references don't have a dynamic type
- if (in_value.IsNilReference())
- return false;
-
- ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
- Target *target = exe_ctx.GetTargetPtr();
- if (!target)
- return false;
-
- ConstString linkage_name;
- CompilerType in_type = in_value.GetCompilerType();
- if (in_type.IsPossibleDynamicType(nullptr, false, false))
- linkage_name = GetDynamicTypeId(&exe_ctx, target, in_value);
- else
- linkage_name = JavaASTContext::GetLinkageName(in_type);
-
- if (!linkage_name)
- return false;
-
- class_type_or_name.SetName(in_type.GetNonReferenceType().GetTypeName());
-
- SymbolContext sc;
- TypeList class_types;
- llvm::DenseSet<SymbolFile *> searched_symbol_files;
- size_t num_matches = target->GetImages().FindTypes(sc, linkage_name,
- true, // name_is_fully_qualified
- UINT32_MAX, searched_symbol_files, class_types);
-
- for (size_t i = 0; i < num_matches; ++i)
- {
- TypeSP type_sp = class_types.GetTypeAtIndex(i);
- CompilerType compiler_type = type_sp->GetFullCompilerType();
-
- if (compiler_type.GetMinimumLanguage() != eLanguageTypeJava)
- continue;
-
- if (compiler_type.GetCompleteType() && compiler_type.IsCompleteType())
- {
- class_type_or_name.SetTypeSP(type_sp);
-
- Value &value = in_value.GetValue();
- value_type = value.GetValueType();
- dynamic_address.SetRawAddress(value.GetScalar().ULongLong(0));
- return true;
- }
- }
+bool JavaLanguageRuntime::GetDynamicTypeAndAddress(
+ ValueObject &in_value, lldb::DynamicValueType use_dynamic,
+ TypeAndOrName &class_type_or_name, Address &dynamic_address,
+ Value::ValueType &value_type) {
+ class_type_or_name.Clear();
+
+ // null references don't have a dynamic type
+ if (in_value.IsNilReference())
+ return false;
+
+ ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
+ Target *target = exe_ctx.GetTargetPtr();
+ if (!target)
+ return false;
+
+ ConstString linkage_name;
+ CompilerType in_type = in_value.GetCompilerType();
+ if (in_type.IsPossibleDynamicType(nullptr, false, false))
+ linkage_name = GetDynamicTypeId(&exe_ctx, target, in_value);
+ else
+ linkage_name = JavaASTContext::GetLinkageName(in_type);
+
+ if (!linkage_name)
return false;
+
+ class_type_or_name.SetName(in_type.GetNonReferenceType().GetTypeName());
+
+ SymbolContext sc;
+ TypeList class_types;
+ llvm::DenseSet<SymbolFile *> searched_symbol_files;
+ size_t num_matches = target->GetImages().FindTypes(
+ sc, linkage_name,
+ true, // name_is_fully_qualified
+ UINT32_MAX, searched_symbol_files, class_types);
+
+ for (size_t i = 0; i < num_matches; ++i) {
+ TypeSP type_sp = class_types.GetTypeAtIndex(i);
+ CompilerType compiler_type = type_sp->GetFullCompilerType();
+
+ if (compiler_type.GetMinimumLanguage() != eLanguageTypeJava)
+ continue;
+
+ if (compiler_type.GetCompleteType() && compiler_type.IsCompleteType()) {
+ class_type_or_name.SetTypeSP(type_sp);
+
+ Value &value = in_value.GetValue();
+ value_type = value.GetValueType();
+ dynamic_address.SetRawAddress(value.GetScalar().ULongLong(0));
+ return true;
+ }
+ }
+ return false;
}
TypeAndOrName
-JavaLanguageRuntime::FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value)
-{
- CompilerType static_type(static_value.GetCompilerType());
-
- TypeAndOrName ret(type_and_or_name);
- if (type_and_or_name.HasType())
- {
- CompilerType orig_type = type_and_or_name.GetCompilerType();
- if (static_type.IsReferenceType())
- ret.SetCompilerType(orig_type.GetLValueReferenceType());
- }
- return ret;
+JavaLanguageRuntime::FixUpDynamicType(const TypeAndOrName &type_and_or_name,
+ ValueObject &static_value) {
+ CompilerType static_type(static_value.GetCompilerType());
+
+ TypeAndOrName ret(type_and_or_name);
+ if (type_and_or_name.HasType()) {
+ CompilerType orig_type = type_and_or_name.GetCompilerType();
+ if (static_type.IsReferenceType())
+ ret.SetCompilerType(orig_type.GetLValueReferenceType());
+ }
+ return ret;
}
diff --git a/lldb/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h
index 83ed35d..6eeb404 100644
--- a/lldb/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h
@@ -19,70 +19,58 @@
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/lldb-private.h"
-namespace lldb_private
-{
+namespace lldb_private {
-class JavaLanguageRuntime : public LanguageRuntime
-{
+class JavaLanguageRuntime : public LanguageRuntime {
public:
- static void
- Initialize();
+ static void Initialize();
- static void
- Terminate();
+ static void Terminate();
- static lldb_private::LanguageRuntime *
- CreateInstance(Process *process, lldb::LanguageType language);
+ static lldb_private::LanguageRuntime *
+ CreateInstance(Process *process, lldb::LanguageType language);
- static lldb_private::ConstString
- GetPluginNameStatic();
+ static lldb_private::ConstString GetPluginNameStatic();
- lldb_private::ConstString
- GetPluginName() override;
+ lldb_private::ConstString GetPluginName() override;
- uint32_t
- GetPluginVersion() override;
+ uint32_t GetPluginVersion() override;
- lldb::LanguageType
- GetLanguageType() const override
- {
- return lldb::eLanguageTypeJava;
- }
+ lldb::LanguageType GetLanguageType() const override {
+ return lldb::eLanguageTypeJava;
+ }
- bool
- GetObjectDescription(Stream &str, ValueObject &object) override
- {
- return false;
- }
+ bool GetObjectDescription(Stream &str, ValueObject &object) override {
+ return false;
+ }
- bool
- GetObjectDescription(Stream &str, Value &value, ExecutionContextScope *exe_scope) override
- {
- return false;
- }
+ bool GetObjectDescription(Stream &str, Value &value,
+ ExecutionContextScope *exe_scope) override {
+ return false;
+ }
- lldb::BreakpointResolverSP
- CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) override
- {
- return nullptr;
- }
+ lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt,
+ bool catch_bp,
+ bool throw_bp) override {
+ return nullptr;
+ }
- TypeAndOrName
- FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override;
+ TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,
+ ValueObject &static_value) override;
- bool
- CouldHaveDynamicValue(ValueObject &in_value) override;
+ bool CouldHaveDynamicValue(ValueObject &in_value) override;
- bool
- GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
- TypeAndOrName &class_type_or_name, Address &address,
- Value::ValueType &value_type) override;
+ bool GetDynamicTypeAndAddress(ValueObject &in_value,
+ lldb::DynamicValueType use_dynamic,
+ TypeAndOrName &class_type_or_name,
+ Address &address,
+ Value::ValueType &value_type) override;
protected:
- JavaLanguageRuntime(Process *process);
+ JavaLanguageRuntime(Process *process);
private:
- DISALLOW_COPY_AND_ASSIGN(JavaLanguageRuntime);
+ DISALLOW_COPY_AND_ASSIGN(JavaLanguageRuntime);
};
} // namespace lldb_private