Skip to content

Commit

Permalink
Don't #include ClangASTContext.h from Module.h
Browse files Browse the repository at this point in the history
This is part of a larger effort to reduce header file footprints.
Combined, these patches reduce the build time of LLDB locally by
over 30%.  However, they touch many files and make many changes,
so will be submitted in small incremental pieces.

Reviewed By: Greg Clayton
Differential Revision: http://reviews.llvm.org/D8022

llvm-svn: 231097
  • Loading branch information
Zachary Turner committed Mar 3, 2015
1 parent a96989d commit 88c6b62
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 50 deletions.
41 changes: 1 addition & 40 deletions lldb/include/lldb/Core/ArchSpec.h
Expand Up @@ -12,9 +12,8 @@

#if defined(__cplusplus)

#include "lldb/lldb-private.h"
#include "lldb/lldb-forward.h"
#include "lldb/Core/ConstString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"

namespace lldb_private {
Expand Down Expand Up @@ -290,44 +289,6 @@ class ArchSpec
//------------------------------------------------------------------
void
MergeFrom(const ArchSpec &other);

//------------------------------------------------------------------
/// Sets this ArchSpec according to the given architecture name.
///
/// The architecture name can be one of the generic system default
/// values:
///
/// @li \c LLDB_ARCH_DEFAULT - The arch the current system defaults
/// to when a program is launched without any extra
/// attributes or settings.
/// @li \c LLDB_ARCH_DEFAULT_32BIT - The default host architecture
/// for 32 bit (if any).
/// @li \c LLDB_ARCH_DEFAULT_64BIT - The default host architecture
/// for 64 bit (if any).
///
/// Alternatively, if the object type of this ArchSpec has been
/// configured, a concrete architecture can be specified to set
/// the CPU type ("x86_64" for example).
///
/// Finally, an encoded object and archetecture format is accepted.
/// The format contains an object type (like "macho" or "elf"),
/// followed by a platform dependent encoding of CPU type and
/// subtype. For example:
///
/// "macho" : Specifies an object type of MachO.
/// "macho-16-6" : MachO specific encoding for ARMv6.
/// "elf-43 : ELF specific encoding for Sparc V9.
///
/// @param[in] arch_name The name of an architecture.
///
/// @return True if @p arch_name was successfully translated, false
/// otherwise.
//------------------------------------------------------------------
// bool
// SetArchitecture (const llvm::StringRef& arch_name);
//
// bool
// SetArchitecture (const char *arch_name);

//------------------------------------------------------------------
/// Change the architecture object type and CPU type.
Expand Down
10 changes: 5 additions & 5 deletions lldb/include/lldb/Core/Module.h
Expand Up @@ -10,12 +10,12 @@
#ifndef liblldb_Module_h_
#define liblldb_Module_h_

#include "lldb/lldb-forward.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/UUID.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Host/TimeValue.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/SymbolContextScope.h"
#include "lldb/Target/PathMappingList.h"

Expand Down Expand Up @@ -1098,7 +1098,7 @@ class Module :
mutable Mutex m_mutex; ///< A mutex to keep this object happy in multi-threaded environments.
TimeValue m_mod_time; ///< The modification time for this module when it was created.
ArchSpec m_arch; ///< The architecture for this module.
lldb_private::UUID m_uuid; ///< Each module is assumed to have a unique identifier to help match it up to debug symbols.
UUID m_uuid; ///< Each module is assumed to have a unique identifier to help match it up to debug symbols.
FileSpec m_file; ///< The file representation on disk for this module (if there is one).
FileSpec m_platform_file;///< The path to the module on the platform on which it is being debugged
FileSpec m_remote_install_file; ///< If set when debugging on remote platforms, this module will be installed at this location
Expand All @@ -1107,10 +1107,10 @@ class Module :
uint64_t m_object_offset;
TimeValue m_object_mod_time;
lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file parser for this module as it may or may not be shared with the SymbolFile
std::unique_ptr<SymbolVendor> m_symfile_ap; ///< A pointer to the symbol vendor for this module.
ClangASTContext m_ast; ///< The AST context for this module.
lldb::SymbolVendorUP m_symfile_ap; ///< A pointer to the symbol vendor for this module.
lldb::ClangASTContextUP m_ast; ///< The AST context for this module.
PathMappingList m_source_mappings; ///< Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are
std::unique_ptr<lldb_private::SectionList> m_sections_ap; ///< Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the debug info
lldb::SectionListUP m_sections_ap; ///< Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the debug info

bool m_did_load_objfile:1,
m_did_load_symbol_vendor:1,
Expand Down
3 changes: 3 additions & 0 deletions lldb/include/lldb/lldb-forward.h
Expand Up @@ -301,6 +301,7 @@ namespace lldb {
typedef std::weak_ptr<lldb_private::BreakpointLocation> BreakpointLocationWP;
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::shared_ptr<lldb_private::ClangExpressionVariable> ClangExpressionVariableSP;
typedef std::shared_ptr<lldb_private::CommandObject> CommandObjectSP;
typedef std::shared_ptr<lldb_private::Communication> CommunicationSP;
Expand Down Expand Up @@ -369,6 +370,7 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::ScriptSummaryFormat> ScriptSummaryFormatSP;
#endif // #ifndef LLDB_DISABLE_PYTHON
typedef std::shared_ptr<lldb_private::Section> SectionSP;
typedef std::unique_ptr<lldb_private::SectionList> SectionListUP;
typedef std::weak_ptr<lldb_private::Section> SectionWP;
typedef std::shared_ptr<lldb_private::SectionLoadList> SectionLoadListSP;
typedef std::shared_ptr<lldb_private::SearchFilter> SearchFilterSP;
Expand All @@ -387,6 +389,7 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::SymbolFileType> SymbolFileTypeSP;
typedef std::weak_ptr<lldb_private::SymbolFileType> SymbolFileTypeWP;
typedef std::shared_ptr<lldb_private::SymbolContextSpecifier> SymbolContextSpecifierSP;
typedef std::unique_ptr<lldb_private::SymbolVendor> SymbolVendorUP;
typedef std::shared_ptr<lldb_private::SyntheticChildren> SyntheticChildrenSP;
typedef std::shared_ptr<lldb_private::SyntheticChildrenFrontEnd> SyntheticChildrenFrontEndSP;
typedef std::shared_ptr<lldb_private::Target> TargetSP;
Expand Down
1 change: 1 addition & 0 deletions lldb/source/API/SBModule.cpp
Expand Up @@ -20,6 +20,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/Symtab.h"
Expand Down
11 changes: 6 additions & 5 deletions lldb/source/Core/Module.cpp
Expand Up @@ -26,6 +26,7 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/lldb-private-log.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
Expand Down Expand Up @@ -145,7 +146,7 @@ Module::Module (const ModuleSpec &module_spec) :
m_object_mod_time (),
m_objfile_sp (),
m_symfile_ap (),
m_ast (),
m_ast (new ClangASTContext),
m_source_mappings (),
m_sections_ap(),
m_did_load_objfile (false),
Expand Down Expand Up @@ -249,7 +250,7 @@ Module::Module(const FileSpec& file_spec,
m_object_mod_time (),
m_objfile_sp (),
m_symfile_ap (),
m_ast (),
m_ast (new ClangASTContext),
m_source_mappings (),
m_sections_ap(),
m_did_load_objfile (false),
Expand Down Expand Up @@ -295,7 +296,7 @@ Module::Module () :
m_object_mod_time (),
m_objfile_sp (),
m_symfile_ap (),
m_ast (),
m_ast (new ClangASTContext),
m_source_mappings (),
m_sections_ap(),
m_did_load_objfile (false),
Expand Down Expand Up @@ -440,10 +441,10 @@ Module::GetClangASTContext ()
object_arch.GetTriple().setOS(llvm::Triple::MacOSX);
}
}
m_ast.SetArchitecture (object_arch);
m_ast->SetArchitecture (object_arch);
}
}
return m_ast;
return *m_ast;
}

void
Expand Down
1 change: 1 addition & 0 deletions lldb/source/Expression/ClangASTSource.cpp
Expand Up @@ -16,6 +16,7 @@
#include "lldb/Expression/ASTDumper.h"
#include "lldb/Expression/ClangASTSource.h"
#include "lldb/Expression/ClangExpression.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/SymbolVendor.h"
Expand Down
2 changes: 2 additions & 0 deletions lldb/source/Host/common/Symbols.cpp
Expand Up @@ -19,6 +19,8 @@
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Target.h"

#include "llvm/Support/FileSystem.h"

using namespace lldb;
using namespace lldb_private;

Expand Down
Expand Up @@ -17,6 +17,7 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/State.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
Expand Down
Expand Up @@ -20,6 +20,7 @@
#include "lldb/Expression/ClangFunction.h"
#include "lldb/Expression/ClangUtilityFunction.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
#include "Plugins/Process/Utility/HistoryThread.h"
Expand Down

0 comments on commit 88c6b62

Please sign in to comment.