Reduce header footprint of Target.h

This continues the effort to reduce header footprint and improve
build speed by removing clang and other unnecessary headers
from Target.h.  In one case, some headers were included solely
for the purpose of declaring a nested class in Target, which was
not needed by anybody outside the class.  In this case the
definition and implementation of the nested class were isolated
in the .cpp file so the header could be removed.

llvm-svn: 231107
This commit is contained in:
Zachary Turner 2015-03-03 19:23:09 +00:00
parent fff8e7f6ba
commit 32abc6edac
26 changed files with 130 additions and 132 deletions

View File

@ -20,10 +20,11 @@
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Target/Target.h"
#include "lldb/Core/UserID.h"
#include "lldb/Breakpoint/WatchpointOptions.h"
#include "lldb/Breakpoint/StoppointLocation.h"
#include "lldb/Core/UserID.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Target/Target.h"
namespace lldb_private {

View File

@ -15,6 +15,7 @@
#include "clang/Basic/IdentifierTable.h"
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
#include "lldb/Symbol/ClangASTImporter.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Target/Target.h"
#include "llvm/ADT/SmallSet.h"

View File

@ -18,22 +18,12 @@
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/Breakpoint/BreakpointList.h"
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
#include "lldb/Breakpoint/WatchpointList.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/Event.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Expression/ClangModulesDeclVendor.h"
#include "lldb/Expression/ClangPersistentVariables.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/OptionValueBoolean.h"
#include "lldb/Interpreter/OptionValueEnumeration.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/PathMappingList.h"
#include "lldb/Target/ProcessLaunchInfo.h"
@ -228,8 +218,6 @@ private:
ProcessLaunchInfo m_launch_info;
};
typedef std::shared_ptr<TargetProperties> TargetPropertiesSP;
class EvaluateExpressionOptions
{
public:
@ -506,43 +494,6 @@ public:
{
return GetStaticBroadcasterClass();
}
// This event data class is for use by the TargetList to broadcast new target notifications.
class TargetEventData : public EventData
{
public:
static const ConstString &
GetFlavorString ();
virtual const ConstString &
GetFlavor () const;
TargetEventData (const lldb::TargetSP &new_target_sp);
lldb::TargetSP &
GetTarget()
{
return m_target_sp;
}
virtual
~TargetEventData();
virtual void
Dump (Stream *s) const;
static const lldb::TargetSP
GetTargetFromEvent (const lldb::EventSP &event_sp);
static const TargetEventData *
GetEventDataFromEvent (const Event *event_sp);
private:
lldb::TargetSP m_target_sp;
DISALLOW_COPY_AND_ASSIGN (TargetEventData);
};
static void
SettingsInitialize ();
@ -550,9 +501,6 @@ public:
static void
SettingsTerminate ();
// static lldb::UserSettingsControllerSP &
// GetSettingsController ();
static FileSpecList
GetDefaultExecutableSearchPaths ();
@ -576,7 +524,7 @@ public:
// Settings accessors
//----------------------------------------------------------------------
static const TargetPropertiesSP &
static const lldb::TargetPropertiesSP &
GetGlobalProperties();
@ -1226,10 +1174,7 @@ public:
const EvaluateExpressionOptions& options = EvaluateExpressionOptions());
ClangPersistentVariables &
GetPersistentVariables()
{
return m_persistent_variables;
}
GetPersistentVariables();
//------------------------------------------------------------------
// Target Stop Hooks
@ -1267,10 +1212,7 @@ public:
// Set the specifier. The stop hook will own the specifier, and is responsible for deleting it when we're done.
void
SetSpecifier (SymbolContextSpecifier *specifier)
{
m_specifier_sp.reset (specifier);
}
SetSpecifier (SymbolContextSpecifier *specifier);
SymbolContextSpecifier *
GetSpecifier ()
@ -1431,13 +1373,13 @@ protected:
lldb::ProcessSP m_process_sp;
lldb::SearchFilterSP m_search_filter_sp;
PathMappingList m_image_search_paths;
std::unique_ptr<ClangASTContext> m_scratch_ast_context_ap;
std::unique_ptr<ClangASTSource> m_scratch_ast_source_ap;
std::unique_ptr<ClangASTImporter> m_ast_importer_ap;
std::unique_ptr<ClangModulesDeclVendor> m_clang_modules_decl_vendor_ap;
ClangPersistentVariables m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser.
lldb::ClangASTContextUP m_scratch_ast_context_ap;
lldb::ClangASTSourceUP m_scratch_ast_source_ap;
lldb::ClangASTImporterUP m_ast_importer_ap;
lldb::ClangModulesDeclVendorUP m_clang_modules_decl_vendor_ap;
lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser.
std::unique_ptr<SourceManager> m_source_manager_ap;
lldb::SourceManagerUP m_source_manager_ap;
typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection;
StopHookCollection m_stop_hooks;

View File

@ -58,6 +58,7 @@ class ClangExpressionVariableList;
class ClangExpressionVariableList;
class ClangExpressionVariables;
class ClangFunction;
class ClangModulesDeclVendor;
class ClangPersistentVariables;
class ClangUserExpression;
class ClangUtilityFunction;
@ -232,6 +233,7 @@ class QueueItem;
class QueueImpl;
class Target;
class TargetList;
class TargetProperties;
class Thread;
class ThreadCollection;
class ThreadList;
@ -302,7 +304,11 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::BreakpointResolver> BreakpointResolverSP;
typedef std::shared_ptr<lldb_private::Broadcaster> BroadcasterSP;
typedef std::unique_ptr<lldb_private::ClangASTContext> ClangASTContextUP;
typedef std::unique_ptr<lldb_private::ClangASTImporter> ClangASTImporterUP;
typedef std::unique_ptr<lldb_private::ClangASTSource> ClangASTSourceUP;
typedef std::shared_ptr<lldb_private::ClangExpressionVariable> ClangExpressionVariableSP;
typedef std::unique_ptr<lldb_private::ClangModulesDeclVendor> ClangModulesDeclVendorUP;
typedef std::unique_ptr<lldb_private::ClangPersistentVariables> ClangPersistentVariablesUP;
typedef std::shared_ptr<lldb_private::CommandObject> CommandObjectSP;
typedef std::shared_ptr<lldb_private::Communication> CommunicationSP;
typedef std::shared_ptr<lldb_private::Connection> ConnectionSP;
@ -375,6 +381,7 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::SectionLoadList> SectionLoadListSP;
typedef std::shared_ptr<lldb_private::SearchFilter> SearchFilterSP;
typedef std::shared_ptr<lldb_private::Settings> SettingsSP;
typedef std::unique_ptr<lldb_private::SourceManager> SourceManagerUP;
typedef std::shared_ptr<lldb_private::StackFrame> StackFrameSP;
typedef std::unique_ptr<lldb_private::StackFrame> StackFrameUP;
typedef std::weak_ptr<lldb_private::StackFrame> StackFrameWP;
@ -394,6 +401,7 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::SyntheticChildrenFrontEnd> SyntheticChildrenFrontEndSP;
typedef std::shared_ptr<lldb_private::Target> TargetSP;
typedef std::weak_ptr<lldb_private::Target> TargetWP;
typedef std::shared_ptr<lldb_private::TargetProperties> TargetPropertiesSP;
typedef std::shared_ptr<lldb_private::Thread> ThreadSP;
typedef std::weak_ptr<lldb_private::Thread> ThreadWP;
typedef std::shared_ptr<lldb_private::ThreadCollection> ThreadCollectionSP;

View File

@ -14,7 +14,9 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Target/Target.h"

View File

@ -50,9 +50,9 @@
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/TargetList.h"

View File

@ -27,6 +27,7 @@
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Variable.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"

View File

@ -21,6 +21,7 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionValueBoolean.h"
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Core/RegularExpression.h"

View File

@ -25,6 +25,7 @@
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionGroupFormat.h"
#include "lldb/Interpreter/OptionValueArray.h"
#include "lldb/Interpreter/OptionValueBoolean.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"

View File

@ -50,6 +50,7 @@
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/StackFrame.h"

View File

@ -16,6 +16,7 @@
#include "lldb/Expression/ASTDumper.h"
#include "lldb/Expression/ClangASTSource.h"
#include "lldb/Expression/ClangExpression.h"
#include "lldb/Expression/ClangModulesDeclVendor.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/Function.h"

View File

@ -22,6 +22,7 @@
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Expression/ASTDumper.h"
#include "lldb/Expression/ClangASTSource.h"
#include "lldb/Expression/ClangModulesDeclVendor.h"
#include "lldb/Expression/ClangPersistentVariables.h"
#include "lldb/Expression/Materializer.h"
#include "lldb/Host/Endian.h"

View File

@ -15,6 +15,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"

View File

@ -21,6 +21,7 @@
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"

View File

@ -16,6 +16,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"

View File

@ -14,6 +14,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Target/Platform.h"
#include "lldb/Core/Section.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Process.h"

View File

@ -16,10 +16,11 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "JITLoaderGDB.h"

View File

@ -30,6 +30,7 @@
#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"

View File

@ -12,6 +12,7 @@
#include "lldb/Symbol/FuncUnwinders.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Process.h"

View File

@ -17,6 +17,7 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"

View File

@ -15,6 +15,7 @@
#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Target/ObjCLanguageRuntime.h"

View File

@ -35,6 +35,7 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Expression/ClangASTSource.h"
#include "lldb/Expression/ClangUserExpression.h"
#include "lldb/Expression/ClangModulesDeclVendor.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@ -54,6 +55,76 @@
using namespace lldb;
using namespace lldb_private;
namespace {
// This event data class is for use by the TargetList to broadcast new target notifications.
class TargetEventData : public EventData
{
public:
TargetEventData(const lldb::TargetSP &new_target_sp)
: EventData()
, m_target_sp(new_target_sp)
{
}
virtual ~TargetEventData()
{
}
static const ConstString &
GetFlavorString()
{
static ConstString g_flavor("Target::TargetEventData");
return g_flavor;
}
virtual const ConstString &
GetFlavor() const
{
return GetFlavorString();
}
lldb::TargetSP &
GetTarget()
{
return m_target_sp;
}
virtual void
Dump(Stream *s) const
{
}
static const lldb::TargetSP
GetTargetFromEvent(const lldb::EventSP &event_sp)
{
TargetSP target_sp;
const TargetEventData *data = GetEventDataFromEvent (event_sp.get());
if (data)
target_sp = data->m_target_sp;
return target_sp;
}
static const TargetEventData *
GetEventDataFromEvent(const Event *event_ptr)
{
if (event_ptr)
{
const EventData *event_data = event_ptr->GetData();
if (event_data && event_data->GetFlavor() == TargetEventData::GetFlavorString())
return static_cast <const TargetEventData *> (event_ptr->GetData());
}
return nullptr;
}
private:
lldb::TargetSP m_target_sp;
DISALLOW_COPY_AND_ASSIGN (TargetEventData);
};
}
ConstString &
Target::GetStaticBroadcasterClass ()
{
@ -83,7 +154,7 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::Plat
m_scratch_ast_context_ap (),
m_scratch_ast_source_ap (),
m_ast_importer_ap (),
m_persistent_variables (),
m_persistent_variables (new ClangPersistentVariables),
m_source_manager_ap(),
m_stop_hooks (),
m_stop_hook_next_id (0),
@ -226,7 +297,7 @@ Target::Destroy()
m_last_created_watchpoint.reset();
m_search_filter_sp.reset();
m_image_search_paths.Clear(notify);
m_persistent_variables.Clear();
m_persistent_variables->Clear();
m_stop_hooks.clear();
m_stop_hook_next_id = 0;
m_suppress_stop_hooks = false;
@ -1953,7 +2024,7 @@ Target::EvaluateExpression
lldb::ClangExpressionVariableSP persistent_var_sp;
// Only check for persistent variables the expression starts with a '$'
if (expr_cstr[0] == '$')
persistent_var_sp = m_persistent_variables.GetVariable (expr_cstr);
persistent_var_sp = m_persistent_variables->GetVariable (expr_cstr);
if (persistent_var_sp)
{
@ -1977,6 +2048,12 @@ Target::EvaluateExpression
return execution_results;
}
ClangPersistentVariables &
Target::GetPersistentVariables()
{
return *m_persistent_variables;
}
lldb::addr_t
Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const
{
@ -2722,6 +2799,12 @@ Target::StopHook::~StopHook ()
{
}
void
Target::StopHook::SetSpecifier(SymbolContextSpecifier *specifier)
{
m_specifier_sp.reset(specifier);
}
void
Target::StopHook::SetThreadSpecifier (ThreadSpec *specifier)
{
@ -3521,61 +3604,3 @@ TargetProperties::DisableSTDIOValueChangedCallback(void *target_property_ptr, Op
else
this_->m_launch_info.GetFlags().Clear(lldb::eLaunchFlagDisableSTDIO);
}
//----------------------------------------------------------------------
// Target::TargetEventData
//----------------------------------------------------------------------
const ConstString &
Target::TargetEventData::GetFlavorString ()
{
static ConstString g_flavor ("Target::TargetEventData");
return g_flavor;
}
const ConstString &
Target::TargetEventData::GetFlavor () const
{
return TargetEventData::GetFlavorString ();
}
Target::TargetEventData::TargetEventData (const lldb::TargetSP &new_target_sp) :
EventData(),
m_target_sp (new_target_sp)
{
}
Target::TargetEventData::~TargetEventData()
{
}
void
Target::TargetEventData::Dump (Stream *s) const
{
}
const TargetSP
Target::TargetEventData::GetTargetFromEvent (const lldb::EventSP &event_sp)
{
TargetSP target_sp;
const TargetEventData *data = GetEventDataFromEvent (event_sp.get());
if (data)
target_sp = data->m_target_sp;
return target_sp;
}
const Target::TargetEventData *
Target::TargetEventData::GetEventDataFromEvent (const Event *event_ptr)
{
if (event_ptr)
{
const EventData *event_data = event_ptr->GetData();
if (event_data && event_data->GetFlavor() == TargetEventData::GetFlavorString())
return static_cast <const TargetEventData *> (event_ptr->GetData());
}
return NULL;
}

View File

@ -21,6 +21,7 @@
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"

View File

@ -22,6 +22,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/Stream.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"

View File

@ -21,6 +21,7 @@
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StopInfo.h"

View File

@ -26,6 +26,7 @@
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/Value.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/Process.h"