[lldb] Remove LanguageRuntime::GetOverrideExprOptions

LanguageRuntime::GetOverrideExprOptions is specific to clang and was
only overridden in RenderScriptRuntime. LanguageRuntime in shouldn't
have any knowledge of clang, so remove it from LanguageRuntime and leave
it only in RenderScriptRuntime.
This commit is contained in:
Alex Langford 2020-01-31 21:59:51 -08:00
parent da1973a241
commit 2637769b9f
4 changed files with 14 additions and 13 deletions

View File

@ -21,8 +21,6 @@
#include "lldb/lldb-private.h" #include "lldb/lldb-private.h"
#include "lldb/lldb-public.h" #include "lldb/lldb-public.h"
#include "clang/Basic/TargetOptions.h"
namespace lldb_private { namespace lldb_private {
class ExceptionSearchFilter : public SearchFilter { class ExceptionSearchFilter : public SearchFilter {
@ -162,13 +160,6 @@ public:
virtual void ModulesDidLoad(const ModuleList &module_list) {} virtual void ModulesDidLoad(const ModuleList &module_list) {}
// Called by the Clang expression evaluation engine to allow runtimes to
// alter the set of target options provided to the compiler. If the options
// prototype is modified, runtimes must return true, false otherwise.
virtual bool GetOverrideExprOptions(clang::TargetOptions &prototype) {
return false;
}
// Called by ClangExpressionParser::PrepareForExecution to query for any // Called by ClangExpressionParser::PrepareForExecution to query for any
// custom LLVM IR passes that need to be run before an expression is // custom LLVM IR passes that need to be run before an expression is
// assembled and run. // assembled and run.

View File

@ -41,6 +41,7 @@ add_lldb_library(lldbPluginExpressionParserClang PLUGIN
lldbPluginCPlusPlusLanguage lldbPluginCPlusPlusLanguage
lldbPluginCPPRuntime lldbPluginCPPRuntime
lldbPluginObjCRuntime lldbPluginObjCRuntime
lldbPluginRenderScriptRuntime
lldbPluginTypeSystemClang lldbPluginTypeSystemClang
CLANG_LIBS CLANG_LIBS
clangAST clangAST

View File

@ -91,6 +91,7 @@
#include "lldb/Utility/StringList.h" #include "lldb/Utility/StringList.h"
#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h"
#include <cctype> #include <cctype>
#include <memory> #include <memory>
@ -392,9 +393,13 @@ ClangExpressionParser::ClangExpressionParser(
// target. In this case, a specialized language runtime is available and we // target. In this case, a specialized language runtime is available and we
// can query it for extra options. For 99% of use cases, this will not be // can query it for extra options. For 99% of use cases, this will not be
// needed and should be provided when basic platform detection is not enough. // needed and should be provided when basic platform detection is not enough.
if (lang_rt) // FIXME: Generalize this. Only RenderScriptRuntime currently supports this
// currently. Hardcoding this isn't ideal but it's better than LanguageRuntime
// having knowledge of clang::TargetOpts.
if (auto *renderscript_rt =
llvm::dyn_cast_or_null<RenderScriptRuntime>(lang_rt))
overridden_target_opts = overridden_target_opts =
lang_rt->GetOverrideExprOptions(m_compiler->getTargetOpts()); renderscript_rt->GetOverrideExprOptions(m_compiler->getTargetOpts());
if (overridden_target_opts) if (overridden_target_opts)
if (log && log->GetVerbose()) { if (log && log->GetVerbose()) {

View File

@ -24,6 +24,10 @@
#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h" #include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
namespace clang {
class TargetOptions;
};
namespace lldb_private { namespace lldb_private {
namespace lldb_renderscript { namespace lldb_renderscript {
@ -402,6 +406,8 @@ public:
return false; return false;
} }
bool GetOverrideExprOptions(clang::TargetOptions &prototype);
// PluginInterface protocol // PluginInterface protocol
lldb_private::ConstString GetPluginName() override; lldb_private::ConstString GetPluginName() override;
@ -577,8 +583,6 @@ private:
// any previous stored allocation which has the same address. // any previous stored allocation which has the same address.
AllocationDetails *CreateAllocation(lldb::addr_t address); AllocationDetails *CreateAllocation(lldb::addr_t address);
bool GetOverrideExprOptions(clang::TargetOptions &prototype) override;
bool GetIRPasses(LLVMUserExpression::IRPasses &passes) override; bool GetIRPasses(LLVMUserExpression::IRPasses &passes) override;
}; };