Author: Alex Langford Date: 2020-01-31T22:05:23-08:00 New Revision: 2637769b9f38010082276b7b839a17b102d1ac93
URL: https://github.com/llvm/llvm-project/commit/2637769b9f38010082276b7b839a17b102d1ac93 DIFF: https://github.com/llvm/llvm-project/commit/2637769b9f38010082276b7b839a17b102d1ac93.diff LOG: [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. Added: Modified: lldb/include/lldb/Target/LanguageRuntime.h lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h Removed: ################################################################################ diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h index 73c8dfa3874d..7af6cd2e91ff 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 @@ class LanguageRuntime : public PluginInterface { 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 3bb120a48e90..909e92ace8d4 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 1516d5b0277b..3faf6f238b23 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 <cctype> #include <memory> @@ -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<RenderScriptRuntime>(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 c3740ba55a11..2fec7dcf4f6e 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 @@ class RenderScriptRuntime : public lldb_private::CPPLanguageRuntime { return false; } + bool GetOverrideExprOptions(clang::TargetOptions &prototype); + // PluginInterface protocol lldb_private::ConstString GetPluginName() override; @@ -577,8 +583,6 @@ class RenderScriptRuntime : public lldb_private::CPPLanguageRuntime { // 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; }; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits