xiaobai created this revision.
xiaobai added reviewers: JDevlieghere, clayborg, jingham, compnerd, labath.
Herald added a subscriber: mgorny.

This seems better suited to be in a plugin.


https://reviews.llvm.org/D64599

Files:
  include/lldb/Target/CPPLanguageRuntime.h
  source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/Language/CPlusPlus/CMakeLists.txt
  source/Plugins/Language/CPlusPlus/LibCxx.cpp
  source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt
  source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
  source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
  source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt
  
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
  
source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
  source/Target/CMakeLists.txt
  source/Target/CPPLanguageRuntime.cpp

Index: source/Target/CMakeLists.txt
===================================================================
--- source/Target/CMakeLists.txt
+++ source/Target/CMakeLists.txt
@@ -1,6 +1,5 @@
 add_lldb_library(lldbTarget
   ABI.cpp
-  CPPLanguageRuntime.cpp
   ExecutionContext.cpp
   JITLoader.cpp
   JITLoaderList.cpp
Index: source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
===================================================================
--- source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
+++ source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
@@ -19,10 +19,11 @@
 #include "llvm/ADT/StringRef.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Expression/LLVMUserExpression.h"
-#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/lldb-private.h"
 
+#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
+
 namespace lldb_private {
 namespace lldb_renderscript {
 
Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
===================================================================
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
@@ -19,6 +19,7 @@
     lldbTarget
     lldbUtility
     lldbPluginExpressionParserClang
+    lldbPluginCPPRuntime
   LINK_COMPONENTS
     Support
   )
Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
===================================================================
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -24,7 +24,6 @@
 #include "lldb/Expression/FunctionCaller.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
@@ -39,6 +38,7 @@
 
 #include "Plugins/Process/Utility/HistoryThread.h"
 #include "Plugins/Language/ObjC/NSString.h"
+#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
 
 #include <vector>
 
Index: source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
===================================================================
--- source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
+++ source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
@@ -16,10 +16,11 @@
 #include "lldb/Breakpoint/BreakpointResolver.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Symbol/Type.h"
-#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/lldb-private.h"
 
+#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
+
 namespace lldb_private {
 
 class ItaniumABILanguageRuntime : public lldb_private::CPPLanguageRuntime {
Index: source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt
===================================================================
--- source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt
+++ source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt
@@ -7,4 +7,5 @@
     lldbInterpreter
     lldbSymbol
     lldbTarget
+    lldbPluginCPPRuntime
   )
Index: include/lldb/Target/CPPLanguageRuntime.h
===================================================================
--- /dev/null
+++ include/lldb/Target/CPPLanguageRuntime.h
@@ -1,90 +0,0 @@
-//===-- CPPLanguageRuntime.h
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_CPPLanguageRuntime_h_
-#define liblldb_CPPLanguageRuntime_h_
-
-#include <vector>
-#include "lldb/Core/PluginInterface.h"
-#include "lldb/Target/LanguageRuntime.h"
-#include "lldb/lldb-private.h"
-
-namespace lldb_private {
-
-class CPPLanguageRuntime : public LanguageRuntime {
-public:
-  enum class LibCppStdFunctionCallableCase {
-    Lambda = 0,
-    CallableObject,
-    FreeOrMemberFunction,
-    Invalid
-  };
-
-  struct LibCppStdFunctionCallableInfo {
-    Symbol callable_symbol;
-    Address callable_address;
-    LineEntry callable_line_entry;
-    lldb::addr_t member__f_pointer_value = 0u;
-    LibCppStdFunctionCallableCase callable_case =
-        LibCppStdFunctionCallableCase::Invalid;
-  };
-
-  LibCppStdFunctionCallableInfo
-  FindLibCppStdFunctionCallableInfo(lldb::ValueObjectSP &valobj_sp);
-
-  ~CPPLanguageRuntime() override;
-
-  static char ID;
-
-  bool isA(const void *ClassID) const override {
-    return ClassID == &ID || LanguageRuntime::isA(ClassID);
-  }
-
-  static bool classof(const LanguageRuntime *runtime) {
-    return runtime->isA(&ID);
-  }
-
-  lldb::LanguageType GetLanguageType() const override {
-    return lldb::eLanguageTypeC_plus_plus;
-  }
-
-  static CPPLanguageRuntime *Get(Process &process) {
-    return llvm::cast_or_null<CPPLanguageRuntime>(
-        process.GetLanguageRuntime(lldb::eLanguageTypeC_plus_plus));
-  }
-
-  bool GetObjectDescription(Stream &str, ValueObject &object) override;
-
-  bool GetObjectDescription(Stream &str, Value &value,
-                            ExecutionContextScope *exe_scope) override;
-
-  /// Obtain a ThreadPlan to get us into C++ constructs such as std::function.
-  ///
-  /// \param[in] thread
-  ///     Curent thrad of execution.
-  ///
-  /// \param[in] stop_others
-  ///     True if other threads should pause during execution.
-  ///
-  /// \return
-  ///      A ThreadPlan Shared pointer
-  lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
-                                                  bool stop_others) override;
-
-  bool IsWhitelistedRuntimeValue(ConstString name) override;
-protected:
-  // Classes that inherit from CPPLanguageRuntime can see and modify these
-  CPPLanguageRuntime(Process *process);
-
-private:
-  DISALLOW_COPY_AND_ASSIGN(CPPLanguageRuntime);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CPPLanguageRuntime_h_
Index: source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
===================================================================
--- source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -6,13 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lldb/Target/CPPLanguageRuntime.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
-
 #include <string.h>
 
 #include <memory>
 
+#include "CPPLanguageRuntime.h"
+
 #include "llvm/ADT/StringRef.h"
 
 #include "lldb/Symbol/Block.h"
Index: source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt
===================================================================
--- source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt
+++ source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt
@@ -1,2 +1,11 @@
+add_lldb_library(lldbPluginCPPRuntime PLUGIN
+  CPPLanguageRuntime.cpp
+
+  LINK_LIBS
+    lldbCore
+    lldbSymbol
+    lldbTarget
+)
+
 add_subdirectory(ItaniumABI)
 #add_subdirectory(MicrosoftABI)
Index: source/Plugins/Language/CPlusPlus/LibCxx.cpp
===================================================================
--- source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -18,7 +18,6 @@
 #include "lldb/DataFormatters/TypeSummary.h"
 #include "lldb/DataFormatters/VectorIterator.h"
 #include "lldb/Symbol/ClangASTContext.h"
-#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/ProcessStructReader.h"
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
@@ -27,6 +26,8 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/Stream.h"
 
+#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
Index: source/Plugins/Language/CPlusPlus/CMakeLists.txt
===================================================================
--- source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -28,6 +28,7 @@
     lldbTarget
     lldbUtility
     lldbPluginClangCommon
+    lldbPluginCPPRuntime
 
   LINK_COMPONENTS
     Support
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===================================================================
--- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -32,7 +32,6 @@
 #include "lldb/Symbol/TypeList.h"
 #include "lldb/Symbol/Variable.h"
 #include "lldb/Symbol/VariableList.h"
-#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
@@ -53,6 +52,7 @@
 #include "clang/AST/RecursiveASTVisitor.h"
 
 #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
 
 using namespace lldb;
 using namespace lldb_private;
Index: source/Plugins/ExpressionParser/Clang/CMakeLists.txt
===================================================================
--- source/Plugins/ExpressionParser/Clang/CMakeLists.txt
+++ source/Plugins/ExpressionParser/Clang/CMakeLists.txt
@@ -43,6 +43,7 @@
     lldbTarget
     lldbUtility
     lldbPluginCPlusPlusLanguage
+    lldbPluginCPPRuntime
   LINK_COMPONENTS
     Core
     ExecutionEngine
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to