[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.
This commit is contained in:
Raphael Isemann 2020-12-04 09:17:51 +01:00
parent 5b9fc44d81
commit 973f3907a4
2 changed files with 18 additions and 17 deletions

View File

@ -613,7 +613,7 @@ lldb::TypeSystemSP TypeSystemClang::CreateInstance(lldb::LanguageType language,
"ASTContext for '" + module->GetFileSpec().GetPath() + "'";
return std::make_shared<TypeSystemClang>(ast_name, triple);
} else if (target && target->IsValid())
return std::make_shared<TypeSystemClangForExpressions>(*target, triple);
return std::make_shared<ScratchTypeSystemClang>(*target, triple);
return lldb::TypeSystemSP();
}
@ -9567,8 +9567,8 @@ TypeSystemClang::DeclContextGetTypeSystemClang(const CompilerDeclContext &dc) {
return nullptr;
}
TypeSystemClangForExpressions::TypeSystemClangForExpressions(
Target &target, llvm::Triple triple)
ScratchTypeSystemClang::ScratchTypeSystemClang(Target &target,
llvm::Triple triple)
: TypeSystemClang("scratch ASTContext", triple),
m_target_wp(target.shared_from_this()),
m_persistent_variables(new ClangPersistentVariables) {
@ -9580,16 +9580,15 @@ TypeSystemClangForExpressions::TypeSystemClangForExpressions(
SetExternalSource(proxy_ast_source);
}
void TypeSystemClangForExpressions::Finalize() {
void ScratchTypeSystemClang::Finalize() {
TypeSystemClang::Finalize();
m_scratch_ast_source_up.reset();
}
UserExpression *TypeSystemClangForExpressions::GetUserExpression(
UserExpression *ScratchTypeSystemClang::GetUserExpression(
llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language,
Expression::ResultType desired_type,
const EvaluateExpressionOptions &options,
ValueObject *ctx_obj) {
const EvaluateExpressionOptions &options, ValueObject *ctx_obj) {
TargetSP target_sp = m_target_wp.lock();
if (!target_sp)
return nullptr;
@ -9598,7 +9597,7 @@ UserExpression *TypeSystemClangForExpressions::GetUserExpression(
desired_type, options, ctx_obj);
}
FunctionCaller *TypeSystemClangForExpressions::GetFunctionCaller(
FunctionCaller *ScratchTypeSystemClang::GetFunctionCaller(
const CompilerType &return_type, const Address &function_address,
const ValueList &arg_value_list, const char *name) {
TargetSP target_sp = m_target_wp.lock();
@ -9614,8 +9613,8 @@ FunctionCaller *TypeSystemClangForExpressions::GetFunctionCaller(
}
std::unique_ptr<UtilityFunction>
TypeSystemClangForExpressions::CreateUtilityFunction(std::string text,
std::string name) {
ScratchTypeSystemClang::CreateUtilityFunction(std::string text,
std::string name) {
TargetSP target_sp = m_target_wp.lock();
if (!target_sp)
return {};
@ -9625,6 +9624,6 @@ TypeSystemClangForExpressions::CreateUtilityFunction(std::string text,
}
PersistentExpressionState *
TypeSystemClangForExpressions::GetPersistentExpressionState() {
ScratchTypeSystemClang::GetPersistentExpressionState() {
return m_persistent_variables.get();
}

View File

@ -1122,11 +1122,11 @@ private:
/// The TypeSystemClang instance used for the scratch ASTContext in a
/// lldb::Target.
class TypeSystemClangForExpressions : public TypeSystemClang {
class ScratchTypeSystemClang : public TypeSystemClang {
public:
TypeSystemClangForExpressions(Target &target, llvm::Triple triple);
ScratchTypeSystemClang(Target &target, llvm::Triple triple);
~TypeSystemClangForExpressions() override = default;
~ScratchTypeSystemClang() override = default;
void Finalize() override;
@ -1148,9 +1148,11 @@ public:
PersistentExpressionState *GetPersistentExpressionState() override;
private:
lldb::TargetWP m_target_wp;
std::unique_ptr<ClangPersistentVariables>
m_persistent_variables; // These are the persistent variables associated
// with this process for the expression parser
/// The persistent variables associated with this process for the expression
/// parser.
std::unique_ptr<ClangPersistentVariables> m_persistent_variables;
/// The ExternalASTSource that performs lookups and completes minimally
/// imported types.
std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
};