Skip to content

Commit 973f390

Browse files
committed
[lldb][NFC] Rename TypeSystemClangForExpressions to ScratchTypeSystemClang
We keep referring to the single object created by this class as 'scratch AST/Context/TypeSystem' so at this point we might as well rename the class. It's also not involved at all in expression evaluation, so the 'ForExpressions' prefix is a bit misleading.
1 parent 5b9fc44 commit 973f390

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ lldb::TypeSystemSP TypeSystemClang::CreateInstance(lldb::LanguageType language,
613613
"ASTContext for '" + module->GetFileSpec().GetPath() + "'";
614614
return std::make_shared<TypeSystemClang>(ast_name, triple);
615615
} else if (target && target->IsValid())
616-
return std::make_shared<TypeSystemClangForExpressions>(*target, triple);
616+
return std::make_shared<ScratchTypeSystemClang>(*target, triple);
617617
return lldb::TypeSystemSP();
618618
}
619619

@@ -9567,8 +9567,8 @@ TypeSystemClang::DeclContextGetTypeSystemClang(const CompilerDeclContext &dc) {
95679567
return nullptr;
95689568
}
95699569

9570-
TypeSystemClangForExpressions::TypeSystemClangForExpressions(
9571-
Target &target, llvm::Triple triple)
9570+
ScratchTypeSystemClang::ScratchTypeSystemClang(Target &target,
9571+
llvm::Triple triple)
95729572
: TypeSystemClang("scratch ASTContext", triple),
95739573
m_target_wp(target.shared_from_this()),
95749574
m_persistent_variables(new ClangPersistentVariables) {
@@ -9580,16 +9580,15 @@ TypeSystemClangForExpressions::TypeSystemClangForExpressions(
95809580
SetExternalSource(proxy_ast_source);
95819581
}
95829582

9583-
void TypeSystemClangForExpressions::Finalize() {
9583+
void ScratchTypeSystemClang::Finalize() {
95849584
TypeSystemClang::Finalize();
95859585
m_scratch_ast_source_up.reset();
95869586
}
95879587

9588-
UserExpression *TypeSystemClangForExpressions::GetUserExpression(
9588+
UserExpression *ScratchTypeSystemClang::GetUserExpression(
95899589
llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language,
95909590
Expression::ResultType desired_type,
9591-
const EvaluateExpressionOptions &options,
9592-
ValueObject *ctx_obj) {
9591+
const EvaluateExpressionOptions &options, ValueObject *ctx_obj) {
95939592
TargetSP target_sp = m_target_wp.lock();
95949593
if (!target_sp)
95959594
return nullptr;
@@ -9598,7 +9597,7 @@ UserExpression *TypeSystemClangForExpressions::GetUserExpression(
95989597
desired_type, options, ctx_obj);
95999598
}
96009599

9601-
FunctionCaller *TypeSystemClangForExpressions::GetFunctionCaller(
9600+
FunctionCaller *ScratchTypeSystemClang::GetFunctionCaller(
96029601
const CompilerType &return_type, const Address &function_address,
96039602
const ValueList &arg_value_list, const char *name) {
96049603
TargetSP target_sp = m_target_wp.lock();
@@ -9614,8 +9613,8 @@ FunctionCaller *TypeSystemClangForExpressions::GetFunctionCaller(
96149613
}
96159614

96169615
std::unique_ptr<UtilityFunction>
9617-
TypeSystemClangForExpressions::CreateUtilityFunction(std::string text,
9618-
std::string name) {
9616+
ScratchTypeSystemClang::CreateUtilityFunction(std::string text,
9617+
std::string name) {
96199618
TargetSP target_sp = m_target_wp.lock();
96209619
if (!target_sp)
96219620
return {};
@@ -9625,6 +9624,6 @@ TypeSystemClangForExpressions::CreateUtilityFunction(std::string text,
96259624
}
96269625

96279626
PersistentExpressionState *
9628-
TypeSystemClangForExpressions::GetPersistentExpressionState() {
9627+
ScratchTypeSystemClang::GetPersistentExpressionState() {
96299628
return m_persistent_variables.get();
96309629
}

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,11 +1122,11 @@ class TypeSystemClang : public TypeSystem {
11221122

11231123
/// The TypeSystemClang instance used for the scratch ASTContext in a
11241124
/// lldb::Target.
1125-
class TypeSystemClangForExpressions : public TypeSystemClang {
1125+
class ScratchTypeSystemClang : public TypeSystemClang {
11261126
public:
1127-
TypeSystemClangForExpressions(Target &target, llvm::Triple triple);
1127+
ScratchTypeSystemClang(Target &target, llvm::Triple triple);
11281128

1129-
~TypeSystemClangForExpressions() override = default;
1129+
~ScratchTypeSystemClang() override = default;
11301130

11311131
void Finalize() override;
11321132

@@ -1148,9 +1148,11 @@ class TypeSystemClangForExpressions : public TypeSystemClang {
11481148
PersistentExpressionState *GetPersistentExpressionState() override;
11491149
private:
11501150
lldb::TargetWP m_target_wp;
1151-
std::unique_ptr<ClangPersistentVariables>
1152-
m_persistent_variables; // These are the persistent variables associated
1153-
// with this process for the expression parser
1151+
/// The persistent variables associated with this process for the expression
1152+
/// parser.
1153+
std::unique_ptr<ClangPersistentVariables> m_persistent_variables;
1154+
/// The ExternalASTSource that performs lookups and completes minimally
1155+
/// imported types.
11541156
std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
11551157
};
11561158

0 commit comments

Comments
 (0)