From 2637769b9f38010082276b7b839a17b102d1ac93 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Fri, 31 Jan 2020 21:59:51 -0800 Subject: [PATCH] [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. --- lldb/include/lldb/Target/LanguageRuntime.h | 9 --------- lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt | 1 + .../Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp | 9 +++++++-- .../RenderScript/RenderScriptRuntime/RenderScriptRuntime.h | 8 ++++++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h index 73c8dfa3874..7af6cd2e91f 100644 --- a/lldb/include/lldb/Target/LanguageRuntime.h +++ b/lldb/include/lldb/Target/LanguageRuntime.h @@ -21,8 +21,6 @@ #include "lldb/lldb-private.h" #include "lldb/lldb-public.h" -#include "clang/Basic/TargetOptions.h" - namespace lldb_private { class ExceptionSearchFilter : public SearchFilter { @@ -162,13 +160,6 @@ public: 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 // custom LLVM IR passes that need to be run before an expression is // assembled and run. diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt b/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt index 3bb120a48e9..909e92ace8d 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt +++ b/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt @@ -41,6 +41,7 @@ add_lldb_library(lldbPluginExpressionParserClang PLUGIN lldbPluginCPlusPlusLanguage lldbPluginCPPRuntime lldbPluginObjCRuntime + lldbPluginRenderScriptRuntime lldbPluginTypeSystemClang CLANG_LIBS clangAST diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 1516d5b0277..3faf6f238b2 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -91,6 +91,7 @@ #include "lldb/Utility/StringList.h" #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" +#include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h" #include #include @@ -392,9 +393,13 @@ ClangExpressionParser::ClangExpressionParser( // 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 // 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(lang_rt)) overridden_target_opts = - lang_rt->GetOverrideExprOptions(m_compiler->getTargetOpts()); + renderscript_rt->GetOverrideExprOptions(m_compiler->getTargetOpts()); if (overridden_target_opts) if (log && log->GetVerbose()) { diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h index c3740ba55a1..2fec7dcf4f6 100644 --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h @@ -24,6 +24,10 @@ #include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h" +namespace clang { +class TargetOptions; +}; + namespace lldb_private { namespace lldb_renderscript { @@ -402,6 +406,8 @@ public: return false; } + bool GetOverrideExprOptions(clang::TargetOptions &prototype); + // PluginInterface protocol lldb_private::ConstString GetPluginName() override; @@ -577,8 +583,6 @@ private: // any previous stored allocation which has the same address. AllocationDetails *CreateAllocation(lldb::addr_t address); - bool GetOverrideExprOptions(clang::TargetOptions &prototype) override; - bool GetIRPasses(LLVMUserExpression::IRPasses &passes) override; }; -- 2.11.0