[Lldb-commits] [lldb] r231097 - Don't #include ClangASTContext.h from Module.h

Zachary Turner zturner at google.com
Tue Mar 3 10:34:26 PST 2015


Author: zturner
Date: Tue Mar  3 12:34:26 2015
New Revision: 231097

URL: http://llvm.org/viewvc/llvm-project?rev=231097&view=rev
Log:
Don't #include ClangASTContext.h from Module.h

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

Modified:
    lldb/trunk/include/lldb/Core/ArchSpec.h
    lldb/trunk/include/lldb/Core/Module.h
    lldb/trunk/include/lldb/lldb-forward.h
    lldb/trunk/source/API/SBModule.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Expression/ClangASTSource.cpp
    lldb/trunk/source/Host/common/Symbols.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp

Modified: lldb/trunk/include/lldb/Core/ArchSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ArchSpec.h?rev=231097&r1=231096&r2=231097&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ArchSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ArchSpec.h Tue Mar  3 12:34:26 2015
@@ -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 {
@@ -290,44 +289,6 @@ public:
     //------------------------------------------------------------------
     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.

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=231097&r1=231096&r2=231097&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Tue Mar  3 12:34:26 2015
@@ -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"
 
@@ -1098,7 +1098,7 @@ protected:
     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
@@ -1107,10 +1107,10 @@ protected:
     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,

Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=231097&r1=231096&r2=231097&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Tue Mar  3 12:34:26 2015
@@ -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;
@@ -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;
@@ -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;

Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=231097&r1=231096&r2=231097&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Tue Mar  3 12:34:26 2015
@@ -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"

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=231097&r1=231096&r2=231097&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Tue Mar  3 12:34:26 2015
@@ -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"
@@ -145,7 +146,7 @@ Module::Module (const ModuleSpec &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),
@@ -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),
@@ -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),
@@ -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

Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=231097&r1=231096&r2=231097&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Tue Mar  3 12:34:26 2015
@@ -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"

Modified: lldb/trunk/source/Host/common/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=231097&r1=231096&r2=231097&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Symbols.cpp (original)
+++ lldb/trunk/source/Host/common/Symbols.cpp Tue Mar  3 12:34:26 2015
@@ -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;
 

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=231097&r1=231096&r2=231097&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Tue Mar  3 12:34:26 2015
@@ -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"

Modified: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp?rev=231097&r1=231096&r2=231097&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp Tue Mar  3 12:34:26 2015
@@ -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"





More information about the lldb-commits mailing list