Skip to content

Commit 8dbe2f0

Browse files
committed
[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.
1 parent 8ca79da commit 8dbe2f0

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

lldb/include/lldb/Symbol/CompilerType.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@ class DataExtractor;
3030
class CompilerType {
3131
public:
3232
// Constructors and Destructors
33-
CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type);
33+
CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type)
34+
: m_type(type), m_type_system(type_system) {}
3435

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

38-
CompilerType() : m_type(nullptr), m_type_system(nullptr) {}
39-
40-
~CompilerType();
39+
CompilerType() = default;
4140

4241
// Operators
4342

@@ -368,8 +367,8 @@ class CompilerType {
368367
}
369368

370369
private:
371-
lldb::opaque_compiler_type_t m_type;
372-
TypeSystem *m_type_system;
370+
lldb::opaque_compiler_type_t m_type = nullptr;
371+
TypeSystem *m_type_system = nullptr;
373372
};
374373

375374
bool operator==(const CompilerType &lhs, const CompilerType &rhs);

lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ void ClangPersistentVariables::RemovePersistentVariable(
6767
llvm::Optional<CompilerType>
6868
ClangPersistentVariables::GetCompilerTypeFromPersistentDecl(
6969
ConstString type_name) {
70-
CompilerType compiler_type;
71-
7270
PersistentDecl p = m_persistent_decls.lookup(type_name.GetCString());
7371

7472
if (p.m_decl == nullptr)

lldb/source/Symbol/CompilerType.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@
2626
using namespace lldb;
2727
using namespace lldb_private;
2828

29-
CompilerType::CompilerType(TypeSystem *type_system,
30-
lldb::opaque_compiler_type_t type)
31-
: m_type(type), m_type_system(type_system) {}
32-
33-
CompilerType::~CompilerType() {}
34-
3529
// Tests
3630

3731
bool CompilerType::IsAggregateType() const {

0 commit comments

Comments
 (0)