Commit 8dbe2f02 authored by Raphael Isemann's avatar Raphael Isemann
Browse files

[lldb][NFC] Simplify CompilerType constructors/destructors and fix unused variable warning

CompilerType has no virtual functions and no statements in its constructors,
so we can simplify this code. This also allows Clang to emit unused variable warnings
for CompilerType, so I also removed one unused variable that otherwise causes -Werror
builds to fail.
parent 8ca79dac
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -30,14 +30,13 @@ class DataExtractor;
class CompilerType {
public:
  // Constructors and Destructors
  CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type);
  CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type)
      : m_type(type), m_type_system(type_system) {}

  CompilerType(const CompilerType &rhs)
      : m_type(rhs.m_type), m_type_system(rhs.m_type_system) {}

  CompilerType() : m_type(nullptr), m_type_system(nullptr) {}

  ~CompilerType();
  CompilerType() = default;

  // Operators

@@ -368,8 +367,8 @@ public:
  }

private:
  lldb::opaque_compiler_type_t m_type;
  TypeSystem *m_type_system;
  lldb::opaque_compiler_type_t m_type = nullptr;
  TypeSystem *m_type_system = nullptr;
};

bool operator==(const CompilerType &lhs, const CompilerType &rhs);
+0 −2
Original line number Diff line number Diff line
@@ -67,8 +67,6 @@ void ClangPersistentVariables::RemovePersistentVariable(
llvm::Optional<CompilerType>
ClangPersistentVariables::GetCompilerTypeFromPersistentDecl(
    ConstString type_name) {
  CompilerType compiler_type;

  PersistentDecl p = m_persistent_decls.lookup(type_name.GetCString());

  if (p.m_decl == nullptr)
+0 −6
Original line number Diff line number Diff line
@@ -26,12 +26,6 @@
using namespace lldb;
using namespace lldb_private;

CompilerType::CompilerType(TypeSystem *type_system,
                           lldb::opaque_compiler_type_t type)
    : m_type(type), m_type_system(type_system) {}

CompilerType::~CompilerType() {}

// Tests

bool CompilerType::IsAggregateType() const {