[Lldb-commits] [lldb] r280751 - *** This commit represents a complete reformatting of the LLDB source code

Kate Stone via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 6 13:58:36 PDT 2016


Modified: lldb/trunk/include/lldb/DataFormatters/TypeFormat.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeFormat.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeFormat.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeFormat.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- TypeFormat.h ----------------------------------------------*- C++ -*-===//
+//===-- TypeFormat.h ----------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -20,321 +21,203 @@
 // Other libraries and framework includes
 
 // Project includes
-#include "lldb/lldb-public.h"
 #include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
 
 #include "lldb/Core/ValueObject.h"
 
 namespace lldb_private {
-    class TypeFormatImpl
-    {
-    public:
-        class Flags
-        {
-        public:
-            
-            Flags () :
-            m_flags (lldb::eTypeOptionCascade)
-            {}
-            
-            Flags (const Flags& other) :
-            m_flags (other.m_flags)
-            {}
-            
-            Flags (uint32_t value) :
-            m_flags (value)
-            {}
-            
-            Flags&
-            operator = (const Flags& rhs)
-            {
-                if (&rhs != this)
-                    m_flags = rhs.m_flags;
-                
-                return *this;
-            }
-            
-            Flags&
-            operator = (const uint32_t& rhs)
-            {
-                m_flags = rhs;
-                return *this;
-            }
-            
-            Flags&
-            Clear()
-            {
-                m_flags = 0;
-                return *this;
-            }
-            
-            bool
-            GetCascades () const
-            {
-                return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
-            }
-            
-            Flags&
-            SetCascades (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionCascade;
-                else
-                    m_flags &= ~lldb::eTypeOptionCascade;
-                return *this;
-            }
-            
-            bool
-            GetSkipPointers () const
-            {
-                return (m_flags & lldb::eTypeOptionSkipPointers) == lldb::eTypeOptionSkipPointers;
-            }
-            
-            Flags&
-            SetSkipPointers (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionSkipPointers;
-                else
-                    m_flags &= ~lldb::eTypeOptionSkipPointers;
-                return *this;
-            }
-            
-            bool
-            GetSkipReferences () const
-            {
-                return (m_flags & lldb::eTypeOptionSkipReferences) == lldb::eTypeOptionSkipReferences;
-            }
-            
-            Flags&
-            SetSkipReferences (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionSkipReferences;
-                else
-                    m_flags &= ~lldb::eTypeOptionSkipReferences;
-                return *this;
-            }
-            
-            bool
-            GetNonCacheable () const
-            {
-                return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable;
-            }
-            
-            Flags&
-            SetNonCacheable (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionNonCacheable;
-                else
-                    m_flags &= ~lldb::eTypeOptionNonCacheable;
-                return *this;
-            }
-            
-            uint32_t
-            GetValue ()
-            {
-                return m_flags;
-            }
-            
-            void
-            SetValue (uint32_t value)
-            {
-                m_flags = value;
-            }
-            
-        private:
-            uint32_t m_flags;
-        };
-        
-        TypeFormatImpl (const Flags& flags = Flags());
-        
-        typedef std::shared_ptr<TypeFormatImpl> SharedPointer;
-        
-        virtual ~TypeFormatImpl ();
-        
-        bool
-        Cascades () const
-        {
-            return m_flags.GetCascades();
-        }
-
-        bool
-        SkipsPointers () const
-        {
-            return m_flags.GetSkipPointers();
-        }
-
-        bool
-        SkipsReferences () const
-        {
-            return m_flags.GetSkipReferences();
-        }
-
-        bool
-        NonCacheable () const
-        {
-            return m_flags.GetNonCacheable();
-        }
-        
-        void
-        SetCascades (bool value)
-        {
-            m_flags.SetCascades(value);
-        }
-        
-        void
-        SetSkipsPointers (bool value)
-        {
-            m_flags.SetSkipPointers(value);
-        }
-        
-        void
-        SetSkipsReferences (bool value)
-        {
-            m_flags.SetSkipReferences(value);
-        }
-        
-        void
-        SetNonCacheable (bool value)
-        {
-            m_flags.SetNonCacheable(value);
-        }
-
-        uint32_t
-        GetOptions ()
-        {
-            return m_flags.GetValue();
-        }
-        
-        void
-        SetOptions (uint32_t value)
-        {
-            m_flags.SetValue(value);
-        }
-        
-        uint32_t&
-        GetRevision ()
-        {
-            return m_my_revision;
-        }
-        
-        enum class Type
-        {
-            eTypeUnknown,
-            eTypeFormat,
-            eTypeEnum
-        };
-        
-        virtual Type
-        GetType ()
-        {
-            return Type::eTypeUnknown;
-        }
-        
-        // we are using a ValueObject* instead of a ValueObjectSP because we do not need to hold on to this for
-        // extended periods of time and we trust the ValueObject to stay around for as long as it is required
-        // for us to generate its value
-        virtual bool
-        FormatObject (ValueObject *valobj,
-                      std::string& dest) const = 0;
-        
-        virtual std::string
-        GetDescription() = 0;
-        
-    protected:
-        Flags m_flags;
-        uint32_t m_my_revision;
-        
-    private:
-        DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl);
-    };
-    
-    class TypeFormatImpl_Format : public TypeFormatImpl
-    {
-    public:
-        TypeFormatImpl_Format (lldb::Format f = lldb::eFormatInvalid,
-                               const TypeFormatImpl::Flags& flags = Flags());
-        
-        typedef std::shared_ptr<TypeFormatImpl_Format> SharedPointer;
-        
-        ~TypeFormatImpl_Format() override;
-        
-        lldb::Format
-        GetFormat () const
-        {
-            return m_format;
-        }
-        
-        void
-        SetFormat (lldb::Format fmt)
-        {
-            m_format = fmt;
-        }
-        
-        TypeFormatImpl::Type
-        GetType() override
-        {
-            return TypeFormatImpl::Type::eTypeFormat;
-        }
-        
-        bool
-        FormatObject(ValueObject *valobj,
-		     std::string& dest) const override;
-        
-        std::string
-        GetDescription() override;
-        
-    protected:
-        lldb::Format m_format;
-        
-    private:
-        DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_Format);
-    };
-    
-    class TypeFormatImpl_EnumType : public TypeFormatImpl
-    {
-    public:
-        TypeFormatImpl_EnumType (ConstString type_name = ConstString(""),
-                                 const TypeFormatImpl::Flags& flags = Flags());
-        
-        typedef std::shared_ptr<TypeFormatImpl_EnumType> SharedPointer;
-        
-        ~TypeFormatImpl_EnumType() override;
-        
-        ConstString
-        GetTypeName ()
-        {
-            return m_enum_type;
-        }
-        
-        void
-        SetTypeName (ConstString enum_type)
-        {
-            m_enum_type = enum_type;
-        }
-        
-        TypeFormatImpl::Type
-        GetType() override
-        {
-            return TypeFormatImpl::Type::eTypeEnum;
-        }
-        
-        bool
-        FormatObject(ValueObject *valobj,
-		     std::string& dest) const override;
-        
-        std::string
-        GetDescription() override;
-        
-    protected:
-        ConstString m_enum_type;
-        mutable std::unordered_map<void*,CompilerType> m_types;
-        
-    private:
-        DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_EnumType);
-    };
+class TypeFormatImpl {
+public:
+  class Flags {
+  public:
+    Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+    Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+    Flags(uint32_t value) : m_flags(value) {}
+
+    Flags &operator=(const Flags &rhs) {
+      if (&rhs != this)
+        m_flags = rhs.m_flags;
+
+      return *this;
+    }
+
+    Flags &operator=(const uint32_t &rhs) {
+      m_flags = rhs;
+      return *this;
+    }
+
+    Flags &Clear() {
+      m_flags = 0;
+      return *this;
+    }
+
+    bool GetCascades() const {
+      return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+    }
+
+    Flags &SetCascades(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionCascade;
+      else
+        m_flags &= ~lldb::eTypeOptionCascade;
+      return *this;
+    }
+
+    bool GetSkipPointers() const {
+      return (m_flags & lldb::eTypeOptionSkipPointers) ==
+             lldb::eTypeOptionSkipPointers;
+    }
+
+    Flags &SetSkipPointers(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionSkipPointers;
+      else
+        m_flags &= ~lldb::eTypeOptionSkipPointers;
+      return *this;
+    }
+
+    bool GetSkipReferences() const {
+      return (m_flags & lldb::eTypeOptionSkipReferences) ==
+             lldb::eTypeOptionSkipReferences;
+    }
+
+    Flags &SetSkipReferences(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionSkipReferences;
+      else
+        m_flags &= ~lldb::eTypeOptionSkipReferences;
+      return *this;
+    }
+
+    bool GetNonCacheable() const {
+      return (m_flags & lldb::eTypeOptionNonCacheable) ==
+             lldb::eTypeOptionNonCacheable;
+    }
+
+    Flags &SetNonCacheable(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionNonCacheable;
+      else
+        m_flags &= ~lldb::eTypeOptionNonCacheable;
+      return *this;
+    }
+
+    uint32_t GetValue() { return m_flags; }
+
+    void SetValue(uint32_t value) { m_flags = value; }
+
+  private:
+    uint32_t m_flags;
+  };
+
+  TypeFormatImpl(const Flags &flags = Flags());
+
+  typedef std::shared_ptr<TypeFormatImpl> SharedPointer;
+
+  virtual ~TypeFormatImpl();
+
+  bool Cascades() const { return m_flags.GetCascades(); }
+
+  bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+
+  bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+
+  bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+  void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+  void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+  void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+  void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+  uint32_t GetOptions() { return m_flags.GetValue(); }
+
+  void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+  uint32_t &GetRevision() { return m_my_revision; }
+
+  enum class Type { eTypeUnknown, eTypeFormat, eTypeEnum };
+
+  virtual Type GetType() { return Type::eTypeUnknown; }
+
+  // we are using a ValueObject* instead of a ValueObjectSP because we do not
+  // need to hold on to this for
+  // extended periods of time and we trust the ValueObject to stay around for as
+  // long as it is required
+  // for us to generate its value
+  virtual bool FormatObject(ValueObject *valobj, std::string &dest) const = 0;
+
+  virtual std::string GetDescription() = 0;
+
+protected:
+  Flags m_flags;
+  uint32_t m_my_revision;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl);
+};
+
+class TypeFormatImpl_Format : public TypeFormatImpl {
+public:
+  TypeFormatImpl_Format(lldb::Format f = lldb::eFormatInvalid,
+                        const TypeFormatImpl::Flags &flags = Flags());
+
+  typedef std::shared_ptr<TypeFormatImpl_Format> SharedPointer;
+
+  ~TypeFormatImpl_Format() override;
+
+  lldb::Format GetFormat() const { return m_format; }
+
+  void SetFormat(lldb::Format fmt) { m_format = fmt; }
+
+  TypeFormatImpl::Type GetType() override {
+    return TypeFormatImpl::Type::eTypeFormat;
+  }
+
+  bool FormatObject(ValueObject *valobj, std::string &dest) const override;
+
+  std::string GetDescription() override;
+
+protected:
+  lldb::Format m_format;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_Format);
+};
+
+class TypeFormatImpl_EnumType : public TypeFormatImpl {
+public:
+  TypeFormatImpl_EnumType(ConstString type_name = ConstString(""),
+                          const TypeFormatImpl::Flags &flags = Flags());
+
+  typedef std::shared_ptr<TypeFormatImpl_EnumType> SharedPointer;
+
+  ~TypeFormatImpl_EnumType() override;
+
+  ConstString GetTypeName() { return m_enum_type; }
+
+  void SetTypeName(ConstString enum_type) { m_enum_type = enum_type; }
+
+  TypeFormatImpl::Type GetType() override {
+    return TypeFormatImpl::Type::eTypeEnum;
+  }
+
+  bool FormatObject(ValueObject *valobj, std::string &dest) const override;
+
+  std::string GetDescription() override;
+
+protected:
+  ConstString m_enum_type;
+  mutable std::unordered_map<void *, CompilerType> m_types;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_EnumType);
+};
 } // namespace lldb_private
 
 #endif // lldb_TypeFormat_h_

Modified: lldb/trunk/include/lldb/DataFormatters/TypeSummary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeSummary.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeSummary.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeSummary.h Tue Sep  6 15:57:50 2016
@@ -20,569 +20,384 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-public.h"
 #include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
 
 #include "lldb/Core/Error.h"
 #include "lldb/Core/FormatEntity.h"
 #include "lldb/Core/StructuredData.h"
 
 namespace lldb_private {
-    class TypeSummaryOptions
-    {
-    public:
-        TypeSummaryOptions ();
-        TypeSummaryOptions (const TypeSummaryOptions& rhs);
-        
-        ~TypeSummaryOptions() = default;
-
-        TypeSummaryOptions&
-        operator = (const TypeSummaryOptions& rhs);
-        
-        lldb::LanguageType
-        GetLanguage () const;
-        
-        lldb::TypeSummaryCapping
-        GetCapping () const;
-        
-        TypeSummaryOptions&
-        SetLanguage (lldb::LanguageType);
-        
-        TypeSummaryOptions&
-        SetCapping (lldb::TypeSummaryCapping);
-
-    private:
-        lldb::LanguageType m_lang;
-        lldb::TypeSummaryCapping m_capping;
-    };
-    
-    class TypeSummaryImpl
-    {
-    public:
-        enum class Kind
-        {
-            eSummaryString,
-            eScript,
-            eCallback,
-            eInternal
-        };
-
-        virtual
-        ~TypeSummaryImpl() = default;
-
-        Kind
-        GetKind () const
-        {
-            return m_kind;
-        }
-        
-        class Flags
-        {
-        public:
-            Flags () :
-            m_flags (lldb::eTypeOptionCascade)
-            {}
-            
-            Flags (const Flags& other) :
-            m_flags (other.m_flags)
-            {}
-            
-            Flags (uint32_t value) :
-            m_flags (value)
-            {}
-            
-            Flags&
-            operator = (const Flags& rhs)
-            {
-                if (&rhs != this)
-                    m_flags = rhs.m_flags;
-                
-                return *this;
-            }
-            
-            Flags&
-            operator = (const uint32_t& rhs)
-            {
-                m_flags = rhs;
-                return *this;
-            }
-            
-            Flags&
-            Clear()
-            {
-                m_flags = 0;
-                return *this;
-            }
-            
-            bool
-            GetCascades () const
-            {
-                return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
-            }
-            
-            Flags&
-            SetCascades (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionCascade;
-                else
-                    m_flags &= ~lldb::eTypeOptionCascade;
-                return *this;
-            }
-            
-            bool
-            GetSkipPointers () const
-            {
-                return (m_flags & lldb::eTypeOptionSkipPointers) == lldb::eTypeOptionSkipPointers;
-            }
-            
-            Flags&
-            SetSkipPointers (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionSkipPointers;
-                else
-                    m_flags &= ~lldb::eTypeOptionSkipPointers;
-                return *this;
-            }
-            
-            bool
-            GetSkipReferences () const
-            {
-                return (m_flags & lldb::eTypeOptionSkipReferences) == lldb::eTypeOptionSkipReferences;
-            }
-            
-            Flags&
-            SetSkipReferences (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionSkipReferences;
-                else
-                    m_flags &= ~lldb::eTypeOptionSkipReferences;
-                return *this;
-            }
-            
-            bool
-            GetDontShowChildren () const
-            {
-                return (m_flags & lldb::eTypeOptionHideChildren) == lldb::eTypeOptionHideChildren;
-            }
-            
-            Flags&
-            SetDontShowChildren (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionHideChildren;
-                else
-                    m_flags &= ~lldb::eTypeOptionHideChildren;
-                return *this;
-            }
-
-            bool
-            GetHideEmptyAggregates () const
-            {
-                return (m_flags & lldb::eTypeOptionHideEmptyAggregates) == lldb::eTypeOptionHideEmptyAggregates;
-            }
-
-            Flags&
-            SetHideEmptyAggregates (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionHideEmptyAggregates;
-                else
-                    m_flags &= ~lldb::eTypeOptionHideEmptyAggregates;
-                return *this;
-            }
-            
-            bool
-            GetDontShowValue () const
-            {
-                return (m_flags & lldb::eTypeOptionHideValue) == lldb::eTypeOptionHideValue;
-            }
-            
-            Flags&
-            SetDontShowValue (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionHideValue;
-                else
-                    m_flags &= ~lldb::eTypeOptionHideValue;
-                return *this;
-            }
-            
-            bool
-            GetShowMembersOneLiner () const
-            {
-                return (m_flags & lldb::eTypeOptionShowOneLiner) == lldb::eTypeOptionShowOneLiner;
-            }
-            
-            Flags&
-            SetShowMembersOneLiner (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionShowOneLiner;
-                else
-                    m_flags &= ~lldb::eTypeOptionShowOneLiner;
-                return *this;
-            }
-            
-            bool
-            GetHideItemNames () const
-            {
-                return (m_flags & lldb::eTypeOptionHideNames) == lldb::eTypeOptionHideNames;
-            }
-            
-            Flags&
-            SetHideItemNames (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionHideNames;
-                else
-                    m_flags &= ~lldb::eTypeOptionHideNames;
-                return *this;
-            }
-            
-            bool
-            GetNonCacheable () const
-            {
-                return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable;
-            }
-            
-            Flags&
-            SetNonCacheable (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionNonCacheable;
-                else
-                    m_flags &= ~lldb::eTypeOptionNonCacheable;
-                return *this;
-            }
-            
-            uint32_t
-            GetValue ()
-            {
-                return m_flags;
-            }
-            
-            void
-            SetValue (uint32_t value)
-            {
-                m_flags = value;
-            }
-            
-        private:
-            uint32_t m_flags;
-        };
-        
-        bool
-        Cascades () const
-        {
-            return m_flags.GetCascades();
-        }
-
-        bool
-        SkipsPointers () const
-        {
-            return m_flags.GetSkipPointers();
-        }
-
-        bool
-        SkipsReferences () const
-        {
-            return m_flags.GetSkipReferences();
-        }
-
-        bool
-        NonCacheable () const
-        {
-            return m_flags.GetNonCacheable();
-        }
-        
-        virtual bool
-        DoesPrintChildren (ValueObject* valobj) const
-        {
-            return !m_flags.GetDontShowChildren();
-        }
-
-        virtual bool
-        DoesPrintEmptyAggregates () const
-        {
-            return !m_flags.GetHideEmptyAggregates();
-        }
-        
-        virtual bool
-        DoesPrintValue (ValueObject* valobj) const
-        {
-            return !m_flags.GetDontShowValue();
-        }
-        
-        bool
-        IsOneLiner () const
-        {
-            return m_flags.GetShowMembersOneLiner();
-        }
-        
-        virtual bool
-        HideNames (ValueObject* valobj) const
-        {
-            return m_flags.GetHideItemNames();
-        }
-        
-        void
-        SetCascades (bool value)
-        {
-            m_flags.SetCascades(value);
-        }
-        
-        void
-        SetSkipsPointers (bool value)
-        {
-            m_flags.SetSkipPointers(value);
-        }
-        
-        void
-        SetSkipsReferences (bool value)
-        {
-            m_flags.SetSkipReferences(value);
-        }
-        
-        virtual void
-        SetDoesPrintChildren (bool value)
-        {
-            m_flags.SetDontShowChildren(!value);
-        }
-        
-        virtual void
-        SetDoesPrintValue (bool value)
-        {
-            m_flags.SetDontShowValue(!value);
-        }
-        
-        void
-        SetIsOneLiner (bool value)
-        {
-            m_flags.SetShowMembersOneLiner(value);
-        }
-        
-        virtual void
-        SetHideNames (bool value)
-        {
-            m_flags.SetHideItemNames(value);
-        }
-        
-        virtual void
-        SetNonCacheable (bool value)
-        {
-            m_flags.SetNonCacheable(value);
-        }
-        
-        uint32_t
-        GetOptions ()
-        {
-            return m_flags.GetValue();
-        }
-        
-        void
-        SetOptions (uint32_t value)
-        {
-            m_flags.SetValue(value);
-        }
-        
-        // we are using a ValueObject* instead of a ValueObjectSP because we do not need to hold on to this for
-        // extended periods of time and we trust the ValueObject to stay around for as long as it is required
-        // for us to generate its summary
-        virtual bool
-        FormatObject (ValueObject *valobj,
-                      std::string& dest,
-                      const TypeSummaryOptions& options) = 0;
-        
-        virtual std::string
-        GetDescription () = 0;
-        
-        uint32_t&
-        GetRevision ()
-        {
-            return m_my_revision;
-        }
-        
-        typedef std::shared_ptr<TypeSummaryImpl> SharedPointer;
-        
-    protected:
-        uint32_t m_my_revision;
-        Flags m_flags;
-        
-        TypeSummaryImpl (Kind kind,
-                         const TypeSummaryImpl::Flags& flags);
-        
-    private:
-        Kind m_kind;
-        DISALLOW_COPY_AND_ASSIGN(TypeSummaryImpl);
-    };
-    
-    // simple string-based summaries, using ${var to show data
-    struct StringSummaryFormat : public TypeSummaryImpl
-    {
-        std::string m_format_str;
-        FormatEntity::Entry m_format;
-        Error m_error;
-        
-        StringSummaryFormat(const TypeSummaryImpl::Flags& flags,
-                            const char* f);
-
-        ~StringSummaryFormat() override = default;
-
-        const char*
-        GetSummaryString () const
-        {
-            return m_format_str.c_str();
-        }
-        
-        void
-        SetSummaryString (const char* f);
-
-        bool
-        FormatObject(ValueObject *valobj,
-                     std::string& dest,
-                     const TypeSummaryOptions& options) override;
-        
-        std::string
-        GetDescription() override;
-        
-        static bool classof(const TypeSummaryImpl* S)
-        {
-            return S->GetKind() == Kind::eSummaryString;
-        }
-        
-    private:
-        DISALLOW_COPY_AND_ASSIGN(StringSummaryFormat);
-    };
-    
-    // summaries implemented via a C++ function
-    struct CXXFunctionSummaryFormat : public TypeSummaryImpl
-    {
-        // we should convert these to SBValue and SBStream if we ever cross
-        // the boundary towards the external world
-        typedef std::function<bool(ValueObject&,
-                                   Stream&,
-                                   const TypeSummaryOptions&)> Callback;
-        
-        Callback m_impl;
-        std::string m_description;
-        
-        CXXFunctionSummaryFormat (const TypeSummaryImpl::Flags& flags,
-                                  Callback impl,
-                                  const char* description);
-
-        ~CXXFunctionSummaryFormat() override = default;
-
-        Callback
-        GetBackendFunction () const
-        {
-            return m_impl;
-        }
-        
-        const char*
-        GetTextualInfo () const
-        {
-            return m_description.c_str();
-        }
-        
-        void
-        SetBackendFunction (Callback cb_func)
-        {
-            m_impl = cb_func;
-        }
-        
-        void
-        SetTextualInfo (const char* descr)
-        {
-            if (descr)
-                m_description.assign(descr);
-            else
-                m_description.clear();
-        }
-
-        bool
-        FormatObject(ValueObject *valobj,
-		     std::string& dest,
-		     const TypeSummaryOptions& options) override;
-        
-        std::string
-        GetDescription() override;
-        
-        static bool classof(const TypeSummaryImpl* S)
-        {
-            return S->GetKind() == Kind::eCallback;
-        }
-        
-        typedef std::shared_ptr<CXXFunctionSummaryFormat> SharedPointer;
-        
-    private:
-        DISALLOW_COPY_AND_ASSIGN(CXXFunctionSummaryFormat);
-    };
-    
-    // Python-based summaries, running script code to show data
-    struct ScriptSummaryFormat : public TypeSummaryImpl
-    {
-        std::string m_function_name;
-        std::string m_python_script;
-        StructuredData::ObjectSP m_script_function_sp;
-
-        ScriptSummaryFormat(const TypeSummaryImpl::Flags& flags,
-                            const char *function_name,
-                            const char* python_script = nullptr);
-
-        ~ScriptSummaryFormat() override = default;
-
-        const char*
-        GetFunctionName () const
-        {
-            return m_function_name.c_str();
-        }
-        
-        const char*
-        GetPythonScript () const
-        {
-            return m_python_script.c_str();
-        }
-        
-        void
-        SetFunctionName (const char* function_name)
-        {
-            if (function_name)
-                m_function_name.assign(function_name);
-            else
-                m_function_name.clear();
-            m_python_script.clear();
-        }
-        
-        void
-        SetPythonScript (const char* script)
-        {
-            if (script)
-                m_python_script.assign(script);
-            else
-                m_python_script.clear();
-        }
-        
-        bool
-        FormatObject(ValueObject *valobj,
-		     std::string& dest,
-		     const TypeSummaryOptions& options) override;
-        
-        std::string
-        GetDescription() override;
-        
-        static bool classof(const TypeSummaryImpl* S)
-        {
-            return S->GetKind() == Kind::eScript;
-        }
-        
-        typedef std::shared_ptr<ScriptSummaryFormat> SharedPointer;
-        
-    private:
-        DISALLOW_COPY_AND_ASSIGN(ScriptSummaryFormat);
-    };
+class TypeSummaryOptions {
+public:
+  TypeSummaryOptions();
+  TypeSummaryOptions(const TypeSummaryOptions &rhs);
+
+  ~TypeSummaryOptions() = default;
+
+  TypeSummaryOptions &operator=(const TypeSummaryOptions &rhs);
+
+  lldb::LanguageType GetLanguage() const;
+
+  lldb::TypeSummaryCapping GetCapping() const;
+
+  TypeSummaryOptions &SetLanguage(lldb::LanguageType);
+
+  TypeSummaryOptions &SetCapping(lldb::TypeSummaryCapping);
+
+private:
+  lldb::LanguageType m_lang;
+  lldb::TypeSummaryCapping m_capping;
+};
+
+class TypeSummaryImpl {
+public:
+  enum class Kind { eSummaryString, eScript, eCallback, eInternal };
+
+  virtual ~TypeSummaryImpl() = default;
+
+  Kind GetKind() const { return m_kind; }
+
+  class Flags {
+  public:
+    Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+    Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+    Flags(uint32_t value) : m_flags(value) {}
+
+    Flags &operator=(const Flags &rhs) {
+      if (&rhs != this)
+        m_flags = rhs.m_flags;
+
+      return *this;
+    }
+
+    Flags &operator=(const uint32_t &rhs) {
+      m_flags = rhs;
+      return *this;
+    }
+
+    Flags &Clear() {
+      m_flags = 0;
+      return *this;
+    }
+
+    bool GetCascades() const {
+      return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+    }
+
+    Flags &SetCascades(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionCascade;
+      else
+        m_flags &= ~lldb::eTypeOptionCascade;
+      return *this;
+    }
+
+    bool GetSkipPointers() const {
+      return (m_flags & lldb::eTypeOptionSkipPointers) ==
+             lldb::eTypeOptionSkipPointers;
+    }
+
+    Flags &SetSkipPointers(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionSkipPointers;
+      else
+        m_flags &= ~lldb::eTypeOptionSkipPointers;
+      return *this;
+    }
+
+    bool GetSkipReferences() const {
+      return (m_flags & lldb::eTypeOptionSkipReferences) ==
+             lldb::eTypeOptionSkipReferences;
+    }
+
+    Flags &SetSkipReferences(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionSkipReferences;
+      else
+        m_flags &= ~lldb::eTypeOptionSkipReferences;
+      return *this;
+    }
+
+    bool GetDontShowChildren() const {
+      return (m_flags & lldb::eTypeOptionHideChildren) ==
+             lldb::eTypeOptionHideChildren;
+    }
+
+    Flags &SetDontShowChildren(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionHideChildren;
+      else
+        m_flags &= ~lldb::eTypeOptionHideChildren;
+      return *this;
+    }
+
+    bool GetHideEmptyAggregates() const {
+      return (m_flags & lldb::eTypeOptionHideEmptyAggregates) ==
+             lldb::eTypeOptionHideEmptyAggregates;
+    }
+
+    Flags &SetHideEmptyAggregates(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionHideEmptyAggregates;
+      else
+        m_flags &= ~lldb::eTypeOptionHideEmptyAggregates;
+      return *this;
+    }
+
+    bool GetDontShowValue() const {
+      return (m_flags & lldb::eTypeOptionHideValue) ==
+             lldb::eTypeOptionHideValue;
+    }
+
+    Flags &SetDontShowValue(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionHideValue;
+      else
+        m_flags &= ~lldb::eTypeOptionHideValue;
+      return *this;
+    }
+
+    bool GetShowMembersOneLiner() const {
+      return (m_flags & lldb::eTypeOptionShowOneLiner) ==
+             lldb::eTypeOptionShowOneLiner;
+    }
+
+    Flags &SetShowMembersOneLiner(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionShowOneLiner;
+      else
+        m_flags &= ~lldb::eTypeOptionShowOneLiner;
+      return *this;
+    }
+
+    bool GetHideItemNames() const {
+      return (m_flags & lldb::eTypeOptionHideNames) ==
+             lldb::eTypeOptionHideNames;
+    }
+
+    Flags &SetHideItemNames(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionHideNames;
+      else
+        m_flags &= ~lldb::eTypeOptionHideNames;
+      return *this;
+    }
+
+    bool GetNonCacheable() const {
+      return (m_flags & lldb::eTypeOptionNonCacheable) ==
+             lldb::eTypeOptionNonCacheable;
+    }
+
+    Flags &SetNonCacheable(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionNonCacheable;
+      else
+        m_flags &= ~lldb::eTypeOptionNonCacheable;
+      return *this;
+    }
+
+    uint32_t GetValue() { return m_flags; }
+
+    void SetValue(uint32_t value) { m_flags = value; }
+
+  private:
+    uint32_t m_flags;
+  };
+
+  bool Cascades() const { return m_flags.GetCascades(); }
+
+  bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+
+  bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+
+  bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+  virtual bool DoesPrintChildren(ValueObject *valobj) const {
+    return !m_flags.GetDontShowChildren();
+  }
+
+  virtual bool DoesPrintEmptyAggregates() const {
+    return !m_flags.GetHideEmptyAggregates();
+  }
+
+  virtual bool DoesPrintValue(ValueObject *valobj) const {
+    return !m_flags.GetDontShowValue();
+  }
+
+  bool IsOneLiner() const { return m_flags.GetShowMembersOneLiner(); }
+
+  virtual bool HideNames(ValueObject *valobj) const {
+    return m_flags.GetHideItemNames();
+  }
+
+  void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+  void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+  void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+  virtual void SetDoesPrintChildren(bool value) {
+    m_flags.SetDontShowChildren(!value);
+  }
+
+  virtual void SetDoesPrintValue(bool value) {
+    m_flags.SetDontShowValue(!value);
+  }
+
+  void SetIsOneLiner(bool value) { m_flags.SetShowMembersOneLiner(value); }
+
+  virtual void SetHideNames(bool value) { m_flags.SetHideItemNames(value); }
+
+  virtual void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+  uint32_t GetOptions() { return m_flags.GetValue(); }
+
+  void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+  // we are using a ValueObject* instead of a ValueObjectSP because we do not
+  // need to hold on to this for
+  // extended periods of time and we trust the ValueObject to stay around for as
+  // long as it is required
+  // for us to generate its summary
+  virtual bool FormatObject(ValueObject *valobj, std::string &dest,
+                            const TypeSummaryOptions &options) = 0;
+
+  virtual std::string GetDescription() = 0;
+
+  uint32_t &GetRevision() { return m_my_revision; }
+
+  typedef std::shared_ptr<TypeSummaryImpl> SharedPointer;
+
+protected:
+  uint32_t m_my_revision;
+  Flags m_flags;
+
+  TypeSummaryImpl(Kind kind, const TypeSummaryImpl::Flags &flags);
+
+private:
+  Kind m_kind;
+  DISALLOW_COPY_AND_ASSIGN(TypeSummaryImpl);
+};
+
+// simple string-based summaries, using ${var to show data
+struct StringSummaryFormat : public TypeSummaryImpl {
+  std::string m_format_str;
+  FormatEntity::Entry m_format;
+  Error m_error;
+
+  StringSummaryFormat(const TypeSummaryImpl::Flags &flags, const char *f);
+
+  ~StringSummaryFormat() override = default;
+
+  const char *GetSummaryString() const { return m_format_str.c_str(); }
+
+  void SetSummaryString(const char *f);
+
+  bool FormatObject(ValueObject *valobj, std::string &dest,
+                    const TypeSummaryOptions &options) override;
+
+  std::string GetDescription() override;
+
+  static bool classof(const TypeSummaryImpl *S) {
+    return S->GetKind() == Kind::eSummaryString;
+  }
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(StringSummaryFormat);
+};
+
+// summaries implemented via a C++ function
+struct CXXFunctionSummaryFormat : public TypeSummaryImpl {
+  // we should convert these to SBValue and SBStream if we ever cross
+  // the boundary towards the external world
+  typedef std::function<bool(ValueObject &, Stream &,
+                             const TypeSummaryOptions &)>
+      Callback;
+
+  Callback m_impl;
+  std::string m_description;
+
+  CXXFunctionSummaryFormat(const TypeSummaryImpl::Flags &flags, Callback impl,
+                           const char *description);
+
+  ~CXXFunctionSummaryFormat() override = default;
+
+  Callback GetBackendFunction() const { return m_impl; }
+
+  const char *GetTextualInfo() const { return m_description.c_str(); }
+
+  void SetBackendFunction(Callback cb_func) { m_impl = cb_func; }
+
+  void SetTextualInfo(const char *descr) {
+    if (descr)
+      m_description.assign(descr);
+    else
+      m_description.clear();
+  }
+
+  bool FormatObject(ValueObject *valobj, std::string &dest,
+                    const TypeSummaryOptions &options) override;
+
+  std::string GetDescription() override;
+
+  static bool classof(const TypeSummaryImpl *S) {
+    return S->GetKind() == Kind::eCallback;
+  }
+
+  typedef std::shared_ptr<CXXFunctionSummaryFormat> SharedPointer;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(CXXFunctionSummaryFormat);
+};
+
+// Python-based summaries, running script code to show data
+struct ScriptSummaryFormat : public TypeSummaryImpl {
+  std::string m_function_name;
+  std::string m_python_script;
+  StructuredData::ObjectSP m_script_function_sp;
+
+  ScriptSummaryFormat(const TypeSummaryImpl::Flags &flags,
+                      const char *function_name,
+                      const char *python_script = nullptr);
+
+  ~ScriptSummaryFormat() override = default;
+
+  const char *GetFunctionName() const { return m_function_name.c_str(); }
+
+  const char *GetPythonScript() const { return m_python_script.c_str(); }
+
+  void SetFunctionName(const char *function_name) {
+    if (function_name)
+      m_function_name.assign(function_name);
+    else
+      m_function_name.clear();
+    m_python_script.clear();
+  }
+
+  void SetPythonScript(const char *script) {
+    if (script)
+      m_python_script.assign(script);
+    else
+      m_python_script.clear();
+  }
+
+  bool FormatObject(ValueObject *valobj, std::string &dest,
+                    const TypeSummaryOptions &options) override;
+
+  std::string GetDescription() override;
+
+  static bool classof(const TypeSummaryImpl *S) {
+    return S->GetKind() == Kind::eScript;
+  }
+
+  typedef std::shared_ptr<ScriptSummaryFormat> SharedPointer;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(ScriptSummaryFormat);
+};
 } // namespace lldb_private
 
 #endif // lldb_TypeSummary_h_

Modified: lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h Tue Sep  6 15:57:50 2016
@@ -14,629 +14,438 @@
 #include <stdint.h>
 
 // C++ Includes
-#include <initializer_list>
 #include <functional>
+#include <initializer_list>
 #include <memory>
 #include <string>
 #include <vector>
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-public.h"
 #include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
 
 #include "lldb/Core/StructuredData.h"
 #include "lldb/Core/ValueObject.h"
 
 namespace lldb_private {
-    class SyntheticChildrenFrontEnd
-    {
-    protected:
-        ValueObject &m_backend;
-        
-        void
-        SetValid (bool valid)
-        {
-            m_valid = valid;
-        }
-        
-        bool
-        IsValid ()
-        {
-            return m_valid;
-        }
-        
-    public:
-        SyntheticChildrenFrontEnd (ValueObject &backend) :
-        m_backend(backend),
-        m_valid(true)
-        {}
-
-        virtual
-        ~SyntheticChildrenFrontEnd() = default;
-
-        virtual size_t
-        CalculateNumChildren () = 0;
-
-        virtual size_t
-        CalculateNumChildren (uint32_t max)
-        {
-            auto count = CalculateNumChildren ();
-            return count <= max ? count : max;
-        }
-        
-        virtual lldb::ValueObjectSP
-        GetChildAtIndex (size_t idx) = 0;
-
-        virtual size_t
-        GetIndexOfChildWithName (const ConstString &name) = 0;
-        
-        // this function is assumed to always succeed and it if fails, the front-end should know to deal
-        // with it in the correct way (most probably, by refusing to return any children)
-        // the return value of Update() should actually be interpreted as "ValueObjectSyntheticFilter cache is good/bad"
-        // if =true, ValueObjectSyntheticFilter is allowed to use the children it fetched previously and cached
-        // if =false, ValueObjectSyntheticFilter must throw away its cache, and query again for children
-        virtual bool
-        Update () = 0;
-        
-        // if this function returns false, then CalculateNumChildren() MUST return 0 since UI frontends
-        // might validly decide not to inquire for children given a false return value from this call
-        // if it returns true, then CalculateNumChildren() can return any number >= 0 (0 being valid)
-        // it should if at all possible be more efficient than CalculateNumChildren()
-        virtual bool
-        MightHaveChildren () = 0;
-        
-        // if this function returns a non-null ValueObject, then the returned ValueObject will stand
-        // for this ValueObject whenever a "value" request is made to this ValueObject
-        virtual lldb::ValueObjectSP
-        GetSyntheticValue () { return nullptr; }
-        
-        // if this function returns a non-empty ConstString, then clients are expected to use the return
-        // as the name of the type of this ValueObject for display purposes
-        virtual ConstString
-        GetSyntheticTypeName () { return ConstString(); }
-        
-        typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
-        typedef std::unique_ptr<SyntheticChildrenFrontEnd> AutoPointer;
-        
-    protected:
-        lldb::ValueObjectSP
-        CreateValueObjectFromExpression (const char* name,
-                                         const char* expression,
-                                         const ExecutionContext& exe_ctx);
-        
-        lldb::ValueObjectSP
-        CreateValueObjectFromAddress (const char* name,
-                                      uint64_t address,
-                                      const ExecutionContext& exe_ctx,
-                                      CompilerType type);
-        
-        lldb::ValueObjectSP
-        CreateValueObjectFromData (const char* name,
-                                   const DataExtractor& data,
-                                   const ExecutionContext& exe_ctx,
-                                   CompilerType type);
-        
-    private:
-        bool m_valid;
-        DISALLOW_COPY_AND_ASSIGN(SyntheticChildrenFrontEnd);
-    };
-    
-    class SyntheticValueProviderFrontEnd : public SyntheticChildrenFrontEnd
-    {
-    public:
-        SyntheticValueProviderFrontEnd (ValueObject &backend) :
-        SyntheticChildrenFrontEnd(backend)
-        {}
-
-        ~SyntheticValueProviderFrontEnd() override = default;
-
-        size_t
-        CalculateNumChildren() override { return 0; }
-        
-        lldb::ValueObjectSP
-        GetChildAtIndex(size_t idx) override { return nullptr; }
-        
-        size_t
-        GetIndexOfChildWithName(const ConstString &name) override { return UINT32_MAX; }
-        
-        bool
-        Update() override { return false; }
-        
-        bool
-        MightHaveChildren () override { return false; }
-        
-        lldb::ValueObjectSP
-        GetSyntheticValue() override = 0;
-        
-    private:
-        DISALLOW_COPY_AND_ASSIGN(SyntheticValueProviderFrontEnd);
-    };
-    
-    class SyntheticChildren
-    {
-    public:
-        class Flags
-        {
-        public:
-            
-            Flags () :
-            m_flags (lldb::eTypeOptionCascade)
-            {}
-            
-            Flags (const Flags& other) :
-            m_flags (other.m_flags)
-            {}
-            
-            Flags (uint32_t value) :
-            m_flags (value)
-            {}
-            
-            Flags&
-            operator = (const Flags& rhs)
-            {
-                if (&rhs != this)
-                    m_flags = rhs.m_flags;
-                
-                return *this;
-            }
-            
-            Flags&
-            operator = (const uint32_t& rhs)
-            {
-                m_flags = rhs;
-                return *this;
-            }
-            
-            Flags&
-            Clear()
-            {
-                m_flags = 0;
-                return *this;
-            }
-            
-            bool
-            GetCascades () const
-            {
-                return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
-            }
-            
-            Flags&
-            SetCascades (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionCascade;
-                else
-                    m_flags &= ~lldb::eTypeOptionCascade;
-                return *this;
-            }
-            
-            bool
-            GetSkipPointers () const
-            {
-                return (m_flags & lldb::eTypeOptionSkipPointers) == lldb::eTypeOptionSkipPointers;
-            }
-            
-            Flags&
-            SetSkipPointers (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionSkipPointers;
-                else
-                    m_flags &= ~lldb::eTypeOptionSkipPointers;
-                return *this;
-            }
-            
-            bool
-            GetSkipReferences () const
-            {
-                return (m_flags & lldb::eTypeOptionSkipReferences) == lldb::eTypeOptionSkipReferences;
-            }
-            
-            Flags&
-            SetSkipReferences (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionSkipReferences;
-                else
-                    m_flags &= ~lldb::eTypeOptionSkipReferences;
-                return *this;
-            }
-            
-            bool
-            GetNonCacheable () const
-            {
-                return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable;
-            }
-            
-            Flags&
-            SetNonCacheable (bool value = true)
-            {
-                if (value)
-                    m_flags |= lldb::eTypeOptionNonCacheable;
-                else
-                    m_flags &= ~lldb::eTypeOptionNonCacheable;
-                return *this;
-            }
-            
-            uint32_t
-            GetValue ()
-            {
-                return m_flags;
-            }
-            
-            void
-            SetValue (uint32_t value)
-            {
-                m_flags = value;
-            }
-            
-        private:
-            uint32_t m_flags;
-        };
-        
-        SyntheticChildren (const Flags& flags) :
-        m_flags(flags)
-        {
-        }
-
-        virtual
-        ~SyntheticChildren() = default;
-
-        bool
-        Cascades () const
-        {
-            return m_flags.GetCascades();
-        }
-
-        bool
-        SkipsPointers () const
-        {
-            return m_flags.GetSkipPointers();
-        }
-
-        bool
-        SkipsReferences () const
-        {
-            return m_flags.GetSkipReferences();
-        }
-
-        bool
-        NonCacheable () const
-        {
-            return m_flags.GetNonCacheable();
-        }
-        
-        void
-        SetCascades (bool value)
-        {
-            m_flags.SetCascades(value);
-        }
-        
-        void
-        SetSkipsPointers (bool value)
-        {
-            m_flags.SetSkipPointers(value);
-        }
-        
-        void
-        SetSkipsReferences (bool value)
-        {
-            m_flags.SetSkipReferences(value);
-        }
-        
-        void
-        SetNonCacheable (bool value)
-        {
-            m_flags.SetNonCacheable(value);
-        }
-        
-        uint32_t
-        GetOptions ()
-        {
-            return m_flags.GetValue();
-        }
-        
-        void
-        SetOptions (uint32_t value)
-        {
-            m_flags.SetValue(value);
-        }
-        
-        virtual bool
-        IsScripted () = 0;
-        
-        virtual std::string
-        GetDescription () = 0;
-        
-        virtual SyntheticChildrenFrontEnd::AutoPointer
-        GetFrontEnd (ValueObject &backend) = 0;
-        
-        typedef std::shared_ptr<SyntheticChildren> SharedPointer;
-        
-        uint32_t&
-        GetRevision ()
-        {
-            return m_my_revision;
-        }
-        
-    protected:
-        uint32_t m_my_revision;
-        Flags m_flags;
-        
-    private:
-        DISALLOW_COPY_AND_ASSIGN(SyntheticChildren);
-    };
-    
-    class TypeFilterImpl : public SyntheticChildren
-    {
-        std::vector<std::string> m_expression_paths;
-    public:
-        TypeFilterImpl(const SyntheticChildren::Flags& flags) :
-        SyntheticChildren(flags),
-        m_expression_paths()
-        {
-        }
-
-        TypeFilterImpl(const SyntheticChildren::Flags& flags,
-                       const std::initializer_list<const char*> items) :
-        SyntheticChildren(flags),
-        m_expression_paths()
-        {
-            for (auto path : items)
-                AddExpressionPath (path);
-        }
-        
-        void
-        AddExpressionPath (const char* path)
-        {
-            AddExpressionPath(std::string(path));
-        }
-        
-        void
-        Clear()
-        {
-            m_expression_paths.clear();
-        }
-        
-        size_t
-        GetCount() const
-        {
-            return m_expression_paths.size();
-        }
-        
-        const char*
-        GetExpressionPathAtIndex(size_t i) const
-        {
-            return m_expression_paths[i].c_str();
-        }
-        
-        bool
-        SetExpressionPathAtIndex (size_t i, const char* path)
-        {
-            return SetExpressionPathAtIndex(i, std::string(path));
-        }
-        
-        void
-        AddExpressionPath (const std::string& path);
-        
-        bool
-        SetExpressionPathAtIndex (size_t i, const std::string& path);
-        
-        bool
-        IsScripted() override
-        {
-            return false;
-        }
-        
-        std::string
-        GetDescription() override;
-        
-        class FrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            FrontEnd(TypeFilterImpl* flt,
-                     ValueObject &backend) :
-            SyntheticChildrenFrontEnd(backend),
-            filter(flt)
-            {}
-
-            ~FrontEnd() override = default;
-
-            size_t
-            CalculateNumChildren() override
-            {
-                return filter->GetCount();
-            }
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override
-            {
-                if (idx >= filter->GetCount())
-                    return lldb::ValueObjectSP();
-                return m_backend.GetSyntheticExpressionPathChild(filter->GetExpressionPathAtIndex(idx), true);
-            }
-
-            bool
-            Update() override { return false; }
-            
-            bool
-            MightHaveChildren() override
-            {
-                return filter->GetCount() > 0;
-            }
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-            
-            typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
-            
-        private:
-            TypeFilterImpl* filter;
-
-            DISALLOW_COPY_AND_ASSIGN(FrontEnd);
-        };
-        
-        SyntheticChildrenFrontEnd::AutoPointer
-        GetFrontEnd(ValueObject &backend) override
-        {
-            return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(this, backend));
-        }
-        
-        typedef std::shared_ptr<TypeFilterImpl> SharedPointer;
-        
-    private:
-        DISALLOW_COPY_AND_ASSIGN(TypeFilterImpl);
-    };
-    
-    class CXXSyntheticChildren : public SyntheticChildren
-    {
-    public:
-        typedef std::function<SyntheticChildrenFrontEnd*(CXXSyntheticChildren*, lldb::ValueObjectSP)> CreateFrontEndCallback;
-        CXXSyntheticChildren (const SyntheticChildren::Flags& flags,
-                              const char* description,
-                              CreateFrontEndCallback callback) :
-        SyntheticChildren(flags),
-        m_create_callback(callback),
-        m_description(description ? description : "")
-        {
-        }
-        
-        bool
-        IsScripted() override
-        {
-            return false;
-        }
-        
-        std::string
-        GetDescription() override;
-        
-        SyntheticChildrenFrontEnd::AutoPointer
-        GetFrontEnd(ValueObject &backend) override
-        {
-            return SyntheticChildrenFrontEnd::AutoPointer(m_create_callback(this, backend.GetSP()));
-        }
-        
-    protected:
-        CreateFrontEndCallback m_create_callback;
-        std::string m_description;
-
-    private:
-        DISALLOW_COPY_AND_ASSIGN(CXXSyntheticChildren);
-    };
-    
+class SyntheticChildrenFrontEnd {
+protected:
+  ValueObject &m_backend;
+
+  void SetValid(bool valid) { m_valid = valid; }
+
+  bool IsValid() { return m_valid; }
+
+public:
+  SyntheticChildrenFrontEnd(ValueObject &backend)
+      : m_backend(backend), m_valid(true) {}
+
+  virtual ~SyntheticChildrenFrontEnd() = default;
+
+  virtual size_t CalculateNumChildren() = 0;
+
+  virtual size_t CalculateNumChildren(uint32_t max) {
+    auto count = CalculateNumChildren();
+    return count <= max ? count : max;
+  }
+
+  virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx) = 0;
+
+  virtual size_t GetIndexOfChildWithName(const ConstString &name) = 0;
+
+  // this function is assumed to always succeed and it if fails, the front-end
+  // should know to deal
+  // with it in the correct way (most probably, by refusing to return any
+  // children)
+  // the return value of Update() should actually be interpreted as
+  // "ValueObjectSyntheticFilter cache is good/bad"
+  // if =true, ValueObjectSyntheticFilter is allowed to use the children it
+  // fetched previously and cached
+  // if =false, ValueObjectSyntheticFilter must throw away its cache, and query
+  // again for children
+  virtual bool Update() = 0;
+
+  // if this function returns false, then CalculateNumChildren() MUST return 0
+  // since UI frontends
+  // might validly decide not to inquire for children given a false return value
+  // from this call
+  // if it returns true, then CalculateNumChildren() can return any number >= 0
+  // (0 being valid)
+  // it should if at all possible be more efficient than CalculateNumChildren()
+  virtual bool MightHaveChildren() = 0;
+
+  // if this function returns a non-null ValueObject, then the returned
+  // ValueObject will stand
+  // for this ValueObject whenever a "value" request is made to this ValueObject
+  virtual lldb::ValueObjectSP GetSyntheticValue() { return nullptr; }
+
+  // if this function returns a non-empty ConstString, then clients are expected
+  // to use the return
+  // as the name of the type of this ValueObject for display purposes
+  virtual ConstString GetSyntheticTypeName() { return ConstString(); }
+
+  typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
+  typedef std::unique_ptr<SyntheticChildrenFrontEnd> AutoPointer;
+
+protected:
+  lldb::ValueObjectSP
+  CreateValueObjectFromExpression(const char *name, const char *expression,
+                                  const ExecutionContext &exe_ctx);
+
+  lldb::ValueObjectSP
+  CreateValueObjectFromAddress(const char *name, uint64_t address,
+                               const ExecutionContext &exe_ctx,
+                               CompilerType type);
+
+  lldb::ValueObjectSP CreateValueObjectFromData(const char *name,
+                                                const DataExtractor &data,
+                                                const ExecutionContext &exe_ctx,
+                                                CompilerType type);
+
+private:
+  bool m_valid;
+  DISALLOW_COPY_AND_ASSIGN(SyntheticChildrenFrontEnd);
+};
+
+class SyntheticValueProviderFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  SyntheticValueProviderFrontEnd(ValueObject &backend)
+      : SyntheticChildrenFrontEnd(backend) {}
+
+  ~SyntheticValueProviderFrontEnd() override = default;
+
+  size_t CalculateNumChildren() override { return 0; }
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override { return nullptr; }
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override {
+    return UINT32_MAX;
+  }
+
+  bool Update() override { return false; }
+
+  bool MightHaveChildren() override { return false; }
+
+  lldb::ValueObjectSP GetSyntheticValue() override = 0;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(SyntheticValueProviderFrontEnd);
+};
+
+class SyntheticChildren {
+public:
+  class Flags {
+  public:
+    Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+    Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+    Flags(uint32_t value) : m_flags(value) {}
+
+    Flags &operator=(const Flags &rhs) {
+      if (&rhs != this)
+        m_flags = rhs.m_flags;
+
+      return *this;
+    }
+
+    Flags &operator=(const uint32_t &rhs) {
+      m_flags = rhs;
+      return *this;
+    }
+
+    Flags &Clear() {
+      m_flags = 0;
+      return *this;
+    }
+
+    bool GetCascades() const {
+      return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+    }
+
+    Flags &SetCascades(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionCascade;
+      else
+        m_flags &= ~lldb::eTypeOptionCascade;
+      return *this;
+    }
+
+    bool GetSkipPointers() const {
+      return (m_flags & lldb::eTypeOptionSkipPointers) ==
+             lldb::eTypeOptionSkipPointers;
+    }
+
+    Flags &SetSkipPointers(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionSkipPointers;
+      else
+        m_flags &= ~lldb::eTypeOptionSkipPointers;
+      return *this;
+    }
+
+    bool GetSkipReferences() const {
+      return (m_flags & lldb::eTypeOptionSkipReferences) ==
+             lldb::eTypeOptionSkipReferences;
+    }
+
+    Flags &SetSkipReferences(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionSkipReferences;
+      else
+        m_flags &= ~lldb::eTypeOptionSkipReferences;
+      return *this;
+    }
+
+    bool GetNonCacheable() const {
+      return (m_flags & lldb::eTypeOptionNonCacheable) ==
+             lldb::eTypeOptionNonCacheable;
+    }
+
+    Flags &SetNonCacheable(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionNonCacheable;
+      else
+        m_flags &= ~lldb::eTypeOptionNonCacheable;
+      return *this;
+    }
+
+    uint32_t GetValue() { return m_flags; }
+
+    void SetValue(uint32_t value) { m_flags = value; }
+
+  private:
+    uint32_t m_flags;
+  };
+
+  SyntheticChildren(const Flags &flags) : m_flags(flags) {}
+
+  virtual ~SyntheticChildren() = default;
+
+  bool Cascades() const { return m_flags.GetCascades(); }
+
+  bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+
+  bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+
+  bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+  void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+  void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+  void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+  void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+  uint32_t GetOptions() { return m_flags.GetValue(); }
+
+  void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+  virtual bool IsScripted() = 0;
+
+  virtual std::string GetDescription() = 0;
+
+  virtual SyntheticChildrenFrontEnd::AutoPointer
+  GetFrontEnd(ValueObject &backend) = 0;
+
+  typedef std::shared_ptr<SyntheticChildren> SharedPointer;
+
+  uint32_t &GetRevision() { return m_my_revision; }
+
+protected:
+  uint32_t m_my_revision;
+  Flags m_flags;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(SyntheticChildren);
+};
+
+class TypeFilterImpl : public SyntheticChildren {
+  std::vector<std::string> m_expression_paths;
+
+public:
+  TypeFilterImpl(const SyntheticChildren::Flags &flags)
+      : SyntheticChildren(flags), m_expression_paths() {}
+
+  TypeFilterImpl(const SyntheticChildren::Flags &flags,
+                 const std::initializer_list<const char *> items)
+      : SyntheticChildren(flags), m_expression_paths() {
+    for (auto path : items)
+      AddExpressionPath(path);
+  }
+
+  void AddExpressionPath(const char *path) {
+    AddExpressionPath(std::string(path));
+  }
+
+  void Clear() { m_expression_paths.clear(); }
+
+  size_t GetCount() const { return m_expression_paths.size(); }
+
+  const char *GetExpressionPathAtIndex(size_t i) const {
+    return m_expression_paths[i].c_str();
+  }
+
+  bool SetExpressionPathAtIndex(size_t i, const char *path) {
+    return SetExpressionPathAtIndex(i, std::string(path));
+  }
+
+  void AddExpressionPath(const std::string &path);
+
+  bool SetExpressionPathAtIndex(size_t i, const std::string &path);
+
+  bool IsScripted() override { return false; }
+
+  std::string GetDescription() override;
+
+  class FrontEnd : public SyntheticChildrenFrontEnd {
+  public:
+    FrontEnd(TypeFilterImpl *flt, ValueObject &backend)
+        : SyntheticChildrenFrontEnd(backend), filter(flt) {}
+
+    ~FrontEnd() override = default;
+
+    size_t CalculateNumChildren() override { return filter->GetCount(); }
+
+    lldb::ValueObjectSP GetChildAtIndex(size_t idx) override {
+      if (idx >= filter->GetCount())
+        return lldb::ValueObjectSP();
+      return m_backend.GetSyntheticExpressionPathChild(
+          filter->GetExpressionPathAtIndex(idx), true);
+    }
+
+    bool Update() override { return false; }
+
+    bool MightHaveChildren() override { return filter->GetCount() > 0; }
+
+    size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+    typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
+
+  private:
+    TypeFilterImpl *filter;
+
+    DISALLOW_COPY_AND_ASSIGN(FrontEnd);
+  };
+
+  SyntheticChildrenFrontEnd::AutoPointer
+  GetFrontEnd(ValueObject &backend) override {
+    return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(this, backend));
+  }
+
+  typedef std::shared_ptr<TypeFilterImpl> SharedPointer;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(TypeFilterImpl);
+};
+
+class CXXSyntheticChildren : public SyntheticChildren {
+public:
+  typedef std::function<SyntheticChildrenFrontEnd *(CXXSyntheticChildren *,
+                                                    lldb::ValueObjectSP)>
+      CreateFrontEndCallback;
+  CXXSyntheticChildren(const SyntheticChildren::Flags &flags,
+                       const char *description, CreateFrontEndCallback callback)
+      : SyntheticChildren(flags), m_create_callback(callback),
+        m_description(description ? description : "") {}
+
+  bool IsScripted() override { return false; }
+
+  std::string GetDescription() override;
+
+  SyntheticChildrenFrontEnd::AutoPointer
+  GetFrontEnd(ValueObject &backend) override {
+    return SyntheticChildrenFrontEnd::AutoPointer(
+        m_create_callback(this, backend.GetSP()));
+  }
+
+protected:
+  CreateFrontEndCallback m_create_callback;
+  std::string m_description;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(CXXSyntheticChildren);
+};
+
 #ifndef LLDB_DISABLE_PYTHON
-    
-    class ScriptedSyntheticChildren : public SyntheticChildren
-    {
-        std::string m_python_class;
-        std::string m_python_code;
-    public:
-        
-        ScriptedSyntheticChildren(const SyntheticChildren::Flags& flags,
-                                  const char* pclass,
-                                  const char* pcode = nullptr) :
-        SyntheticChildren(flags),
-        m_python_class(),
-        m_python_code()
-        {
-            if (pclass)
-                m_python_class = pclass;
-            if (pcode)
-                m_python_code = pcode;
-        }
-        
-        const char*
-        GetPythonClassName ()
-        {
-            return m_python_class.c_str();
-        }
-        
-        const char*
-        GetPythonCode ()
-        {
-            return m_python_code.c_str();
-        }
-        
-        void
-        SetPythonClassName (const char* fname)
-        {
-            m_python_class.assign(fname);
-            m_python_code.clear();
-        }
-        
-        void
-        SetPythonCode (const char* script)
-        {
-            m_python_code.assign(script);
-        }
-        
-        std::string
-        GetDescription() override;
-        
-        bool
-        IsScripted() override
-        {
-            return true;
-        }
-        
-        class FrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            FrontEnd (std::string pclass,
-                      ValueObject &backend);
-            
-            ~FrontEnd() override;
-
-            bool
-            IsValid ();
-            
-            size_t
-            CalculateNumChildren() override;
-
-            size_t
-            CalculateNumChildren(uint32_t max) override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-
-            bool
-            Update() override;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-            
-            lldb::ValueObjectSP
-            GetSyntheticValue() override;
-            
-            ConstString
-            GetSyntheticTypeName () override;
-
-            typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
-            
-        private:
-            std::string m_python_class;
-            StructuredData::ObjectSP m_wrapper_sp;
-            ScriptInterpreter *m_interpreter;
-
-            DISALLOW_COPY_AND_ASSIGN(FrontEnd);
-        };
-        
-        SyntheticChildrenFrontEnd::AutoPointer
-        GetFrontEnd(ValueObject &backend) override
-        {
-            auto synth_ptr = SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(m_python_class, backend));
-            if (synth_ptr && ((FrontEnd*)synth_ptr.get())->IsValid())
-                return synth_ptr;
-            return nullptr;
-        }
-        
-    private:
-        DISALLOW_COPY_AND_ASSIGN(ScriptedSyntheticChildren);
-    };
+
+class ScriptedSyntheticChildren : public SyntheticChildren {
+  std::string m_python_class;
+  std::string m_python_code;
+
+public:
+  ScriptedSyntheticChildren(const SyntheticChildren::Flags &flags,
+                            const char *pclass, const char *pcode = nullptr)
+      : SyntheticChildren(flags), m_python_class(), m_python_code() {
+    if (pclass)
+      m_python_class = pclass;
+    if (pcode)
+      m_python_code = pcode;
+  }
+
+  const char *GetPythonClassName() { return m_python_class.c_str(); }
+
+  const char *GetPythonCode() { return m_python_code.c_str(); }
+
+  void SetPythonClassName(const char *fname) {
+    m_python_class.assign(fname);
+    m_python_code.clear();
+  }
+
+  void SetPythonCode(const char *script) { m_python_code.assign(script); }
+
+  std::string GetDescription() override;
+
+  bool IsScripted() override { return true; }
+
+  class FrontEnd : public SyntheticChildrenFrontEnd {
+  public:
+    FrontEnd(std::string pclass, ValueObject &backend);
+
+    ~FrontEnd() override;
+
+    bool IsValid();
+
+    size_t CalculateNumChildren() override;
+
+    size_t CalculateNumChildren(uint32_t max) override;
+
+    lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+    bool Update() override;
+
+    bool MightHaveChildren() override;
+
+    size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+    lldb::ValueObjectSP GetSyntheticValue() override;
+
+    ConstString GetSyntheticTypeName() override;
+
+    typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
+
+  private:
+    std::string m_python_class;
+    StructuredData::ObjectSP m_wrapper_sp;
+    ScriptInterpreter *m_interpreter;
+
+    DISALLOW_COPY_AND_ASSIGN(FrontEnd);
+  };
+
+  SyntheticChildrenFrontEnd::AutoPointer
+  GetFrontEnd(ValueObject &backend) override {
+    auto synth_ptr = SyntheticChildrenFrontEnd::AutoPointer(
+        new FrontEnd(m_python_class, backend));
+    if (synth_ptr && ((FrontEnd *)synth_ptr.get())->IsValid())
+      return synth_ptr;
+    return nullptr;
+  }
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(ScriptedSyntheticChildren);
+};
 #endif
 } // namespace lldb_private
 

Modified: lldb/trunk/include/lldb/DataFormatters/TypeValidator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/TypeValidator.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/TypeValidator.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/TypeValidator.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- TypeValidator.h ------------------------------------------*- C++ -*-===//
+//===-- TypeValidator.h ------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -19,287 +20,188 @@
 // Other libraries and framework includes
 
 // Project includes
-#include "lldb/lldb-public.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-public.h"
 
 namespace lldb_private {
-    
-class TypeValidatorImpl
-{
+
+class TypeValidatorImpl {
 public:
-    class Flags
-    {
-    public:
-        
-        Flags () :
-        m_flags (lldb::eTypeOptionCascade)
-        {}
-        
-        Flags (const Flags& other) :
-        m_flags (other.m_flags)
-        {}
-        
-        Flags (uint32_t value) :
-        m_flags (value)
-        {}
-        
-        Flags&
-        operator = (const Flags& rhs)
-        {
-            if (&rhs != this)
-                m_flags = rhs.m_flags;
-            
-            return *this;
-        }
-        
-        Flags&
-        operator = (const uint32_t& rhs)
-        {
-            m_flags = rhs;
-            return *this;
-        }
-        
-        Flags&
-        Clear()
-        {
-            m_flags = 0;
-            return *this;
-        }
-        
-        bool
-        GetCascades () const
-        {
-            return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
-        }
-        
-        Flags&
-        SetCascades (bool value = true)
-        {
-            if (value)
-                m_flags |= lldb::eTypeOptionCascade;
-            else
-                m_flags &= ~lldb::eTypeOptionCascade;
-            return *this;
-        }
-        
-        bool
-        GetSkipPointers () const
-        {
-            return (m_flags & lldb::eTypeOptionSkipPointers) == lldb::eTypeOptionSkipPointers;
-        }
-        
-        Flags&
-        SetSkipPointers (bool value = true)
-        {
-            if (value)
-                m_flags |= lldb::eTypeOptionSkipPointers;
-            else
-                m_flags &= ~lldb::eTypeOptionSkipPointers;
-            return *this;
-        }
-        
-        bool
-        GetSkipReferences () const
-        {
-            return (m_flags & lldb::eTypeOptionSkipReferences) == lldb::eTypeOptionSkipReferences;
-        }
-        
-        Flags&
-        SetSkipReferences (bool value = true)
-        {
-            if (value)
-                m_flags |= lldb::eTypeOptionSkipReferences;
-            else
-                m_flags &= ~lldb::eTypeOptionSkipReferences;
-            return *this;
-        }
-        
-        bool
-        GetNonCacheable () const
-        {
-            return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable;
-        }
-        
-        Flags&
-        SetNonCacheable (bool value = true)
-        {
-            if (value)
-                m_flags |= lldb::eTypeOptionNonCacheable;
-            else
-                m_flags &= ~lldb::eTypeOptionNonCacheable;
-            return *this;
-        }
-        
-        uint32_t
-        GetValue ()
-        {
-            return m_flags;
-        }
-        
-        void
-        SetValue (uint32_t value)
-        {
-            m_flags = value;
-        }
-        
-    private:
-        uint32_t m_flags;
-    };
-    
-    TypeValidatorImpl (const Flags& flags = Flags());
-    
-    typedef std::shared_ptr<TypeValidatorImpl> SharedPointer;
-    
-    virtual ~TypeValidatorImpl ();
-    
-    bool
-    Cascades () const
-    {
-        return m_flags.GetCascades();
-    }
-    bool
-    SkipsPointers () const
-    {
-        return m_flags.GetSkipPointers();
-    }
-    bool
-    SkipsReferences () const
-    {
-        return m_flags.GetSkipReferences();
-    }
-    bool
-    NonCacheable () const
-    {
-        return m_flags.GetNonCacheable();
-    }
-    
-    void
-    SetCascades (bool value)
-    {
-        m_flags.SetCascades(value);
-    }
-    
-    void
-    SetSkipsPointers (bool value)
-    {
-        m_flags.SetSkipPointers(value);
-    }
-    
-    void
-    SetSkipsReferences (bool value)
-    {
-        m_flags.SetSkipReferences(value);
-    }
-    
-    void
-    SetNonCacheable (bool value)
-    {
-        m_flags.SetNonCacheable(value);
-    }
-    
-    uint32_t
-    GetOptions ()
-    {
-        return m_flags.GetValue();
-    }
-    
-    void
-    SetOptions (uint32_t value)
-    {
-        m_flags.SetValue(value);
-    }
-    
-    uint32_t&
-    GetRevision ()
-    {
-        return m_my_revision;
-    }
-    
-    enum class Type
-    {
-        eTypeUnknown,
-        eTypeCXX
-    };
-    
-    struct ValidationResult {
-        TypeValidatorResult m_result;
-        std::string m_message;
-    };
-    
-    virtual Type
-    GetType ()
-    {
-        return Type::eTypeUnknown;
-    }
-    
-    // we are using a ValueObject* instead of a ValueObjectSP because we do not need to hold on to this for
-    // extended periods of time and we trust the ValueObject to stay around for as long as it is required
-    // for us to generate its value
-    virtual ValidationResult
-    FormatObject (ValueObject *valobj) const = 0;
-    
-    virtual std::string
-    GetDescription() = 0;
-    
-    static ValidationResult
-    Success ();
-    
-    static ValidationResult
-    Failure (std::string message);
-    
+  class Flags {
+  public:
+    Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+    Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+    Flags(uint32_t value) : m_flags(value) {}
+
+    Flags &operator=(const Flags &rhs) {
+      if (&rhs != this)
+        m_flags = rhs.m_flags;
+
+      return *this;
+    }
+
+    Flags &operator=(const uint32_t &rhs) {
+      m_flags = rhs;
+      return *this;
+    }
+
+    Flags &Clear() {
+      m_flags = 0;
+      return *this;
+    }
+
+    bool GetCascades() const {
+      return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+    }
+
+    Flags &SetCascades(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionCascade;
+      else
+        m_flags &= ~lldb::eTypeOptionCascade;
+      return *this;
+    }
+
+    bool GetSkipPointers() const {
+      return (m_flags & lldb::eTypeOptionSkipPointers) ==
+             lldb::eTypeOptionSkipPointers;
+    }
+
+    Flags &SetSkipPointers(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionSkipPointers;
+      else
+        m_flags &= ~lldb::eTypeOptionSkipPointers;
+      return *this;
+    }
+
+    bool GetSkipReferences() const {
+      return (m_flags & lldb::eTypeOptionSkipReferences) ==
+             lldb::eTypeOptionSkipReferences;
+    }
+
+    Flags &SetSkipReferences(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionSkipReferences;
+      else
+        m_flags &= ~lldb::eTypeOptionSkipReferences;
+      return *this;
+    }
+
+    bool GetNonCacheable() const {
+      return (m_flags & lldb::eTypeOptionNonCacheable) ==
+             lldb::eTypeOptionNonCacheable;
+    }
+
+    Flags &SetNonCacheable(bool value = true) {
+      if (value)
+        m_flags |= lldb::eTypeOptionNonCacheable;
+      else
+        m_flags &= ~lldb::eTypeOptionNonCacheable;
+      return *this;
+    }
+
+    uint32_t GetValue() { return m_flags; }
+
+    void SetValue(uint32_t value) { m_flags = value; }
+
+  private:
+    uint32_t m_flags;
+  };
+
+  TypeValidatorImpl(const Flags &flags = Flags());
+
+  typedef std::shared_ptr<TypeValidatorImpl> SharedPointer;
+
+  virtual ~TypeValidatorImpl();
+
+  bool Cascades() const { return m_flags.GetCascades(); }
+  bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+  bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+  bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+  void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+  void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+  void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+  void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+  uint32_t GetOptions() { return m_flags.GetValue(); }
+
+  void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+  uint32_t &GetRevision() { return m_my_revision; }
+
+  enum class Type { eTypeUnknown, eTypeCXX };
+
+  struct ValidationResult {
+    TypeValidatorResult m_result;
+    std::string m_message;
+  };
+
+  virtual Type GetType() { return Type::eTypeUnknown; }
+
+  // we are using a ValueObject* instead of a ValueObjectSP because we do not
+  // need to hold on to this for
+  // extended periods of time and we trust the ValueObject to stay around for as
+  // long as it is required
+  // for us to generate its value
+  virtual ValidationResult FormatObject(ValueObject *valobj) const = 0;
+
+  virtual std::string GetDescription() = 0;
+
+  static ValidationResult Success();
+
+  static ValidationResult Failure(std::string message);
+
 protected:
-    Flags m_flags;
-    uint32_t m_my_revision;
-    
+  Flags m_flags;
+  uint32_t m_my_revision;
+
 private:
-    DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl);
+  DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl);
 };
-    
-class TypeValidatorImpl_CXX : public TypeValidatorImpl
-{
+
+class TypeValidatorImpl_CXX : public TypeValidatorImpl {
 public:
-    typedef std::function<TypeValidatorImpl::ValidationResult(ValueObject* valobj)> ValidatorFunction;
-    
-    TypeValidatorImpl_CXX (ValidatorFunction f, std::string d, const TypeValidatorImpl::Flags& flags = Flags());
-    
-    typedef std::shared_ptr<TypeValidatorImpl_CXX> SharedPointer;
-    
-    ~TypeValidatorImpl_CXX() override;
-    
-    ValidatorFunction
-    GetValidatorFunction () const
-    {
-        return m_validator_function;
-    }
-    
-    void
-    SetValidatorFunction (ValidatorFunction f)
-    {
-        m_validator_function = f;
-    }
-    
-    TypeValidatorImpl::Type
-    GetType() override
-    {
-        return TypeValidatorImpl::Type::eTypeCXX;
-    }
-    
-    ValidationResult
-    FormatObject(ValueObject *valobj) const override;
-    
-    std::string
-    GetDescription() override;
-    
+  typedef std::function<TypeValidatorImpl::ValidationResult(
+      ValueObject *valobj)>
+      ValidatorFunction;
+
+  TypeValidatorImpl_CXX(ValidatorFunction f, std::string d,
+                        const TypeValidatorImpl::Flags &flags = Flags());
+
+  typedef std::shared_ptr<TypeValidatorImpl_CXX> SharedPointer;
+
+  ~TypeValidatorImpl_CXX() override;
+
+  ValidatorFunction GetValidatorFunction() const {
+    return m_validator_function;
+  }
+
+  void SetValidatorFunction(ValidatorFunction f) { m_validator_function = f; }
+
+  TypeValidatorImpl::Type GetType() override {
+    return TypeValidatorImpl::Type::eTypeCXX;
+  }
+
+  ValidationResult FormatObject(ValueObject *valobj) const override;
+
+  std::string GetDescription() override;
+
 protected:
-    std::string m_description;
-    ValidatorFunction m_validator_function;
-    
+  std::string m_description;
+  ValidatorFunction m_validator_function;
+
 private:
-    DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl_CXX);
+  DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl_CXX);
 };
 
-    
 } // namespace lldb_private
 
 #endif // lldb_TypeValidator_h_

Modified: lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- ValueObjectPrinter.h ---------------------------------------*- C++ -*-===//
+//===-- ValueObjectPrinter.h ---------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -28,183 +29,137 @@
 
 namespace lldb_private {
 
-class ValueObjectPrinter
-{
+class ValueObjectPrinter {
 public:
+  ValueObjectPrinter(ValueObject *valobj, Stream *s);
+
+  ValueObjectPrinter(ValueObject *valobj, Stream *s,
+                     const DumpValueObjectOptions &options);
+
+  ~ValueObjectPrinter() {}
+
+  bool PrintValueObject();
 
-    ValueObjectPrinter (ValueObject* valobj,
-                        Stream* s);
-    
-    ValueObjectPrinter (ValueObject* valobj,
-                        Stream* s,
-                        const DumpValueObjectOptions& options);
-    
-    ~ValueObjectPrinter () {}
-    
-    bool
-    PrintValueObject ();
-    
 protected:
-    typedef std::set<uint64_t> InstancePointersSet;
-    typedef std::shared_ptr<InstancePointersSet> InstancePointersSetSP;
-    
-    InstancePointersSetSP m_printed_instance_pointers;
-
-    // only this class (and subclasses, if any) should ever be concerned with
-    // the depth mechanism
-    ValueObjectPrinter (ValueObject* valobj,
-                        Stream* s,
-                        const DumpValueObjectOptions& options,
-                        const DumpValueObjectOptions::PointerDepth& ptr_depth,
-                        uint32_t curr_depth,
-                        InstancePointersSetSP printed_instance_pointers);
-    
-    // we should actually be using delegating constructors here
-    // but some versions of GCC still have trouble with those
-    void
-    Init (ValueObject* valobj,
-          Stream* s,
-          const DumpValueObjectOptions& options,
-          const DumpValueObjectOptions::PointerDepth& ptr_depth,
-          uint32_t curr_depth,
-          InstancePointersSetSP printed_instance_pointers);
-    
-    bool
-    GetMostSpecializedValue ();
-    
-    const char*
-    GetDescriptionForDisplay ();
-    
-    const char*
-    GetRootNameForDisplay (const char* if_fail = nullptr);
-    
-    bool
-    ShouldPrintValueObject ();
-    
-    bool
-    ShouldPrintValidation ();
-    
-    bool
-    IsNil ();
-    
-    bool
-    IsUninitialized ();
-    
-    bool
-    IsPtr ();
-    
-    bool
-    IsRef ();
-    
-    bool
-    IsInstancePointer ();
-    
-    bool
-    IsAggregate ();
-    
-    bool
-    PrintValidationMarkerIfNeeded ();
-    
-    bool
-    PrintValidationErrorIfNeeded ();
-    
-    bool
-    PrintLocationIfNeeded ();
-    
-    void
-    PrintDecl ();
-    
-    bool
-    CheckScopeIfNeeded ();
-    
-    bool
-    ShouldPrintEmptyBrackets (bool value_printed,
-                              bool summary_printed);
-    
-    TypeSummaryImpl*
-    GetSummaryFormatter (bool null_if_omitted = true);
-    
-    void
-    GetValueSummaryError (std::string& value,
-                          std::string& summary,
-                          std::string& error);
-    
-    bool
-    PrintValueAndSummaryIfNeeded (bool& value_printed,
-                                  bool& summary_printed);
-    
-    bool
-    PrintObjectDescriptionIfNeeded (bool value_printed,
-                                    bool summary_printed);
-    
-    bool
-    ShouldPrintChildren (bool is_failed_description,
-                         DumpValueObjectOptions::PointerDepth& curr_ptr_depth);
-
-    bool
-    ShouldExpandEmptyAggregates ();
-    
-    ValueObject*
-    GetValueObjectForChildrenGeneration ();
-    
-    void
-    PrintChildrenPreamble ();
-    
-    void
-    PrintChildrenPostamble (bool print_dotdotdot);
-    
-    lldb::ValueObjectSP
-    GenerateChild (ValueObject* synth_valobj,
-                   size_t idx);
-    
-    void
-    PrintChild (lldb::ValueObjectSP child_sp,
-                const DumpValueObjectOptions::PointerDepth& curr_ptr_depth);
-    
-    uint32_t
-    GetMaxNumChildrenToPrint (bool& print_dotdotdot);
-    
-    void
-    PrintChildren (bool value_printed,
-                   bool summary_printed,
-                   const DumpValueObjectOptions::PointerDepth& curr_ptr_depth);
-    
-    void
-    PrintChildrenIfNeeded (bool value_printed,
-                           bool summary_printed);
-    
-    bool
-    PrintChildrenOneLiner (bool hide_names);
-    
+  typedef std::set<uint64_t> InstancePointersSet;
+  typedef std::shared_ptr<InstancePointersSet> InstancePointersSetSP;
+
+  InstancePointersSetSP m_printed_instance_pointers;
+
+  // only this class (and subclasses, if any) should ever be concerned with
+  // the depth mechanism
+  ValueObjectPrinter(ValueObject *valobj, Stream *s,
+                     const DumpValueObjectOptions &options,
+                     const DumpValueObjectOptions::PointerDepth &ptr_depth,
+                     uint32_t curr_depth,
+                     InstancePointersSetSP printed_instance_pointers);
+
+  // we should actually be using delegating constructors here
+  // but some versions of GCC still have trouble with those
+  void Init(ValueObject *valobj, Stream *s,
+            const DumpValueObjectOptions &options,
+            const DumpValueObjectOptions::PointerDepth &ptr_depth,
+            uint32_t curr_depth,
+            InstancePointersSetSP printed_instance_pointers);
+
+  bool GetMostSpecializedValue();
+
+  const char *GetDescriptionForDisplay();
+
+  const char *GetRootNameForDisplay(const char *if_fail = nullptr);
+
+  bool ShouldPrintValueObject();
+
+  bool ShouldPrintValidation();
+
+  bool IsNil();
+
+  bool IsUninitialized();
+
+  bool IsPtr();
+
+  bool IsRef();
+
+  bool IsInstancePointer();
+
+  bool IsAggregate();
+
+  bool PrintValidationMarkerIfNeeded();
+
+  bool PrintValidationErrorIfNeeded();
+
+  bool PrintLocationIfNeeded();
+
+  void PrintDecl();
+
+  bool CheckScopeIfNeeded();
+
+  bool ShouldPrintEmptyBrackets(bool value_printed, bool summary_printed);
+
+  TypeSummaryImpl *GetSummaryFormatter(bool null_if_omitted = true);
+
+  void GetValueSummaryError(std::string &value, std::string &summary,
+                            std::string &error);
+
+  bool PrintValueAndSummaryIfNeeded(bool &value_printed, bool &summary_printed);
+
+  bool PrintObjectDescriptionIfNeeded(bool value_printed, bool summary_printed);
+
+  bool
+  ShouldPrintChildren(bool is_failed_description,
+                      DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
+
+  bool ShouldExpandEmptyAggregates();
+
+  ValueObject *GetValueObjectForChildrenGeneration();
+
+  void PrintChildrenPreamble();
+
+  void PrintChildrenPostamble(bool print_dotdotdot);
+
+  lldb::ValueObjectSP GenerateChild(ValueObject *synth_valobj, size_t idx);
+
+  void PrintChild(lldb::ValueObjectSP child_sp,
+                  const DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
+
+  uint32_t GetMaxNumChildrenToPrint(bool &print_dotdotdot);
+
+  void
+  PrintChildren(bool value_printed, bool summary_printed,
+                const DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
+
+  void PrintChildrenIfNeeded(bool value_printed, bool summary_printed);
+
+  bool PrintChildrenOneLiner(bool hide_names);
+
 private:
-    
-    ValueObject *m_orig_valobj;
-    ValueObject *m_valobj;
-    Stream *m_stream;
-    DumpValueObjectOptions m_options;
-    Flags m_type_flags;
-    CompilerType m_compiler_type;
-    DumpValueObjectOptions::PointerDepth m_ptr_depth;
-    uint32_t m_curr_depth;
-    LazyBool m_should_print;
-    LazyBool m_is_nil;
-    LazyBool m_is_uninit;
-    LazyBool m_is_ptr;
-    LazyBool m_is_ref;
-    LazyBool m_is_aggregate;
-    LazyBool m_is_instance_ptr;
-    std::pair<TypeSummaryImpl*,bool> m_summary_formatter;
-    std::string m_value;
-    std::string m_summary;
-    std::string m_error;
-    bool m_val_summary_ok;
-    std::pair<TypeValidatorResult,std::string> m_validation;
-    
-    friend struct StringSummaryFormat;
-    
-    DISALLOW_COPY_AND_ASSIGN(ValueObjectPrinter);
+  ValueObject *m_orig_valobj;
+  ValueObject *m_valobj;
+  Stream *m_stream;
+  DumpValueObjectOptions m_options;
+  Flags m_type_flags;
+  CompilerType m_compiler_type;
+  DumpValueObjectOptions::PointerDepth m_ptr_depth;
+  uint32_t m_curr_depth;
+  LazyBool m_should_print;
+  LazyBool m_is_nil;
+  LazyBool m_is_uninit;
+  LazyBool m_is_ptr;
+  LazyBool m_is_ref;
+  LazyBool m_is_aggregate;
+  LazyBool m_is_instance_ptr;
+  std::pair<TypeSummaryImpl *, bool> m_summary_formatter;
+  std::string m_value;
+  std::string m_summary;
+  std::string m_error;
+  bool m_val_summary_ok;
+  std::pair<TypeValidatorResult, std::string> m_validation;
+
+  friend struct StringSummaryFormat;
+
+  DISALLOW_COPY_AND_ASSIGN(ValueObjectPrinter);
 };
-    
+
 } // namespace lldb_private
 
-#endif	// lldb_ValueObjectPrinter_h_
+#endif // lldb_ValueObjectPrinter_h_

Modified: lldb/trunk/include/lldb/DataFormatters/VectorIterator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/VectorIterator.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/VectorIterator.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/VectorIterator.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- VectorIterator.h ----------------------------------------------*- C++ -*-===//
+//===-- VectorIterator.h ----------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -16,36 +17,29 @@
 #include "lldb/Target/ExecutionContext.h"
 
 namespace lldb_private {
-    namespace formatters
-    {
-        class VectorIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            VectorIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp,
-                                             ConstString item_name);
-            
-            size_t
-            CalculateNumChildren() override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-            
-            bool
-            Update() override;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-
-        private:
-            ExecutionContextRef m_exe_ctx_ref;
-            ConstString m_item_name;
-            lldb::ValueObjectSP m_item_sp;
-        };
-        
-    } // namespace formatters
+namespace formatters {
+class VectorIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  VectorIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp,
+                                  ConstString item_name);
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+private:
+  ExecutionContextRef m_exe_ctx_ref;
+  ConstString m_item_name;
+  lldb::ValueObjectSP m_item_sp;
+};
+
+} // namespace formatters
 } // namespace lldb_private
 
 #endif // liblldb_CF_h_

Modified: lldb/trunk/include/lldb/DataFormatters/VectorType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/VectorType.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/VectorType.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/VectorType.h Tue Sep  6 15:57:50 2016
@@ -13,16 +13,13 @@
 #include "lldb/lldb-forward.h"
 
 namespace lldb_private {
-    namespace formatters
-    {
-        bool
-        VectorTypeSummaryProvider (ValueObject&,
-                                   Stream&,
-                                   const TypeSummaryOptions&);
+namespace formatters {
+bool VectorTypeSummaryProvider(ValueObject &, Stream &,
+                               const TypeSummaryOptions &);
 
-        SyntheticChildrenFrontEnd*
-        VectorTypeSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-    } // namespace formatters
+SyntheticChildrenFrontEnd *
+VectorTypeSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP);
+} // namespace formatters
 } // namespace lldb_private
 
 #endif // liblldb_VectorType_h_

Modified: lldb/trunk/include/lldb/Expression/DWARFExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/DWARFExpression.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/DWARFExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/DWARFExpression.h Tue Sep  6 15:57:50 2016
@@ -20,17 +20,16 @@
 class DWARFCompileUnit;
 
 namespace lldb_private {
-    
+
 class ClangExpressionDeclMap;
 class ClangExpressionVariable;
 class ClangExpressionVariableList;
 
-
 //----------------------------------------------------------------------
 /// @class DWARFExpression DWARFExpression.h "lldb/Expression/DWARFExpression.h"
 /// @brief Encapsulates a DWARF location expression and interprets it.
 ///
-/// DWARF location expressions are used in two ways by LLDB.  The first 
+/// DWARF location expressions are used in two ways by LLDB.  The first
 /// use is to find entities specified in the debug information, since
 /// their locations are specified in precisely this language.  The second
 /// is to interpret expressions without having to run the target in cases
@@ -39,471 +38,410 @@ class ClangExpressionVariableList;
 /// a single DWARF location expression or a location list and interprets
 /// it.
 //----------------------------------------------------------------------
-class DWARFExpression
-{
+class DWARFExpression {
 public:
-    enum LocationListFormat : uint8_t
-    {
-        NonLocationList,        // Not a location list
-        RegularLocationList,    // Location list format used in non-split dwarf files
-        SplitDwarfLocationList, // Location list format used in split dwarf files
-    };
-
-    //------------------------------------------------------------------
-    /// Constructor
-    //------------------------------------------------------------------
-    explicit DWARFExpression(DWARFCompileUnit* dwarf_cu);
-
-    //------------------------------------------------------------------
-    /// Constructor
-    ///
-    /// @param[in] data
-    ///     A data extractor configured to read the DWARF location expression's
-    ///     bytecode.
-    ///
-    /// @param[in] data_offset
-    ///     The offset of the location expression in the extractor.
-    ///
-    /// @param[in] data_length
-    ///     The byte length of the location expression.
-    //------------------------------------------------------------------
-    DWARFExpression(lldb::ModuleSP module,
-                    const DataExtractor& data,
-                    DWARFCompileUnit* dwarf_cu,
-                    lldb::offset_t data_offset,
-                    lldb::offset_t data_length);
-
-    //------------------------------------------------------------------
-    /// Copy constructor
-    //------------------------------------------------------------------
-    DWARFExpression(const DWARFExpression& rhs);
-
-    //------------------------------------------------------------------
-    /// Destructor
-    //------------------------------------------------------------------
-    virtual
-    ~DWARFExpression();
-
-    //------------------------------------------------------------------
-    /// Print the description of the expression to a stream
-    ///
-    /// @param[in] s
-    ///     The stream to print to.
-    ///
-    /// @param[in] level
-    ///     The level of verbosity to use.
-    ///
-    /// @param[in] location_list_base_addr
-    ///     If this is a location list based expression, this is the
-    ///     address of the object that owns it. NOTE: this value is 
-    ///     different from the DWARF version of the location list base
-    ///     address which is compile unit relative. This base address
-    ///     is the address of the object that owns the location list.
-    ///
-    /// @param[in] abi
-    ///     An optional ABI plug-in that can be used to resolve register
-    ///     names.
-    //------------------------------------------------------------------
-    void
-    GetDescription (Stream *s, 
-                    lldb::DescriptionLevel level, 
-                    lldb::addr_t location_list_base_addr,
-                    ABI *abi) const;
-
-    //------------------------------------------------------------------
-    /// Return true if the location expression contains data
-    //------------------------------------------------------------------
-    bool
-    IsValid() const;
-
-    //------------------------------------------------------------------
-    /// Return true if a location list was provided
-    //------------------------------------------------------------------
-    bool
-    IsLocationList() const;
-
-    //------------------------------------------------------------------
-    /// Search for a load address in the location list
-    ///
-    /// @param[in] process
-    ///     The process to use when resolving the load address
-    ///
-    /// @param[in] addr
-    ///     The address to resolve
-    ///
-    /// @return
-    ///     True if IsLocationList() is true and the address was found;
-    ///     false otherwise.
-    //------------------------------------------------------------------
-//    bool
-//    LocationListContainsLoadAddress (Process* process, const Address &addr) const;
-//
-    bool
-    LocationListContainsAddress (lldb::addr_t loclist_base_addr, lldb::addr_t addr) const;
-    
-    //------------------------------------------------------------------
-    /// If a location is not a location list, return true if the location
-    /// contains a DW_OP_addr () opcode in the stream that matches \a 
-    /// file_addr. If file_addr is LLDB_INVALID_ADDRESS, the this 
-    /// function will return true if the variable there is any DW_OP_addr
-    /// in a location that (yet still is NOT a location list). This helps
-    /// us detect if a variable is a global or static variable since
-    /// there is no other indication from DWARF debug info.
-    ///
-    /// @param[in] op_addr_idx
-    ///     The DW_OP_addr index to retrieve in case there is more than
-    ///     one DW_OP_addr opcode in the location byte stream.
-    ///
-    /// @param[out] error
-    ///     If the location stream contains unknown DW_OP opcodes or the
-    ///     data is missing, \a error will be set to \b true.
-    ///
-    /// @return
-    ///     LLDB_INVALID_ADDRESS if the location doesn't contain a
-    ///     DW_OP_addr for \a op_addr_idx, otherwise a valid file address
-    //------------------------------------------------------------------
-    lldb::addr_t
-    GetLocation_DW_OP_addr (uint32_t op_addr_idx, bool &error) const;
-
-    bool
-    Update_DW_OP_addr (lldb::addr_t file_addr);
-
-    bool
-    ContainsThreadLocalStorage() const;
-
-    bool
-    LinkThreadLocalStorage(lldb::ModuleSP new_module_sp,
-                           std::function<lldb::addr_t(lldb::addr_t file_addr)> const &link_address_callback);
-
-    //------------------------------------------------------------------
-    /// Make the expression parser read its location information from a
-    /// given data source.  Does not change the offset and length
-    ///
-    /// @param[in] data
-    ///     A data extractor configured to read the DWARF location expression's
-    ///     bytecode.
-    //------------------------------------------------------------------
-    void
-    SetOpcodeData(const DataExtractor& data);
-
-    //------------------------------------------------------------------
-    /// Make the expression parser read its location information from a
-    /// given data source
-    ///
-    /// @param[in] module_sp
-    ///     The module that defines the DWARF expression.
-    ///
-    /// @param[in] data
-    ///     A data extractor configured to read the DWARF location expression's
-    ///     bytecode.
-    ///
-    /// @param[in] data_offset
-    ///     The offset of the location expression in the extractor.
-    ///
-    /// @param[in] data_length
-    ///     The byte length of the location expression.
-    //------------------------------------------------------------------
-    void
-    SetOpcodeData(lldb::ModuleSP module_sp, const DataExtractor& data, lldb::offset_t data_offset, lldb::offset_t data_length);
-
-    //------------------------------------------------------------------
-    /// Copy the DWARF location expression into a local buffer.
-    ///
-    /// It is a good idea to copy the data so we don't keep the entire
-    /// object file worth of data around just for a few bytes of location
-    /// expression. LLDB typically will mmap the entire contents of debug
-    /// information files, and if we use SetOpcodeData, it will get a
-    /// shared reference to all of this data for the and cause the object
-    /// file to have to stay around. Even worse, a very very large ".a"
-    /// that contains one or more .o files could end up being referenced.
-    /// Location lists are typically small so even though we are copying
-    /// the data, it shouldn't amount to that much for the variables we
-    /// end up parsing.
-    ///
-    /// @param[in] module_sp
-    ///     The module that defines the DWARF expression.
-    ///
-    /// @param[in] data
-    ///     A data extractor configured to read and copy the DWARF
-    ///     location expression's bytecode.
-    ///
-    /// @param[in] data_offset
-    ///     The offset of the location expression in the extractor.
-    ///
-    /// @param[in] data_length
-    ///     The byte length of the location expression.
-    //------------------------------------------------------------------
-    void
-    CopyOpcodeData (lldb::ModuleSP module_sp,
-                    const DataExtractor& data,
-                    lldb::offset_t data_offset,
-                    lldb::offset_t data_length);
-    
-    void
-    CopyOpcodeData (const void *data,
-                    lldb::offset_t data_length,
-                    lldb::ByteOrder byte_order,
-                    uint8_t addr_byte_size);
-    
-    void
-    CopyOpcodeData (uint64_t const_value,
-                    lldb::offset_t const_value_byte_size,
-                    uint8_t addr_byte_size);
-    
-
-    //------------------------------------------------------------------
-    /// Tells the expression that it refers to a location list.
-    ///
-    /// @param[in] slide
-    ///     This value should be a slide that is applied to any values
-    ///     in the location list data so the values become zero based
-    ///     offsets into the object that owns the location list. We need
-    ///     to make location lists relative to the objects that own them
-    ///     so we can relink addresses on the fly.
-    //------------------------------------------------------------------
-    void
-    SetLocationListSlide (lldb::addr_t slide);
-
-    //------------------------------------------------------------------
-    /// Return the call-frame-info style register kind
-    //------------------------------------------------------------------
-    int
-    GetRegisterKind ();
-
-    //------------------------------------------------------------------
-    /// Set the call-frame-info style register kind
-    ///
-    /// @param[in] reg_kind
-    ///     The register kind.
-    //------------------------------------------------------------------
-    void
-    SetRegisterKind (lldb::RegisterKind reg_kind);
-
-    //------------------------------------------------------------------
-    /// Wrapper for the static evaluate function that accepts an
-    /// ExecutionContextScope instead of an ExecutionContext and uses
-    /// member variables to populate many operands
-    //------------------------------------------------------------------
-    bool
-    Evaluate (ExecutionContextScope *exe_scope,
-              ClangExpressionVariableList *expr_locals,
-              ClangExpressionDeclMap *decl_map,
-              lldb::addr_t loclist_base_load_addr,
-              const Value* initial_value_ptr,
-              const Value* object_address_ptr,
-              Value& result,
-              Error *error_ptr) const;
-
-    //------------------------------------------------------------------
-    /// Wrapper for the static evaluate function that uses member 
-    /// variables to populate many operands
-    //------------------------------------------------------------------
-    bool
-    Evaluate (ExecutionContext *exe_ctx,
-              ClangExpressionVariableList *expr_locals,
-              ClangExpressionDeclMap *decl_map,
-              RegisterContext *reg_ctx,
-              lldb::addr_t loclist_base_load_addr,
-              const Value* initial_value_ptr,
-              const Value* object_address_ptr,
-              Value& result,
-              Error *error_ptr) const;
-
-    //------------------------------------------------------------------
-    /// Evaluate a DWARF location expression in a particular context
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context in which to evaluate the location
-    ///     expression.  The location expression may access the target's
-    ///     memory, especially if it comes from the expression parser.
-    ///
-    /// @param[in] opcode_ctx
-    ///     The module which defined the expression.
-    ///
-    /// @param[in] opcodes
-    ///     This is a static method so the opcodes need to be provided
-    ///     explicitly.
-    ///
-    /// @param[in] expr_locals
-    ///     If the location expression was produced by the expression parser,
-    ///     the list of local variables referenced by the DWARF expression.
-    ///     This list should already have been populated during parsing;
-    ///     the DWARF expression refers to variables by index.  Can be NULL if
-    ///     the location expression uses no locals.
-    ///
-    /// @param[in] decl_map
-    ///     If the location expression was produced by the expression parser,
-    ///     the list of external variables referenced by the location 
-    ///     expression.  Can be NULL if the location expression uses no
-    ///     external variables.
-    ///
-    ///  @param[in] reg_ctx
-    ///     An optional parameter which provides a RegisterContext for use
-    ///     when evaluating the expression (i.e. for fetching register values).
-    ///     Normally this will come from the ExecutionContext's StackFrame but
-    ///     in the case where an expression needs to be evaluated while building
-    ///     the stack frame list, this short-cut is available.
-    ///
-    /// @param[in] offset
-    ///     The offset of the location expression in the data extractor.
-    ///
-    /// @param[in] length
-    ///     The length in bytes of the location expression.
-    ///
-    /// @param[in] reg_set
-    ///     The call-frame-info style register kind.
-    ///
-    /// @param[in] initial_value_ptr
-    ///     A value to put on top of the interpreter stack before evaluating
-    ///     the expression, if the expression is parametrized.  Can be NULL.
-    ///
-    /// @param[in] result
-    ///     A value into which the result of evaluating the expression is
-    ///     to be placed.
-    ///
-    /// @param[in] error_ptr
-    ///     If non-NULL, used to report errors in expression evaluation.
-    ///
-    /// @return
-    ///     True on success; false otherwise.  If error_ptr is non-NULL,
-    ///     details of the failure are provided through it.
-    //------------------------------------------------------------------
-    static bool
-    Evaluate (ExecutionContext *exe_ctx,
-              ClangExpressionVariableList *expr_locals,
-              ClangExpressionDeclMap *decl_map,
-              RegisterContext *reg_ctx,
-              lldb::ModuleSP opcode_ctx,
-              const DataExtractor& opcodes,
-              DWARFCompileUnit* dwarf_cu,
-              const lldb::offset_t offset,
-              const lldb::offset_t length,
-              const lldb::RegisterKind reg_set,
-              const Value* initial_value_ptr,
-              const Value* object_address_ptr,
-              Value& result,
-              Error *error_ptr);
-
-    //------------------------------------------------------------------
-    /// Loads a ClangExpressionVariableList into the object
-    ///
-    /// @param[in] locals
-    ///     If non-NULL, the list of locals used by this expression.
-    ///     See Evaluate().
-    //------------------------------------------------------------------
-    void
-    SetExpressionLocalVariableList (ClangExpressionVariableList *locals);
-    
-    //------------------------------------------------------------------
-    /// Loads a ClangExpressionDeclMap into the object
-    ///
-    /// @param[in] locals
-    ///     If non-NULL, the list of external variables used by this 
-    ///     expression.  See Evaluate().
-    //------------------------------------------------------------------
-    void
-    SetExpressionDeclMap (ClangExpressionDeclMap *decl_map);
-
-    bool
-    GetExpressionData (DataExtractor &data) const
-    {
-        data = m_data;
-        return data.GetByteSize() > 0;
-    }
-    
-    bool
-    DumpLocationForAddress (Stream *s, 
-                            lldb::DescriptionLevel level,
-                            lldb::addr_t loclist_base_load_addr,
-                            lldb::addr_t address,
-                            ABI *abi);
-
-    static size_t
-    LocationListSize(const DWARFCompileUnit* dwarf_cu,
-                     const DataExtractor& debug_loc_data,
-                     lldb::offset_t offset);
-
-    static bool
-    PrintDWARFExpression(Stream &s,
-                         const DataExtractor& data,
-                         int address_size,
-                         int dwarf_ref_size,
-                         bool location_expression);
-
-    static void
-    PrintDWARFLocationList(Stream &s,
-                           const DWARFCompileUnit* cu,
-                           const DataExtractor& debug_loc_data,
-                           lldb::offset_t offset);
-    
-    bool
-    IsRegister(StackFrame &frame,
-               const RegisterInfo *&register_info);
-    
-    bool
-    IsDereferenceOfRegister(StackFrame &frame,
-                            const RegisterInfo *&register_info,
-                            int64_t &offset);
+  enum LocationListFormat : uint8_t {
+    NonLocationList,     // Not a location list
+    RegularLocationList, // Location list format used in non-split dwarf files
+    SplitDwarfLocationList, // Location list format used in split dwarf files
+  };
+
+  //------------------------------------------------------------------
+  /// Constructor
+  //------------------------------------------------------------------
+  explicit DWARFExpression(DWARFCompileUnit *dwarf_cu);
+
+  //------------------------------------------------------------------
+  /// Constructor
+  ///
+  /// @param[in] data
+  ///     A data extractor configured to read the DWARF location expression's
+  ///     bytecode.
+  ///
+  /// @param[in] data_offset
+  ///     The offset of the location expression in the extractor.
+  ///
+  /// @param[in] data_length
+  ///     The byte length of the location expression.
+  //------------------------------------------------------------------
+  DWARFExpression(lldb::ModuleSP module, const DataExtractor &data,
+                  DWARFCompileUnit *dwarf_cu, lldb::offset_t data_offset,
+                  lldb::offset_t data_length);
+
+  //------------------------------------------------------------------
+  /// Copy constructor
+  //------------------------------------------------------------------
+  DWARFExpression(const DWARFExpression &rhs);
+
+  //------------------------------------------------------------------
+  /// Destructor
+  //------------------------------------------------------------------
+  virtual ~DWARFExpression();
+
+  //------------------------------------------------------------------
+  /// Print the description of the expression to a stream
+  ///
+  /// @param[in] s
+  ///     The stream to print to.
+  ///
+  /// @param[in] level
+  ///     The level of verbosity to use.
+  ///
+  /// @param[in] location_list_base_addr
+  ///     If this is a location list based expression, this is the
+  ///     address of the object that owns it. NOTE: this value is
+  ///     different from the DWARF version of the location list base
+  ///     address which is compile unit relative. This base address
+  ///     is the address of the object that owns the location list.
+  ///
+  /// @param[in] abi
+  ///     An optional ABI plug-in that can be used to resolve register
+  ///     names.
+  //------------------------------------------------------------------
+  void GetDescription(Stream *s, lldb::DescriptionLevel level,
+                      lldb::addr_t location_list_base_addr, ABI *abi) const;
+
+  //------------------------------------------------------------------
+  /// Return true if the location expression contains data
+  //------------------------------------------------------------------
+  bool IsValid() const;
+
+  //------------------------------------------------------------------
+  /// Return true if a location list was provided
+  //------------------------------------------------------------------
+  bool IsLocationList() const;
+
+  //------------------------------------------------------------------
+  /// Search for a load address in the location list
+  ///
+  /// @param[in] process
+  ///     The process to use when resolving the load address
+  ///
+  /// @param[in] addr
+  ///     The address to resolve
+  ///
+  /// @return
+  ///     True if IsLocationList() is true and the address was found;
+  ///     false otherwise.
+  //------------------------------------------------------------------
+  //    bool
+  //    LocationListContainsLoadAddress (Process* process, const Address &addr)
+  //    const;
+  //
+  bool LocationListContainsAddress(lldb::addr_t loclist_base_addr,
+                                   lldb::addr_t addr) const;
+
+  //------------------------------------------------------------------
+  /// If a location is not a location list, return true if the location
+  /// contains a DW_OP_addr () opcode in the stream that matches \a
+  /// file_addr. If file_addr is LLDB_INVALID_ADDRESS, the this
+  /// function will return true if the variable there is any DW_OP_addr
+  /// in a location that (yet still is NOT a location list). This helps
+  /// us detect if a variable is a global or static variable since
+  /// there is no other indication from DWARF debug info.
+  ///
+  /// @param[in] op_addr_idx
+  ///     The DW_OP_addr index to retrieve in case there is more than
+  ///     one DW_OP_addr opcode in the location byte stream.
+  ///
+  /// @param[out] error
+  ///     If the location stream contains unknown DW_OP opcodes or the
+  ///     data is missing, \a error will be set to \b true.
+  ///
+  /// @return
+  ///     LLDB_INVALID_ADDRESS if the location doesn't contain a
+  ///     DW_OP_addr for \a op_addr_idx, otherwise a valid file address
+  //------------------------------------------------------------------
+  lldb::addr_t GetLocation_DW_OP_addr(uint32_t op_addr_idx, bool &error) const;
+
+  bool Update_DW_OP_addr(lldb::addr_t file_addr);
+
+  bool ContainsThreadLocalStorage() const;
+
+  bool LinkThreadLocalStorage(
+      lldb::ModuleSP new_module_sp,
+      std::function<lldb::addr_t(lldb::addr_t file_addr)> const
+          &link_address_callback);
+
+  //------------------------------------------------------------------
+  /// Make the expression parser read its location information from a
+  /// given data source.  Does not change the offset and length
+  ///
+  /// @param[in] data
+  ///     A data extractor configured to read the DWARF location expression's
+  ///     bytecode.
+  //------------------------------------------------------------------
+  void SetOpcodeData(const DataExtractor &data);
+
+  //------------------------------------------------------------------
+  /// Make the expression parser read its location information from a
+  /// given data source
+  ///
+  /// @param[in] module_sp
+  ///     The module that defines the DWARF expression.
+  ///
+  /// @param[in] data
+  ///     A data extractor configured to read the DWARF location expression's
+  ///     bytecode.
+  ///
+  /// @param[in] data_offset
+  ///     The offset of the location expression in the extractor.
+  ///
+  /// @param[in] data_length
+  ///     The byte length of the location expression.
+  //------------------------------------------------------------------
+  void SetOpcodeData(lldb::ModuleSP module_sp, const DataExtractor &data,
+                     lldb::offset_t data_offset, lldb::offset_t data_length);
+
+  //------------------------------------------------------------------
+  /// Copy the DWARF location expression into a local buffer.
+  ///
+  /// It is a good idea to copy the data so we don't keep the entire
+  /// object file worth of data around just for a few bytes of location
+  /// expression. LLDB typically will mmap the entire contents of debug
+  /// information files, and if we use SetOpcodeData, it will get a
+  /// shared reference to all of this data for the and cause the object
+  /// file to have to stay around. Even worse, a very very large ".a"
+  /// that contains one or more .o files could end up being referenced.
+  /// Location lists are typically small so even though we are copying
+  /// the data, it shouldn't amount to that much for the variables we
+  /// end up parsing.
+  ///
+  /// @param[in] module_sp
+  ///     The module that defines the DWARF expression.
+  ///
+  /// @param[in] data
+  ///     A data extractor configured to read and copy the DWARF
+  ///     location expression's bytecode.
+  ///
+  /// @param[in] data_offset
+  ///     The offset of the location expression in the extractor.
+  ///
+  /// @param[in] data_length
+  ///     The byte length of the location expression.
+  //------------------------------------------------------------------
+  void CopyOpcodeData(lldb::ModuleSP module_sp, const DataExtractor &data,
+                      lldb::offset_t data_offset, lldb::offset_t data_length);
+
+  void CopyOpcodeData(const void *data, lldb::offset_t data_length,
+                      lldb::ByteOrder byte_order, uint8_t addr_byte_size);
+
+  void CopyOpcodeData(uint64_t const_value,
+                      lldb::offset_t const_value_byte_size,
+                      uint8_t addr_byte_size);
+
+  //------------------------------------------------------------------
+  /// Tells the expression that it refers to a location list.
+  ///
+  /// @param[in] slide
+  ///     This value should be a slide that is applied to any values
+  ///     in the location list data so the values become zero based
+  ///     offsets into the object that owns the location list. We need
+  ///     to make location lists relative to the objects that own them
+  ///     so we can relink addresses on the fly.
+  //------------------------------------------------------------------
+  void SetLocationListSlide(lldb::addr_t slide);
+
+  //------------------------------------------------------------------
+  /// Return the call-frame-info style register kind
+  //------------------------------------------------------------------
+  int GetRegisterKind();
+
+  //------------------------------------------------------------------
+  /// Set the call-frame-info style register kind
+  ///
+  /// @param[in] reg_kind
+  ///     The register kind.
+  //------------------------------------------------------------------
+  void SetRegisterKind(lldb::RegisterKind reg_kind);
+
+  //------------------------------------------------------------------
+  /// Wrapper for the static evaluate function that accepts an
+  /// ExecutionContextScope instead of an ExecutionContext and uses
+  /// member variables to populate many operands
+  //------------------------------------------------------------------
+  bool Evaluate(ExecutionContextScope *exe_scope,
+                ClangExpressionVariableList *expr_locals,
+                ClangExpressionDeclMap *decl_map,
+                lldb::addr_t loclist_base_load_addr,
+                const Value *initial_value_ptr, const Value *object_address_ptr,
+                Value &result, Error *error_ptr) const;
+
+  //------------------------------------------------------------------
+  /// Wrapper for the static evaluate function that uses member
+  /// variables to populate many operands
+  //------------------------------------------------------------------
+  bool Evaluate(ExecutionContext *exe_ctx,
+                ClangExpressionVariableList *expr_locals,
+                ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx,
+                lldb::addr_t loclist_base_load_addr,
+                const Value *initial_value_ptr, const Value *object_address_ptr,
+                Value &result, Error *error_ptr) const;
+
+  //------------------------------------------------------------------
+  /// Evaluate a DWARF location expression in a particular context
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context in which to evaluate the location
+  ///     expression.  The location expression may access the target's
+  ///     memory, especially if it comes from the expression parser.
+  ///
+  /// @param[in] opcode_ctx
+  ///     The module which defined the expression.
+  ///
+  /// @param[in] opcodes
+  ///     This is a static method so the opcodes need to be provided
+  ///     explicitly.
+  ///
+  /// @param[in] expr_locals
+  ///     If the location expression was produced by the expression parser,
+  ///     the list of local variables referenced by the DWARF expression.
+  ///     This list should already have been populated during parsing;
+  ///     the DWARF expression refers to variables by index.  Can be NULL if
+  ///     the location expression uses no locals.
+  ///
+  /// @param[in] decl_map
+  ///     If the location expression was produced by the expression parser,
+  ///     the list of external variables referenced by the location
+  ///     expression.  Can be NULL if the location expression uses no
+  ///     external variables.
+  ///
+  ///  @param[in] reg_ctx
+  ///     An optional parameter which provides a RegisterContext for use
+  ///     when evaluating the expression (i.e. for fetching register values).
+  ///     Normally this will come from the ExecutionContext's StackFrame but
+  ///     in the case where an expression needs to be evaluated while building
+  ///     the stack frame list, this short-cut is available.
+  ///
+  /// @param[in] offset
+  ///     The offset of the location expression in the data extractor.
+  ///
+  /// @param[in] length
+  ///     The length in bytes of the location expression.
+  ///
+  /// @param[in] reg_set
+  ///     The call-frame-info style register kind.
+  ///
+  /// @param[in] initial_value_ptr
+  ///     A value to put on top of the interpreter stack before evaluating
+  ///     the expression, if the expression is parametrized.  Can be NULL.
+  ///
+  /// @param[in] result
+  ///     A value into which the result of evaluating the expression is
+  ///     to be placed.
+  ///
+  /// @param[in] error_ptr
+  ///     If non-NULL, used to report errors in expression evaluation.
+  ///
+  /// @return
+  ///     True on success; false otherwise.  If error_ptr is non-NULL,
+  ///     details of the failure are provided through it.
+  //------------------------------------------------------------------
+  static bool
+  Evaluate(ExecutionContext *exe_ctx, ClangExpressionVariableList *expr_locals,
+           ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx,
+           lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
+           DWARFCompileUnit *dwarf_cu, const lldb::offset_t offset,
+           const lldb::offset_t length, const lldb::RegisterKind reg_set,
+           const Value *initial_value_ptr, const Value *object_address_ptr,
+           Value &result, Error *error_ptr);
+
+  //------------------------------------------------------------------
+  /// Loads a ClangExpressionVariableList into the object
+  ///
+  /// @param[in] locals
+  ///     If non-NULL, the list of locals used by this expression.
+  ///     See Evaluate().
+  //------------------------------------------------------------------
+  void SetExpressionLocalVariableList(ClangExpressionVariableList *locals);
+
+  //------------------------------------------------------------------
+  /// Loads a ClangExpressionDeclMap into the object
+  ///
+  /// @param[in] locals
+  ///     If non-NULL, the list of external variables used by this
+  ///     expression.  See Evaluate().
+  //------------------------------------------------------------------
+  void SetExpressionDeclMap(ClangExpressionDeclMap *decl_map);
+
+  bool GetExpressionData(DataExtractor &data) const {
+    data = m_data;
+    return data.GetByteSize() > 0;
+  }
+
+  bool DumpLocationForAddress(Stream *s, lldb::DescriptionLevel level,
+                              lldb::addr_t loclist_base_load_addr,
+                              lldb::addr_t address, ABI *abi);
+
+  static size_t LocationListSize(const DWARFCompileUnit *dwarf_cu,
+                                 const DataExtractor &debug_loc_data,
+                                 lldb::offset_t offset);
+
+  static bool PrintDWARFExpression(Stream &s, const DataExtractor &data,
+                                   int address_size, int dwarf_ref_size,
+                                   bool location_expression);
+
+  static void PrintDWARFLocationList(Stream &s, const DWARFCompileUnit *cu,
+                                     const DataExtractor &debug_loc_data,
+                                     lldb::offset_t offset);
+
+  bool IsRegister(StackFrame &frame, const RegisterInfo *&register_info);
+
+  bool IsDereferenceOfRegister(StackFrame &frame,
+                               const RegisterInfo *&register_info,
+                               int64_t &offset);
+
 protected:
-    //------------------------------------------------------------------
-    /// Pretty-prints the location expression to a stream
-    ///
-    /// @param[in] stream
-    ///     The stream to use for pretty-printing.
-    ///
-    /// @param[in] offset
-    ///     The offset into the data buffer of the opcodes to be printed.
-    ///
-    /// @param[in] length
-    ///     The length in bytes of the opcodes to be printed.
-    ///
-    /// @param[in] level
-    ///     The level of detail to use in pretty-printing.
-    ///
-    /// @param[in] abi
-    ///     An optional ABI plug-in that can be used to resolve register
-    ///     names.
-    //------------------------------------------------------------------
-    void
-    DumpLocation(Stream *s, 
-                 lldb::offset_t offset,
-                 lldb::offset_t length,
-                 lldb::DescriptionLevel level,
-                 ABI *abi) const;
-    
-    bool
-    GetLocation (lldb::addr_t base_addr, 
-                 lldb::addr_t pc, 
-                 lldb::offset_t &offset, 
-                 lldb::offset_t &len);
-
-    static bool
-    AddressRangeForLocationListEntry(const DWARFCompileUnit* dwarf_cu,
-                                     const DataExtractor& debug_loc_data,
-                                     lldb::offset_t* offset_ptr,
-                                     lldb::addr_t& low_pc,
-                                     lldb::addr_t& high_pc);
-    
-    bool
-    GetOpAndEndOffsets(StackFrame &frame,
-                       lldb::offset_t &op_offset,
-                       lldb::offset_t &end_offset);
-
-    //------------------------------------------------------------------
-    /// Classes that inherit from DWARFExpression can see and modify these
-    //------------------------------------------------------------------
-
-    lldb::ModuleWP m_module_wp;                 ///< Module which defined this expression.
-    DataExtractor m_data;                       ///< A data extractor capable of reading opcode bytes
-    DWARFCompileUnit* m_dwarf_cu;               ///< The DWARF compile unit this expression belongs to. It is used
-                                                ///< to evaluate values indexing into the .debug_addr section (e.g.
-                                                ///< DW_OP_GNU_addr_index, DW_OP_GNU_const_index)
-    lldb::RegisterKind m_reg_kind;              ///< One of the defines that starts with LLDB_REGKIND_
-    lldb::addr_t m_loclist_slide;               ///< A value used to slide the location list offsets so that 
-                                                ///< they are relative to the object that owns the location list
-                                                ///< (the function for frame base and variable location lists)
+  //------------------------------------------------------------------
+  /// Pretty-prints the location expression to a stream
+  ///
+  /// @param[in] stream
+  ///     The stream to use for pretty-printing.
+  ///
+  /// @param[in] offset
+  ///     The offset into the data buffer of the opcodes to be printed.
+  ///
+  /// @param[in] length
+  ///     The length in bytes of the opcodes to be printed.
+  ///
+  /// @param[in] level
+  ///     The level of detail to use in pretty-printing.
+  ///
+  /// @param[in] abi
+  ///     An optional ABI plug-in that can be used to resolve register
+  ///     names.
+  //------------------------------------------------------------------
+  void DumpLocation(Stream *s, lldb::offset_t offset, lldb::offset_t length,
+                    lldb::DescriptionLevel level, ABI *abi) const;
+
+  bool GetLocation(lldb::addr_t base_addr, lldb::addr_t pc,
+                   lldb::offset_t &offset, lldb::offset_t &len);
+
+  static bool AddressRangeForLocationListEntry(
+      const DWARFCompileUnit *dwarf_cu, const DataExtractor &debug_loc_data,
+      lldb::offset_t *offset_ptr, lldb::addr_t &low_pc, lldb::addr_t &high_pc);
+
+  bool GetOpAndEndOffsets(StackFrame &frame, lldb::offset_t &op_offset,
+                          lldb::offset_t &end_offset);
+
+  //------------------------------------------------------------------
+  /// Classes that inherit from DWARFExpression can see and modify these
+  //------------------------------------------------------------------
+
+  lldb::ModuleWP m_module_wp; ///< Module which defined this expression.
+  DataExtractor m_data; ///< A data extractor capable of reading opcode bytes
+  DWARFCompileUnit *m_dwarf_cu; ///< The DWARF compile unit this expression
+                                ///belongs to. It is used
+  ///< to evaluate values indexing into the .debug_addr section (e.g.
+  ///< DW_OP_GNU_addr_index, DW_OP_GNU_const_index)
+  lldb::RegisterKind
+      m_reg_kind; ///< One of the defines that starts with LLDB_REGKIND_
+  lldb::addr_t m_loclist_slide; ///< A value used to slide the location list
+                                ///offsets so that
+  ///< they are relative to the object that owns the location list
+  ///< (the function for frame base and variable location lists)
 };
 
 } // namespace lldb_private
 
-#endif  // liblldb_DWARFExpression_h_
+#endif // liblldb_DWARFExpression_h_

Modified: lldb/trunk/include/lldb/Expression/DiagnosticManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/DiagnosticManager.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/DiagnosticManager.h (original)
+++ lldb/trunk/include/lldb/Expression/DiagnosticManager.h Tue Sep  6 15:57:50 2016
@@ -16,196 +16,145 @@
 #include <string>
 #include <vector>
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-enum DiagnosticOrigin
-{
-    eDiagnosticOriginUnknown = 0,
-    eDiagnosticOriginLLDB,
-    eDiagnosticOriginClang,
-    eDiagnosticOriginGo,
-    eDiagnosticOriginSwift,
-    eDiagnosticOriginLLVM
+enum DiagnosticOrigin {
+  eDiagnosticOriginUnknown = 0,
+  eDiagnosticOriginLLDB,
+  eDiagnosticOriginClang,
+  eDiagnosticOriginGo,
+  eDiagnosticOriginSwift,
+  eDiagnosticOriginLLVM
 };
 
-enum DiagnosticSeverity
-{
-    eDiagnosticSeverityError,
-    eDiagnosticSeverityWarning,
-    eDiagnosticSeverityRemark
+enum DiagnosticSeverity {
+  eDiagnosticSeverityError,
+  eDiagnosticSeverityWarning,
+  eDiagnosticSeverityRemark
 };
 
 const uint32_t LLDB_INVALID_COMPILER_ID = UINT32_MAX;
 
-class Diagnostic
-{
-friend class DiagnosticManager;
+class Diagnostic {
+  friend class DiagnosticManager;
 
 public:
-    DiagnosticOrigin getKind() const { return m_origin; }
-    
-    static bool classof(const Diagnostic *diag)
-    {
-        DiagnosticOrigin kind =  diag->getKind();
-        switch (kind)
-        {
-            case eDiagnosticOriginUnknown:
-            case eDiagnosticOriginLLDB:
-            case eDiagnosticOriginGo:
-            case eDiagnosticOriginLLVM:
-                return true;
-            case eDiagnosticOriginClang:
-            case eDiagnosticOriginSwift:
-                return false;
-        }
-    }
-    
-    Diagnostic(const char *message, DiagnosticSeverity severity, DiagnosticOrigin origin, uint32_t compiler_id) :
-            m_message(message),
-            m_severity(severity),
-            m_origin(origin),
-            m_compiler_id(compiler_id)
-    {
-    }
-    
-    Diagnostic(const Diagnostic &rhs) :
-        m_message(rhs.m_message),
-        m_severity(rhs.m_severity),
-        m_origin(rhs.m_origin),
-        m_compiler_id(rhs.m_compiler_id)
-    {
-    }
-    
-    virtual ~Diagnostic() = default;
-    
-    virtual bool HasFixIts () const { return false; }
-    
-    DiagnosticSeverity
-    GetSeverity() const
-    {
-        return m_severity;
-    }
-    
-    uint32_t
-    GetCompilerID() const
-    {
-        return m_compiler_id;
-    }
-    
-    const char *
-    GetMessage() const
-    {
-        return m_message.c_str();
-    }
-    
-    void AppendMessage(const char *message, bool precede_with_newline = true)
-    {
-        if (precede_with_newline)
-            m_message.push_back('\n');
-        m_message.append(message);
-    }
+  DiagnosticOrigin getKind() const { return m_origin; }
+
+  static bool classof(const Diagnostic *diag) {
+    DiagnosticOrigin kind = diag->getKind();
+    switch (kind) {
+    case eDiagnosticOriginUnknown:
+    case eDiagnosticOriginLLDB:
+    case eDiagnosticOriginGo:
+    case eDiagnosticOriginLLVM:
+      return true;
+    case eDiagnosticOriginClang:
+    case eDiagnosticOriginSwift:
+      return false;
+    }
+  }
+
+  Diagnostic(const char *message, DiagnosticSeverity severity,
+             DiagnosticOrigin origin, uint32_t compiler_id)
+      : m_message(message), m_severity(severity), m_origin(origin),
+        m_compiler_id(compiler_id) {}
+
+  Diagnostic(const Diagnostic &rhs)
+      : m_message(rhs.m_message), m_severity(rhs.m_severity),
+        m_origin(rhs.m_origin), m_compiler_id(rhs.m_compiler_id) {}
+
+  virtual ~Diagnostic() = default;
+
+  virtual bool HasFixIts() const { return false; }
+
+  DiagnosticSeverity GetSeverity() const { return m_severity; }
+
+  uint32_t GetCompilerID() const { return m_compiler_id; }
+
+  const char *GetMessage() const { return m_message.c_str(); }
+
+  void AppendMessage(const char *message, bool precede_with_newline = true) {
+    if (precede_with_newline)
+      m_message.push_back('\n');
+    m_message.append(message);
+  }
 
 protected:
-    std::string m_message;
-    DiagnosticSeverity m_severity;
-    DiagnosticOrigin m_origin;
-    uint32_t m_compiler_id; // Compiler-specific diagnostic ID
+  std::string m_message;
+  DiagnosticSeverity m_severity;
+  DiagnosticOrigin m_origin;
+  uint32_t m_compiler_id; // Compiler-specific diagnostic ID
 };
 
 typedef std::vector<Diagnostic *> DiagnosticList;
 
-class DiagnosticManager
-{
+class DiagnosticManager {
 public:
-    void
-    Clear()
-    {
-        m_diagnostics.clear();
-        m_fixed_expression.clear();
-    }
+  void Clear() {
+    m_diagnostics.clear();
+    m_fixed_expression.clear();
+  }
+
+  // The diagnostic manager holds a list of diagnostics, which are owned by the
+  // manager.
+  const DiagnosticList &Diagnostics() { return m_diagnostics; }
+
+  ~DiagnosticManager() {
+    for (Diagnostic *diag : m_diagnostics) {
+      delete diag;
+    }
+  }
+
+  bool HasFixIts() {
+    for (Diagnostic *diag : m_diagnostics) {
+      if (diag->HasFixIts())
+        return true;
+    }
+    return false;
+  }
+
+  void AddDiagnostic(const char *message, DiagnosticSeverity severity,
+                     DiagnosticOrigin origin,
+                     uint32_t compiler_id = LLDB_INVALID_COMPILER_ID) {
+    m_diagnostics.push_back(
+        new Diagnostic(message, severity, origin, compiler_id));
+  }
+
+  void AddDiagnostic(Diagnostic *diagnostic) {
+    m_diagnostics.push_back(diagnostic);
+  }
+
+  size_t Printf(DiagnosticSeverity severity, const char *format, ...)
+      __attribute__((format(printf, 3, 4)));
+  size_t PutCString(DiagnosticSeverity severity, const char *cstr);
+
+  void AppendMessageToDiagnostic(const char *cstr) {
+    if (m_diagnostics.size()) {
+      m_diagnostics.back()->AppendMessage(cstr);
+    }
+  }
+
+  // Returns a string containing errors in this format:
+  //
+  // "error: error text\n
+  // warning: warning text\n
+  // remark text\n"
+  std::string GetString(char separator = '\n');
+
+  void Dump(Log *log);
+
+  const std::string &GetFixedExpression() { return m_fixed_expression; }
+
+  // Moves fixed_expression to the internal storage.
+  void SetFixedExpression(std::string fixed_expression) {
+    m_fixed_expression = std::move(fixed_expression);
+    fixed_expression.clear();
+  }
 
-    // The diagnostic manager holds a list of diagnostics, which are owned by the manager.
-    const DiagnosticList &
-    Diagnostics()
-    {
-        return m_diagnostics;
-    }
-    
-    ~DiagnosticManager()
-    {
-        for (Diagnostic *diag : m_diagnostics)
-        {
-            delete diag;
-        }
-    }
-    
-    bool
-    HasFixIts()
-    {
-        for (Diagnostic *diag : m_diagnostics)
-        {
-            if (diag->HasFixIts())
-                return true;
-        }
-        return false;
-    }
-    
-    void
-    AddDiagnostic(const char *message, DiagnosticSeverity severity, DiagnosticOrigin origin,
-                  uint32_t compiler_id = LLDB_INVALID_COMPILER_ID)
-    {
-        m_diagnostics.push_back(new Diagnostic(message, severity, origin, compiler_id));
-    }
-    
-    void
-    AddDiagnostic(Diagnostic *diagnostic)
-    {
-        m_diagnostics.push_back(diagnostic);
-    }
-
-    size_t
-    Printf(DiagnosticSeverity severity, const char *format, ...) __attribute__((format(printf, 3, 4)));
-    size_t
-    PutCString(DiagnosticSeverity severity, const char *cstr);
-
-    void
-    AppendMessageToDiagnostic(const char *cstr)
-    {
-        if (m_diagnostics.size())
-        {
-            m_diagnostics.back()->AppendMessage(cstr);
-        }
-    }
-    
-    // Returns a string containing errors in this format:
-    //
-    // "error: error text\n
-    // warning: warning text\n
-    // remark text\n"
-    std::string
-    GetString(char separator = '\n');
-
-    void
-    Dump(Log *log);
-    
-    const std::string &
-    GetFixedExpression()
-    {
-        return m_fixed_expression;
-    }
-    
-    // Moves fixed_expression to the internal storage.
-    void
-    SetFixedExpression(std::string fixed_expression)
-    {
-        m_fixed_expression = std::move(fixed_expression);
-        fixed_expression.clear();
-    }
-    
 protected:
-    DiagnosticList m_diagnostics;
-    std::string m_fixed_expression;
+  DiagnosticList m_diagnostics;
+  std::string m_fixed_expression;
 };
 }
 

Modified: lldb/trunk/include/lldb/Expression/Expression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/Expression.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/Expression.h (original)
+++ lldb/trunk/include/lldb/Expression/Expression.h Tue Sep  6 15:57:50 2016
@@ -12,16 +12,16 @@
 
 // C Includes
 // C++ Includes
-#include <string>
 #include <map>
+#include <string>
 #include <vector>
 
 // Other libraries and framework includes
 // Project includes
 
+#include "lldb/Expression/ExpressionTypeSystemHelper.h"
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private.h"
-#include "lldb/Expression/ExpressionTypeSystemHelper.h"
 
 namespace lldb_private {
 
@@ -37,105 +37,83 @@ class RecordingMemoryManager;
 /// uses the expression parser appropriate to the language of the expression
 /// to produce LLVM IR from the expression.
 //----------------------------------------------------------------------
-class Expression
-{
+class Expression {
 public:
-    enum ResultType {
-        eResultTypeAny,
-        eResultTypeId
-    };
-    
-    Expression (Target &target);
-    
-    Expression (ExecutionContextScope &exe_scope);
-    
-    //------------------------------------------------------------------
-    /// Destructor
-    //------------------------------------------------------------------
-    virtual ~Expression ()
-    {
-    }
-    
-    //------------------------------------------------------------------
-    /// Return the string that the parser should parse.  Must be a full
-    /// translation unit.
-    //------------------------------------------------------------------
-    virtual const char *
-    Text () = 0;
-    
-    //------------------------------------------------------------------
-    /// Return the function name that should be used for executing the
-    /// expression.  Text() should contain the definition of this
-    /// function.
-    //------------------------------------------------------------------
-    virtual const char *
-    FunctionName () = 0;
-    
-    //------------------------------------------------------------------
-    /// Return the language that should be used when parsing.  To use
-    /// the default, return eLanguageTypeUnknown.
-    //------------------------------------------------------------------
-    virtual lldb::LanguageType
-    Language ()
-    {
-        return lldb::eLanguageTypeUnknown;
-    }
-    
-    //------------------------------------------------------------------
-    /// Return the desired result type of the function, or 
-    /// eResultTypeAny if indifferent.
-    //------------------------------------------------------------------
-    virtual ResultType
-    DesiredResultType ()
-    {
-        return eResultTypeAny;
-    }
-    
-    //------------------------------------------------------------------
-    /// Flags
-    //------------------------------------------------------------------
-    
-    //------------------------------------------------------------------
-    /// Return true if validation code should be inserted into the
-    /// expression.
-    //------------------------------------------------------------------
-    virtual bool
-    NeedsValidation () = 0;
-    
-    //------------------------------------------------------------------
-    /// Return true if external variables in the expression should be
-    /// resolved.
-    //------------------------------------------------------------------
-    virtual bool
-    NeedsVariableResolution () = 0;
-
-    virtual EvaluateExpressionOptions *GetOptions() { return nullptr; };
-
-    //------------------------------------------------------------------
-    /// Return the address of the function's JIT-compiled code, or
-    /// LLDB_INVALID_ADDRESS if the function is not JIT compiled
-    //------------------------------------------------------------------
-    lldb::addr_t
-    StartAddress ()
-    {
-        return m_jit_start_addr;
-    }
-    
-    virtual ExpressionTypeSystemHelper *
-    GetTypeSystemHelper ()
-    {
-        return nullptr;
-    }
+  enum ResultType { eResultTypeAny, eResultTypeId };
 
-protected:
+  Expression(Target &target);
+
+  Expression(ExecutionContextScope &exe_scope);
 
-    lldb::TargetWP  m_target_wp;            /// Expression's always have to have a target...
-    lldb::ProcessWP m_jit_process_wp;       /// An expression might have a process, but it doesn't need to (e.g. calculator mode.)
-    lldb::addr_t    m_jit_start_addr;       ///< The address of the JITted function within the JIT allocation.  LLDB_INVALID_ADDRESS if invalid.
-    lldb::addr_t    m_jit_end_addr;         ///< The address of the JITted function within the JIT allocation.  LLDB_INVALID_ADDRESS if invalid.
+  //------------------------------------------------------------------
+  /// Destructor
+  //------------------------------------------------------------------
+  virtual ~Expression() {}
+
+  //------------------------------------------------------------------
+  /// Return the string that the parser should parse.  Must be a full
+  /// translation unit.
+  //------------------------------------------------------------------
+  virtual const char *Text() = 0;
+
+  //------------------------------------------------------------------
+  /// Return the function name that should be used for executing the
+  /// expression.  Text() should contain the definition of this
+  /// function.
+  //------------------------------------------------------------------
+  virtual const char *FunctionName() = 0;
+
+  //------------------------------------------------------------------
+  /// Return the language that should be used when parsing.  To use
+  /// the default, return eLanguageTypeUnknown.
+  //------------------------------------------------------------------
+  virtual lldb::LanguageType Language() { return lldb::eLanguageTypeUnknown; }
+
+  //------------------------------------------------------------------
+  /// Return the desired result type of the function, or
+  /// eResultTypeAny if indifferent.
+  //------------------------------------------------------------------
+  virtual ResultType DesiredResultType() { return eResultTypeAny; }
+
+  //------------------------------------------------------------------
+  /// Flags
+  //------------------------------------------------------------------
+
+  //------------------------------------------------------------------
+  /// Return true if validation code should be inserted into the
+  /// expression.
+  //------------------------------------------------------------------
+  virtual bool NeedsValidation() = 0;
+
+  //------------------------------------------------------------------
+  /// Return true if external variables in the expression should be
+  /// resolved.
+  //------------------------------------------------------------------
+  virtual bool NeedsVariableResolution() = 0;
+
+  virtual EvaluateExpressionOptions *GetOptions() { return nullptr; };
+
+  //------------------------------------------------------------------
+  /// Return the address of the function's JIT-compiled code, or
+  /// LLDB_INVALID_ADDRESS if the function is not JIT compiled
+  //------------------------------------------------------------------
+  lldb::addr_t StartAddress() { return m_jit_start_addr; }
 
+  virtual ExpressionTypeSystemHelper *GetTypeSystemHelper() { return nullptr; }
+
+protected:
+  lldb::TargetWP m_target_wp; /// Expression's always have to have a target...
+  lldb::ProcessWP m_jit_process_wp; /// An expression might have a process, but
+                                    /// it doesn't need to (e.g. calculator
+                                    /// mode.)
+  lldb::addr_t m_jit_start_addr; ///< The address of the JITted function within
+                                 ///the JIT allocation.  LLDB_INVALID_ADDRESS if
+                                 ///invalid.
+  lldb::addr_t m_jit_end_addr;   ///< The address of the JITted function within
+                                 ///the JIT allocation.  LLDB_INVALID_ADDRESS if
+                                 ///invalid.
 };
 
 } // namespace lldb_private
 
-#endif  // liblldb_Expression_h_
+#endif // liblldb_Expression_h_

Modified: lldb/trunk/include/lldb/Expression/ExpressionParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ExpressionParser.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ExpressionParser.h (original)
+++ lldb/trunk/include/lldb/Expression/ExpressionParser.h Tue Sep  6 15:57:50 2016
@@ -10,131 +10,116 @@
 #ifndef liblldb_ExpressionParser_h_
 #define liblldb_ExpressionParser_h_
 
-#include "lldb/lldb-public.h"
 #include "lldb/Core/Error.h"
+#include "lldb/lldb-public.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class IRExecutionUnit;
-    
+
 //----------------------------------------------------------------------
-/// @class ExpressionParser ExpressionParser.h "lldb/Expression/ExpressionParser.h"
+/// @class ExpressionParser ExpressionParser.h
+/// "lldb/Expression/ExpressionParser.h"
 /// @brief Encapsulates an instance of a compiler that can parse expressions.
 ///
 /// ExpressionParser is the base class for llvm based Expression parsers.
 //----------------------------------------------------------------------
-class ExpressionParser
-{
+class ExpressionParser {
 public:
-    //------------------------------------------------------------------
-    /// Constructor
-    ///
-    /// Initializes class variables.
-    ///
-    /// @param[in] exe_scope,
-    ///     If non-NULL, an execution context scope that can help to 
-    ///     correctly create an expression with a valid process for 
-    ///     optional tuning Objective-C runtime support. Can be NULL.
-    ///
-    /// @param[in] expr
-    ///     The expression to be parsed.
-    //------------------------------------------------------------------
-    ExpressionParser (ExecutionContextScope *exe_scope,
-                      Expression &expr,
-                      bool generate_debug_info) :
-        m_expr(expr),
-        m_generate_debug_info(generate_debug_info)
-    {
-    }
-    
-    //------------------------------------------------------------------
-    /// Destructor
-    //------------------------------------------------------------------
-    virtual ~ExpressionParser () {};
-    
-    //------------------------------------------------------------------
-    /// Parse a single expression and convert it to IR using Clang.  Don't
-    /// wrap the expression in anything at all.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     The diagnostic manager in which to store the errors and warnings.
-    ///
-    /// @return
-    ///     The number of errors encountered during parsing.  0 means
-    ///     success.
-    //------------------------------------------------------------------
-    virtual unsigned
-    Parse(DiagnosticManager &diagnostic_manager) = 0;
-    
-    //------------------------------------------------------------------
-    /// Try to use the FixIts in the diagnostic_manager to rewrite the
-    /// expression.  If successful, the rewritten expression is stored
-    /// in the diagnostic_manager, get it out with GetFixedExpression.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     The diagnostic manager containing fixit's to apply.
-    ///
-    /// @return
-    ///     \b true if the rewrite was successful, \b false otherwise.
-    //------------------------------------------------------------------
-    virtual bool
-    RewriteExpression(DiagnosticManager &diagnostic_manager)
-    {
-        return false;
-    }
-
-    //------------------------------------------------------------------
-    /// Ready an already-parsed expression for execution, possibly
-    /// evaluating it statically.
-    ///
-    /// @param[out] func_addr
-    ///     The address to which the function has been written.
-    ///
-    /// @param[out] func_end
-    ///     The end of the function's allocated memory region.  (func_addr
-    ///     and func_end do not delimit an allocated region; the allocated
-    ///     region may begin before func_addr.)
-    ///
-    /// @param[in] execution_unit_sp
-    ///     After parsing, ownership of the execution unit for
-    ///     for the expression is handed to this shared pointer.
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to write the function into.
-    ///
-    /// @param[out] can_interpret
-    ///     Set to true if the expression could be interpreted statically;
-    ///     untouched otherwise.
-    ///
-    /// @param[in] execution_policy
-    ///     Determines whether the expression must be JIT-compiled, must be
-    ///     evaluated statically, or whether this decision may be made
-    ///     opportunistically.
-    ///
-    /// @return
-    ///     An error code indicating the success or failure of the operation.
-    ///     Test with Success().
-    //------------------------------------------------------------------
-    virtual Error
-    PrepareForExecution (lldb::addr_t &func_addr,
-                         lldb::addr_t &func_end,
-                         std::shared_ptr<IRExecutionUnit> &execution_unit_sp,
-                         ExecutionContext &exe_ctx,
-                         bool &can_interpret,
-                         lldb_private::ExecutionPolicy execution_policy) = 0;
-        
-    bool
-    GetGenerateDebugInfo () const
-    {
-        return m_generate_debug_info;
-    }
-    
+  //------------------------------------------------------------------
+  /// Constructor
+  ///
+  /// Initializes class variables.
+  ///
+  /// @param[in] exe_scope,
+  ///     If non-NULL, an execution context scope that can help to
+  ///     correctly create an expression with a valid process for
+  ///     optional tuning Objective-C runtime support. Can be NULL.
+  ///
+  /// @param[in] expr
+  ///     The expression to be parsed.
+  //------------------------------------------------------------------
+  ExpressionParser(ExecutionContextScope *exe_scope, Expression &expr,
+                   bool generate_debug_info)
+      : m_expr(expr), m_generate_debug_info(generate_debug_info) {}
+
+  //------------------------------------------------------------------
+  /// Destructor
+  //------------------------------------------------------------------
+  virtual ~ExpressionParser(){};
+
+  //------------------------------------------------------------------
+  /// Parse a single expression and convert it to IR using Clang.  Don't
+  /// wrap the expression in anything at all.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     The diagnostic manager in which to store the errors and warnings.
+  ///
+  /// @return
+  ///     The number of errors encountered during parsing.  0 means
+  ///     success.
+  //------------------------------------------------------------------
+  virtual unsigned Parse(DiagnosticManager &diagnostic_manager) = 0;
+
+  //------------------------------------------------------------------
+  /// Try to use the FixIts in the diagnostic_manager to rewrite the
+  /// expression.  If successful, the rewritten expression is stored
+  /// in the diagnostic_manager, get it out with GetFixedExpression.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     The diagnostic manager containing fixit's to apply.
+  ///
+  /// @return
+  ///     \b true if the rewrite was successful, \b false otherwise.
+  //------------------------------------------------------------------
+  virtual bool RewriteExpression(DiagnosticManager &diagnostic_manager) {
+    return false;
+  }
+
+  //------------------------------------------------------------------
+  /// Ready an already-parsed expression for execution, possibly
+  /// evaluating it statically.
+  ///
+  /// @param[out] func_addr
+  ///     The address to which the function has been written.
+  ///
+  /// @param[out] func_end
+  ///     The end of the function's allocated memory region.  (func_addr
+  ///     and func_end do not delimit an allocated region; the allocated
+  ///     region may begin before func_addr.)
+  ///
+  /// @param[in] execution_unit_sp
+  ///     After parsing, ownership of the execution unit for
+  ///     for the expression is handed to this shared pointer.
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to write the function into.
+  ///
+  /// @param[out] can_interpret
+  ///     Set to true if the expression could be interpreted statically;
+  ///     untouched otherwise.
+  ///
+  /// @param[in] execution_policy
+  ///     Determines whether the expression must be JIT-compiled, must be
+  ///     evaluated statically, or whether this decision may be made
+  ///     opportunistically.
+  ///
+  /// @return
+  ///     An error code indicating the success or failure of the operation.
+  ///     Test with Success().
+  //------------------------------------------------------------------
+  virtual Error
+  PrepareForExecution(lldb::addr_t &func_addr, lldb::addr_t &func_end,
+                      std::shared_ptr<IRExecutionUnit> &execution_unit_sp,
+                      ExecutionContext &exe_ctx, bool &can_interpret,
+                      lldb_private::ExecutionPolicy execution_policy) = 0;
+
+  bool GetGenerateDebugInfo() const { return m_generate_debug_info; }
+
 protected:
-    Expression &                       m_expr;                       ///< The expression to be parsed
-    bool                               m_generate_debug_info;
+  Expression &m_expr; ///< The expression to be parsed
+  bool m_generate_debug_info;
 };
-    
 }
 
-#endif  // liblldb_ExpressionParser_h_
+#endif // liblldb_ExpressionParser_h_

Modified: lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h (original)
+++ lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h Tue Sep  6 15:57:50 2016
@@ -14,73 +14,48 @@
 
 #include <string>
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class ExecutionContext;
 
-class ExpressionSourceCode
-{
+class ExpressionSourceCode {
 public:
-    static const char * g_expression_prefix;
+  static const char *g_expression_prefix;
+
+  static ExpressionSourceCode *CreateWrapped(const char *prefix,
+                                             const char *body) {
+    return new ExpressionSourceCode("$__lldb_expr", prefix, body, true);
+  }
+
+  static ExpressionSourceCode *CreateUnwrapped(const char *name,
+                                               const char *body) {
+    return new ExpressionSourceCode(name, "", body, false);
+  }
+
+  bool NeedsWrapping() const { return m_wrap; }
+
+  const char *GetName() const { return m_name.c_str(); }
+
+  bool GetText(std::string &text, lldb::LanguageType wrapping_language,
+               bool static_method, ExecutionContext &exe_ctx) const;
+
+  // Given a string returned by GetText, find the beginning and end of the body
+  // passed to CreateWrapped.
+  // Return true if the bounds could be found.  This will also work on text with
+  // FixItHints applied.
+  static bool GetOriginalBodyBounds(std::string transformed_text,
+                                    lldb::LanguageType wrapping_language,
+                                    size_t &start_loc, size_t &end_loc);
 
-    static ExpressionSourceCode *CreateWrapped (const char *prefix,
-                                                const char *body)
-    {
-        return new ExpressionSourceCode ("$__lldb_expr",
-                                         prefix,
-                                         body,
-                                         true);
-    }
-    
-    static ExpressionSourceCode *CreateUnwrapped (const char *name,
-                                                  const char *body)
-    {
-        return new ExpressionSourceCode (name,
-                                         "",
-                                         body,
-                                         false);
-    }
-    
-    bool NeedsWrapping () const
-    {
-        return m_wrap;
-    }
-    
-    const char *GetName () const
-    {
-        return m_name.c_str();
-    }
-    
-    bool GetText (std::string &text, 
-                  lldb::LanguageType wrapping_language, 
-                  bool static_method,
-                  ExecutionContext &exe_ctx) const;
-    
-    // Given a string returned by GetText, find the beginning and end of the body passed to CreateWrapped.
-    // Return true if the bounds could be found.  This will also work on text with FixItHints applied.
-    static bool
-    GetOriginalBodyBounds(std::string transformed_text,
-                          lldb::LanguageType wrapping_language,
-                          size_t &start_loc,
-                          size_t &end_loc);
-    
 private:
-    ExpressionSourceCode (const char *name,
-                          const char *prefix,
-                          const char *body,
-                          bool wrap) :
-        m_name(name),
-        m_prefix(prefix),
-        m_body(body),
-        m_wrap(wrap)
-    {
-    }
-    
-    std::string m_name;
-    std::string m_prefix;
-    std::string m_body;
-    bool m_wrap;
+  ExpressionSourceCode(const char *name, const char *prefix, const char *body,
+                       bool wrap)
+      : m_name(name), m_prefix(prefix), m_body(body), m_wrap(wrap) {}
+
+  std::string m_name;
+  std::string m_prefix;
+  std::string m_body;
+  bool m_wrap;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Expression/ExpressionTypeSystemHelper.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ExpressionTypeSystemHelper.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ExpressionTypeSystemHelper.h (original)
+++ lldb/trunk/include/lldb/Expression/ExpressionTypeSystemHelper.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- ExpressionTypeSystemHelper.h ---------------------------------*- C++ -*-===//
+//===-- ExpressionTypeSystemHelper.h ---------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -12,42 +13,37 @@
 
 #include "llvm/Support/Casting.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 //----------------------------------------------------------------------
-/// @class ExpressionTypeSystemHelper ExpressionTypeSystemHelper.h "lldb/Expression/ExpressionTypeSystemHelper.h"
-/// @brief A helper object that the Expression can pass to its ExpressionParser to provide generic information that
-/// any type of expression will need to supply.  It's only job is to support dyn_cast so that the expression parser
+/// @class ExpressionTypeSystemHelper ExpressionTypeSystemHelper.h
+/// "lldb/Expression/ExpressionTypeSystemHelper.h"
+/// @brief A helper object that the Expression can pass to its ExpressionParser
+/// to provide generic information that
+/// any type of expression will need to supply.  It's only job is to support
+/// dyn_cast so that the expression parser
 /// can cast it back to the requisite specific type.
 ///
 //----------------------------------------------------------------------
 
-class ExpressionTypeSystemHelper
-{
+class ExpressionTypeSystemHelper {
 public:
-    enum LLVMCastKind {
-        eKindClangHelper,
-        eKindSwiftHelper,
-        eKindGoHelper,
-        kNumKinds
-    };
-
-    LLVMCastKind getKind() const { return m_kind; }
-
-    ExpressionTypeSystemHelper (LLVMCastKind kind) :
-        m_kind(kind)
-    {
-    }
-    
-    ~ExpressionTypeSystemHelper () {}
+  enum LLVMCastKind {
+    eKindClangHelper,
+    eKindSwiftHelper,
+    eKindGoHelper,
+    kNumKinds
+  };
 
-protected:
-    LLVMCastKind m_kind;
-};
+  LLVMCastKind getKind() const { return m_kind; }
 
+  ExpressionTypeSystemHelper(LLVMCastKind kind) : m_kind(kind) {}
 
+  ~ExpressionTypeSystemHelper() {}
 
+protected:
+  LLVMCastKind m_kind;
+};
 
 } // namespace lldb_private
 

Modified: lldb/trunk/include/lldb/Expression/ExpressionVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ExpressionVariable.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ExpressionVariable.h (original)
+++ lldb/trunk/include/lldb/Expression/ExpressionVariable.h Tue Sep  6 15:57:50 2016
@@ -19,313 +19,253 @@
 #include "llvm/ADT/DenseMap.h"
 
 // Project includes
-#include "lldb/lldb-public.h"
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
 
-namespace lldb_private
-{
-    
 class ClangExpressionVariable;
 
-class ExpressionVariable :
-    public std::enable_shared_from_this<ExpressionVariable>
-{
+class ExpressionVariable
+    : public std::enable_shared_from_this<ExpressionVariable> {
 public:
-    //----------------------------------------------------------------------
-    // See TypeSystem.h for how to add subclasses to this.
-    //----------------------------------------------------------------------
-    enum LLVMCastKind {
-        eKindClang,
-        eKindSwift,
-        eKindGo,
-        kNumKinds
-    };
-    
-    LLVMCastKind getKind() const { return m_kind; }
-    
-    ExpressionVariable(LLVMCastKind kind) :
-        m_flags(0),
-        m_kind(kind)
-    {
-    }
-
-    virtual ~ExpressionVariable();
-
-    size_t
-    GetByteSize ()
-    {
-        return m_frozen_sp->GetByteSize();
-    }
-    
-    const ConstString &
-    GetName ()
-    {
-        return m_frozen_sp->GetName();
-    }
-    
-    lldb::ValueObjectSP
-    GetValueObject()
-    {
-        return m_frozen_sp;
-    }
-    
-    uint8_t *GetValueBytes();
-    
-    void
-    ValueUpdated ()
-    {
-        m_frozen_sp->ValueUpdated ();
-    }
-    
-    RegisterInfo *
-    GetRegisterInfo()
-    {
-        return m_frozen_sp->GetValue().GetRegisterInfo();
-    }
-    
-    void
-    SetRegisterInfo (const RegisterInfo *reg_info)
-    {
-        return m_frozen_sp->GetValue().SetContext (Value::eContextTypeRegisterInfo, const_cast<RegisterInfo *>(reg_info));
-    }
-    
-    CompilerType
-    GetCompilerType()
-    {
-        return m_frozen_sp->GetCompilerType();
-    }
-    
-    void
-    SetCompilerType(const CompilerType &compiler_type)
-    {
-        m_frozen_sp->GetValue().SetCompilerType(compiler_type);
-    }
-    
-    void
-    SetName (const ConstString &name)
-    {
-        m_frozen_sp->SetName (name);
-    }
-    
-    // this function is used to copy the address-of m_live_sp into m_frozen_sp
-    // this is necessary because the results of certain cast and pointer-arithmetic
-    // operations (such as those described in bugzilla issues 11588 and 11618) generate
-    // frozen objects that do not have a valid address-of, which can be troublesome when
-    // using synthetic children providers. Transferring the address-of the live object
-    // solves these issues and provides the expected user-level behavior
-    void
-    TransferAddress (bool force = false)
-    {
-        if (m_live_sp.get() == nullptr)
-            return;
-        
-        if (m_frozen_sp.get() == nullptr)
-            return;
-        
-        if (force || (m_frozen_sp->GetLiveAddress() == LLDB_INVALID_ADDRESS))
-            m_frozen_sp->SetLiveAddress(m_live_sp->GetLiveAddress());
-    }
-    
-    enum Flags
-    {
-        EVNone                  = 0,
-        EVIsLLDBAllocated       = 1 << 0,   ///< This variable is resident in a location specifically allocated for it by LLDB in the target process
-        EVIsProgramReference    = 1 << 1,   ///< This variable is a reference to a (possibly invalid) area managed by the target program
-        EVNeedsAllocation       = 1 << 2,   ///< Space for this variable has yet to be allocated in the target process
-        EVIsFreezeDried         = 1 << 3,   ///< This variable's authoritative version is in m_frozen_sp (for example, for statically-computed results)
-        EVNeedsFreezeDry        = 1 << 4,   ///< Copy from m_live_sp to m_frozen_sp during dematerialization
-        EVKeepInTarget          = 1 << 5,   ///< Keep the allocation after the expression is complete rather than freeze drying its contents and freeing it
-        EVTypeIsReference       = 1 << 6,   ///< The original type of this variable is a reference, so materialize the value rather than the location
-        EVUnknownType           = 1 << 7,   ///< This is a symbol of unknown type, and the type must be resolved after parsing is complete
-        EVBareRegister          = 1 << 8    ///< This variable is a direct reference to $pc or some other entity.
-    };
-    
-    typedef uint16_t FlagType;
-    
-    FlagType m_flags; // takes elements of Flags
-
-    // these should be private
-    lldb::ValueObjectSP m_frozen_sp;
-    lldb::ValueObjectSP m_live_sp;
-    LLVMCastKind        m_kind;
+  //----------------------------------------------------------------------
+  // See TypeSystem.h for how to add subclasses to this.
+  //----------------------------------------------------------------------
+  enum LLVMCastKind { eKindClang, eKindSwift, eKindGo, kNumKinds };
+
+  LLVMCastKind getKind() const { return m_kind; }
+
+  ExpressionVariable(LLVMCastKind kind) : m_flags(0), m_kind(kind) {}
+
+  virtual ~ExpressionVariable();
+
+  size_t GetByteSize() { return m_frozen_sp->GetByteSize(); }
+
+  const ConstString &GetName() { return m_frozen_sp->GetName(); }
+
+  lldb::ValueObjectSP GetValueObject() { return m_frozen_sp; }
+
+  uint8_t *GetValueBytes();
+
+  void ValueUpdated() { m_frozen_sp->ValueUpdated(); }
+
+  RegisterInfo *GetRegisterInfo() {
+    return m_frozen_sp->GetValue().GetRegisterInfo();
+  }
+
+  void SetRegisterInfo(const RegisterInfo *reg_info) {
+    return m_frozen_sp->GetValue().SetContext(
+        Value::eContextTypeRegisterInfo, const_cast<RegisterInfo *>(reg_info));
+  }
+
+  CompilerType GetCompilerType() { return m_frozen_sp->GetCompilerType(); }
+
+  void SetCompilerType(const CompilerType &compiler_type) {
+    m_frozen_sp->GetValue().SetCompilerType(compiler_type);
+  }
+
+  void SetName(const ConstString &name) { m_frozen_sp->SetName(name); }
+
+  // this function is used to copy the address-of m_live_sp into m_frozen_sp
+  // this is necessary because the results of certain cast and
+  // pointer-arithmetic
+  // operations (such as those described in bugzilla issues 11588 and 11618)
+  // generate
+  // frozen objects that do not have a valid address-of, which can be
+  // troublesome when
+  // using synthetic children providers. Transferring the address-of the live
+  // object
+  // solves these issues and provides the expected user-level behavior
+  void TransferAddress(bool force = false) {
+    if (m_live_sp.get() == nullptr)
+      return;
+
+    if (m_frozen_sp.get() == nullptr)
+      return;
+
+    if (force || (m_frozen_sp->GetLiveAddress() == LLDB_INVALID_ADDRESS))
+      m_frozen_sp->SetLiveAddress(m_live_sp->GetLiveAddress());
+  }
+
+  enum Flags {
+    EVNone = 0,
+    EVIsLLDBAllocated = 1 << 0, ///< This variable is resident in a location
+                                ///specifically allocated for it by LLDB in the
+                                ///target process
+    EVIsProgramReference = 1 << 1, ///< This variable is a reference to a
+                                   ///(possibly invalid) area managed by the
+                                   ///target program
+    EVNeedsAllocation = 1 << 2,    ///< Space for this variable has yet to be
+                                   ///allocated in the target process
+    EVIsFreezeDried = 1 << 3, ///< This variable's authoritative version is in
+                              ///m_frozen_sp (for example, for
+                              ///statically-computed results)
+    EVNeedsFreezeDry =
+        1 << 4, ///< Copy from m_live_sp to m_frozen_sp during dematerialization
+    EVKeepInTarget = 1 << 5, ///< Keep the allocation after the expression is
+                             ///complete rather than freeze drying its contents
+                             ///and freeing it
+    EVTypeIsReference = 1 << 6, ///< The original type of this variable is a
+                                ///reference, so materialize the value rather
+                                ///than the location
+    EVUnknownType = 1 << 7, ///< This is a symbol of unknown type, and the type
+                            ///must be resolved after parsing is complete
+    EVBareRegister = 1 << 8 ///< This variable is a direct reference to $pc or
+                            ///some other entity.
+  };
+
+  typedef uint16_t FlagType;
+
+  FlagType m_flags; // takes elements of Flags
+
+  // these should be private
+  lldb::ValueObjectSP m_frozen_sp;
+  lldb::ValueObjectSP m_live_sp;
+  LLVMCastKind m_kind;
 };
-    
+
 //----------------------------------------------------------------------
-/// @class ExpressionVariableList ExpressionVariable.h "lldb/Expression/ExpressionVariable.h"
+/// @class ExpressionVariableList ExpressionVariable.h
+/// "lldb/Expression/ExpressionVariable.h"
 /// @brief A list of variable references.
 ///
 /// This class stores variables internally, acting as the permanent store.
 //----------------------------------------------------------------------
-class ExpressionVariableList
-{
+class ExpressionVariableList {
 public:
-    //----------------------------------------------------------------------
-    /// Implementation of methods in ExpressionVariableListBase
-    //----------------------------------------------------------------------
-    size_t 
-    GetSize()
-    {
-        return m_variables.size();
-    }
-    
-    lldb::ExpressionVariableSP
-    GetVariableAtIndex(size_t index)
-    {
-        lldb::ExpressionVariableSP var_sp;
-        if (index < m_variables.size())
-            var_sp = m_variables[index];
+  //----------------------------------------------------------------------
+  /// Implementation of methods in ExpressionVariableListBase
+  //----------------------------------------------------------------------
+  size_t GetSize() { return m_variables.size(); }
+
+  lldb::ExpressionVariableSP GetVariableAtIndex(size_t index) {
+    lldb::ExpressionVariableSP var_sp;
+    if (index < m_variables.size())
+      var_sp = m_variables[index];
+    return var_sp;
+  }
+
+  size_t AddVariable(const lldb::ExpressionVariableSP &var_sp) {
+    m_variables.push_back(var_sp);
+    return m_variables.size() - 1;
+  }
+
+  lldb::ExpressionVariableSP
+  AddNewlyConstructedVariable(ExpressionVariable *var) {
+    lldb::ExpressionVariableSP var_sp(var);
+    m_variables.push_back(var_sp);
+    return m_variables.back();
+  }
+
+  bool ContainsVariable(const lldb::ExpressionVariableSP &var_sp) {
+    const size_t size = m_variables.size();
+    for (size_t index = 0; index < size; ++index) {
+      if (m_variables[index].get() == var_sp.get())
+        return true;
+    }
+    return false;
+  }
+
+  //----------------------------------------------------------------------
+  /// Finds a variable by name in the list.
+  ///
+  /// @param[in] name
+  ///     The name of the requested variable.
+  ///
+  /// @return
+  ///     The variable requested, or nullptr if that variable is not in the
+  ///     list.
+  //----------------------------------------------------------------------
+  lldb::ExpressionVariableSP GetVariable(const ConstString &name) {
+    lldb::ExpressionVariableSP var_sp;
+    for (size_t index = 0, size = GetSize(); index < size; ++index) {
+      var_sp = GetVariableAtIndex(index);
+      if (var_sp->GetName() == name)
         return var_sp;
     }
-    
-    size_t
-    AddVariable (const lldb::ExpressionVariableSP &var_sp)
-    {
-        m_variables.push_back(var_sp);
-        return m_variables.size() - 1;
-    }
-    
-    lldb::ExpressionVariableSP
-    AddNewlyConstructedVariable (ExpressionVariable *var)
-    {
-        lldb::ExpressionVariableSP var_sp(var);
-        m_variables.push_back(var_sp);
-        return m_variables.back();
-    }
-
-    bool
-    ContainsVariable (const lldb::ExpressionVariableSP &var_sp)
-    {
-        const size_t size = m_variables.size();
-        for (size_t index = 0; index < size; ++index)
-        {
-            if (m_variables[index].get() == var_sp.get())
-                return true;
-        }
-        return false;
+    var_sp.reset();
+    return var_sp;
+  }
+
+  lldb::ExpressionVariableSP GetVariable(const char *name) {
+    lldb::ExpressionVariableSP var_sp;
+    if (name && name[0]) {
+      for (size_t index = 0, size = GetSize(); index < size; ++index) {
+        var_sp = GetVariableAtIndex(index);
+        const char *var_name_cstr = var_sp->GetName().GetCString();
+        if (!var_name_cstr || !name)
+          continue;
+        if (::strcmp(var_name_cstr, name) == 0)
+          return var_sp;
+      }
+      var_sp.reset();
+    }
+    return var_sp;
+  }
+
+  void RemoveVariable(lldb::ExpressionVariableSP var_sp) {
+    for (std::vector<lldb::ExpressionVariableSP>::iterator
+             vi = m_variables.begin(),
+             ve = m_variables.end();
+         vi != ve; ++vi) {
+      if (vi->get() == var_sp.get()) {
+        m_variables.erase(vi);
+        return;
+      }
     }
+  }
 
-    //----------------------------------------------------------------------
-    /// Finds a variable by name in the list.
-    ///
-    /// @param[in] name
-    ///     The name of the requested variable.
-    ///
-    /// @return
-    ///     The variable requested, or nullptr if that variable is not in the list.
-    //----------------------------------------------------------------------
-    lldb::ExpressionVariableSP
-    GetVariable (const ConstString &name)
-    {
-        lldb::ExpressionVariableSP var_sp;
-        for (size_t index = 0, size = GetSize(); index < size; ++index)
-        {
-            var_sp = GetVariableAtIndex(index);
-            if (var_sp->GetName() == name)
-                return var_sp;
-        }
-        var_sp.reset();
-        return var_sp;
-    }
-
-    lldb::ExpressionVariableSP
-    GetVariable (const char *name)
-    {
-        lldb::ExpressionVariableSP var_sp;
-        if (name && name[0])
-        {
-            for (size_t index = 0, size = GetSize(); index < size; ++index)
-            {
-                var_sp = GetVariableAtIndex(index);
-                const char *var_name_cstr = var_sp->GetName().GetCString();
-                if (!var_name_cstr || !name)
-                    continue;
-                if (::strcmp (var_name_cstr, name) == 0)
-                    return var_sp;
-            }
-            var_sp.reset();
-        }
-        return var_sp;
-    }
-    
-    void
-    RemoveVariable (lldb::ExpressionVariableSP var_sp)
-    {
-        for (std::vector<lldb::ExpressionVariableSP>::iterator vi = m_variables.begin(), ve = m_variables.end();
-             vi != ve;
-             ++vi)
-        {
-            if (vi->get() == var_sp.get())
-            {
-                m_variables.erase(vi);
-                return;
-            }
-        }
-    }
-    
-    void
-    Clear()
-    {
-        m_variables.clear();
-    }
+  void Clear() { m_variables.clear(); }
 
 private:
-    std::vector <lldb::ExpressionVariableSP> m_variables;
+  std::vector<lldb::ExpressionVariableSP> m_variables;
 };
-    
+
 class PersistentExpressionState : public ExpressionVariableList {
 public:
-    //----------------------------------------------------------------------
-    // See TypeSystem.h for how to add subclasses to this.
-    //----------------------------------------------------------------------
-    enum LLVMCastKind {
-        eKindClang,
-        eKindSwift,
-        eKindGo,
-        kNumKinds
-    };
-    
-    LLVMCastKind getKind() const { return m_kind; }
-    
-    PersistentExpressionState(LLVMCastKind kind) :
-        m_kind(kind)
-    {
-    }
+  //----------------------------------------------------------------------
+  // See TypeSystem.h for how to add subclasses to this.
+  //----------------------------------------------------------------------
+  enum LLVMCastKind { eKindClang, eKindSwift, eKindGo, kNumKinds };
 
-    virtual ~PersistentExpressionState();
+  LLVMCastKind getKind() const { return m_kind; }
+
+  PersistentExpressionState(LLVMCastKind kind) : m_kind(kind) {}
+
+  virtual ~PersistentExpressionState();
+
+  virtual lldb::ExpressionVariableSP
+  CreatePersistentVariable(const lldb::ValueObjectSP &valobj_sp) = 0;
+
+  virtual lldb::ExpressionVariableSP
+  CreatePersistentVariable(ExecutionContextScope *exe_scope,
+                           const ConstString &name, const CompilerType &type,
+                           lldb::ByteOrder byte_order,
+                           uint32_t addr_byte_size) = 0;
+
+  virtual ConstString GetNextPersistentVariableName() = 0;
+
+  virtual void
+  RemovePersistentVariable(lldb::ExpressionVariableSP variable) = 0;
+
+  virtual lldb::addr_t LookupSymbol(const ConstString &name);
+
+  void RegisterExecutionUnit(lldb::IRExecutionUnitSP &execution_unit_sp);
 
-    virtual lldb::ExpressionVariableSP
-    CreatePersistentVariable (const lldb::ValueObjectSP &valobj_sp) = 0;
-    
-    virtual lldb::ExpressionVariableSP
-    CreatePersistentVariable (ExecutionContextScope *exe_scope,
-                              const ConstString &name,
-                              const CompilerType &type,
-                              lldb::ByteOrder byte_order,
-                              uint32_t addr_byte_size) = 0;
-
-    virtual ConstString
-    GetNextPersistentVariableName () = 0;
-    
-    virtual void
-    RemovePersistentVariable (lldb::ExpressionVariableSP variable) = 0;
-    
-    virtual lldb::addr_t
-    LookupSymbol (const ConstString &name);
-    
-    void
-    RegisterExecutionUnit (lldb::IRExecutionUnitSP &execution_unit_sp);
-    
 private:
-    LLVMCastKind m_kind;
-    
-    typedef std::set<lldb::IRExecutionUnitSP>               ExecutionUnitSet;
-    ExecutionUnitSet                                        m_execution_units;              ///< The execution units that contain valuable symbols.
-    
-    typedef llvm::DenseMap<const char *, lldb::addr_t>      SymbolMap;
-    SymbolMap                                               m_symbol_map;                   ///< The addresses of the symbols in m_execution_units.
+  LLVMCastKind m_kind;
+
+  typedef std::set<lldb::IRExecutionUnitSP> ExecutionUnitSet;
+  ExecutionUnitSet
+      m_execution_units; ///< The execution units that contain valuable symbols.
+
+  typedef llvm::DenseMap<const char *, lldb::addr_t> SymbolMap;
+  SymbolMap
+      m_symbol_map; ///< The addresses of the symbols in m_execution_units.
 };
-    
+
 } // namespace lldb_private
 
 #endif // liblldb_ExpressionVariable_h_

Modified: lldb/trunk/include/lldb/Expression/FunctionCaller.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/FunctionCaller.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/FunctionCaller.h (original)
+++ lldb/trunk/include/lldb/Expression/FunctionCaller.h Tue Sep  6 15:57:50 2016
@@ -25,9 +25,8 @@
 #include "lldb/Expression/ExpressionParser.h"
 #include "lldb/Symbol/CompilerType.h"
 
-namespace lldb_private
-{
-    
+namespace lldb_private {
+
 //----------------------------------------------------------------------
 /// @class FunctionCaller FunctionCaller.h "lldb/Expression/FunctionCaller.h"
 /// @brief Encapsulates a function that can be called.
@@ -39,7 +38,7 @@ namespace lldb_private
 /// It performs the call by synthesizing a structure that contains the pointer
 /// to the function and the arguments that should be passed to that function,
 /// and producing a special-purpose JIT-compiled function that accepts a void*
-/// pointing to this struct as its only argument and calls the function in the 
+/// pointing to this struct as its only argument and calls the function in the
 /// struct with the written arguments.  This method lets Clang handle the
 /// vagaries of function calling conventions.
 ///
@@ -51,341 +50,340 @@ namespace lldb_private
 /// InsertFunction() followed by WriteFunctionArguments(), which will return
 /// the location of the args struct for the wrapper function in args_addr_ref.
 ///
-/// If you need to call the function on the thread plan stack, you can also 
+/// If you need to call the function on the thread plan stack, you can also
 /// call InsertFunction() followed by GetThreadPlanToCallFunction().
 ///
 /// Any of the methods that take arg_addr_ptr or arg_addr_ref can be passed
 /// a pointer set to LLDB_INVALID_ADDRESS and new structure will be allocated
 /// and its address returned in that variable.
-/// 
+///
 /// Any of the methods that take arg_addr_ptr can be passed nullptr, and the
 /// argument space will be managed for you.
-//----------------------------------------------------------------------    
-class FunctionCaller : public Expression
-{
+//----------------------------------------------------------------------
+class FunctionCaller : public Expression {
 public:
-    //------------------------------------------------------------------
-    /// Constructor
-    ///
-    /// @param[in] exe_scope
-    ///     An execution context scope that gets us at least a target and 
-    ///     process.
-    ///
-    /// @param[in] ast_context
-    ///     The AST context to evaluate argument types in.
-    ///
-    /// @param[in] return_qualtype
-    ///     An opaque Clang QualType for the function result.  Should be
-    ///     defined in ast_context.
-    ///
-    /// @param[in] function_address
-    ///     The address of the function to call.
-    ///
-    /// @param[in] arg_value_list
-    ///     The default values to use when calling this function.  Can
-    ///     be overridden using WriteFunctionArguments().
-    //------------------------------------------------------------------
-    FunctionCaller (ExecutionContextScope &exe_scope,
-                   const CompilerType &return_type,
-                   const Address& function_address, 
-                   const ValueList &arg_value_list,
-                   const char *name);
-    
-    //------------------------------------------------------------------
-    /// Destructor
-    //------------------------------------------------------------------
-    ~FunctionCaller() override;
-
-    //------------------------------------------------------------------
-    /// Compile the wrapper function
-    ///
-    /// @param[in] thread_to_use_sp
-    ///     Compilation might end up calling functions.  Pass in the thread you
-    ///     want the compilation to use.  If you pass in an empty ThreadSP it will
-    ///     use the currently selected thread.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     The diagnostic manager to report parser errors to.
-    ///
-    /// @return
-    ///     The number of errors.
-    //------------------------------------------------------------------
-    virtual unsigned
-    CompileFunction (lldb::ThreadSP thread_to_use_sp,
-                     DiagnosticManager &diagnostic_manager) = 0;
-
-    //------------------------------------------------------------------
-    /// Insert the default function wrapper and its default argument struct
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to insert the function and its arguments
-    ///     into.
-    ///
-    /// @param[in,out] args_addr_ref
-    ///     The address of the structure to write the arguments into.  May
-    ///     be LLDB_INVALID_ADDRESS; if it is, a new structure is allocated
-    ///     and args_addr_ref is pointed to it.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     The diagnostic manager to report errors to.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool
-    InsertFunction(ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, DiagnosticManager &diagnostic_manager);
-
-    //------------------------------------------------------------------
-    /// Insert the default function wrapper (using the JIT)
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to insert the function and its arguments
-    ///     into.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     The diagnostic manager to report errors to.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool
-    WriteFunctionWrapper(ExecutionContext &exe_ctx, DiagnosticManager &diagnostic_manager);
-
-    //------------------------------------------------------------------
-    /// Insert the default function argument struct
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to insert the function and its arguments
-    ///     into.
-    ///
-    /// @param[in,out] args_addr_ref
-    ///     The address of the structure to write the arguments into.  May
-    ///     be LLDB_INVALID_ADDRESS; if it is, a new structure is allocated
-    ///     and args_addr_ref is pointed to it.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     The diagnostic manager to report errors to.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool
-    WriteFunctionArguments(ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref,
-                           DiagnosticManager &diagnostic_manager);
-
-    //------------------------------------------------------------------
-    /// Insert an argument struct with a non-default function address and
-    /// non-default argument values
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to insert the function and its arguments
-    ///     into.
-    ///
-    /// @param[in,out] args_addr_ref
-    ///     The address of the structure to write the arguments into.  May
-    ///     be LLDB_INVALID_ADDRESS; if it is, a new structure is allocated
-    ///     and args_addr_ref is pointed at it.
-    ///
-    /// @param[in] arg_values
-    ///     The values of the function's arguments.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     The diagnostic manager to report errors to.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool
-    WriteFunctionArguments(ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, ValueList &arg_values,
-                           DiagnosticManager &diagnostic_manager);
-
-    //------------------------------------------------------------------
-    /// Run the function this FunctionCaller was created with.
-    ///
-    /// This is the full version.
-    ///
-    /// @param[in] exe_ctx
-    ///     The thread & process in which this function will run.
-    ///
-    /// @param[in] args_addr_ptr
-    ///     If nullptr, the function will take care of allocating & deallocating the wrapper
-    ///     args structure.  Otherwise, if set to LLDB_INVALID_ADDRESS, a new structure
-    ///     will be allocated, filled and the address returned to you.  You are responsible
-    ///     for deallocating it.  And if passed in with a value other than LLDB_INVALID_ADDRESS,
-    ///     this should point to an already allocated structure with the values already written.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     The diagnostic manager to report errors to.
-    ///
-    /// @param[in] options
-    ///     The options for this expression execution.
-    ///
-    /// @param[out] results
-    ///     The result value will be put here after running the function.
-    ///
-    /// @return
-    ///     Returns one of the ExpressionResults enum indicating function call status.
-    //------------------------------------------------------------------
-    lldb::ExpressionResults
-    ExecuteFunction(ExecutionContext &exe_ctx, lldb::addr_t *args_addr_ptr, const EvaluateExpressionOptions &options,
-                    DiagnosticManager &diagnostic_manager, Value &results);
-
-    //------------------------------------------------------------------
-    /// Get a thread plan to run the function this FunctionCaller was created with.
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to insert the function and its arguments
-    ///     into.
-    ///
-    /// @param[in] func_addr
-    ///     The address of the function in the target process.
-    ///
-    /// @param[in] args_addr
-    ///     The address of the argument struct.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     The diagnostic manager to report errors to.
-    ///
-    /// @param[in] stop_others
-    ///     True if other threads should pause during execution.
-    ///
-    /// @param[in] unwind_on_error
-    ///     True if the thread plan may simply be discarded if an error occurs.
-    ///
-    /// @return
-    ///     A ThreadPlan shared pointer for executing the function.
-    //------------------------------------------------------------------
-    lldb::ThreadPlanSP
-    GetThreadPlanToCallFunction(ExecutionContext &exe_ctx, lldb::addr_t args_addr,
-                                const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager);
-
-    //------------------------------------------------------------------
-    /// Get the result of the function from its struct
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to retrieve the result from.
-    ///
-    /// @param[in] args_addr
-    ///     The address of the argument struct.
-    ///
-    /// @param[out] ret_value
-    ///     The value returned by the function.
-    ///
-    /// @return
-    ///     True on success; false otherwise.
-    //------------------------------------------------------------------
-    bool FetchFunctionResults (ExecutionContext &exe_ctx, 
-                               lldb::addr_t args_addr, 
-                               Value &ret_value);
-    
-    //------------------------------------------------------------------
-    /// Deallocate the arguments structure
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to insert the function and its arguments
-    ///     into.
-    ///
-    /// @param[in] args_addr
-    ///     The address of the argument struct.
-    //------------------------------------------------------------------
-    void DeallocateFunctionResults (ExecutionContext &exe_ctx, 
-                                    lldb::addr_t args_addr);
-    
-    //------------------------------------------------------------------
-    /// Interface for ClangExpression
-    //------------------------------------------------------------------
-    
-    //------------------------------------------------------------------
-    /// Return the string that the parser should parse.  Must be a full
-    /// translation unit.
-    //------------------------------------------------------------------
-    const char *
-    Text() override
-    {
-        return m_wrapper_function_text.c_str();
-    }
-    
-    //------------------------------------------------------------------
-    /// Return the function name that should be used for executing the
-    /// expression.  Text() should contain the definition of this
-    /// function.
-    //------------------------------------------------------------------
-    const char *
-    FunctionName() override
-    {
-        return m_wrapper_function_name.c_str();
-    }
-    
-    //------------------------------------------------------------------
-    /// Return the object that the parser should use when registering
-    /// local variables. May be nullptr if the Expression doesn't care.
-    //------------------------------------------------------------------
-    ExpressionVariableList *
-    LocalVariables ()
-    {
-        return nullptr;
-    }
-    
-    //------------------------------------------------------------------
-    /// Return true if validation code should be inserted into the
-    /// expression.
-    //------------------------------------------------------------------
-    bool
-    NeedsValidation() override
-    {
-        return false;
-    }
-    
-    //------------------------------------------------------------------
-    /// Return true if external variables in the expression should be
-    /// resolved.
-    //------------------------------------------------------------------
-    bool
-    NeedsVariableResolution() override
-    {
-        return false;
-    }
-    
-    ValueList
-    GetArgumentValues () const
-    {
-        return m_arg_values;
-    }
+  //------------------------------------------------------------------
+  /// Constructor
+  ///
+  /// @param[in] exe_scope
+  ///     An execution context scope that gets us at least a target and
+  ///     process.
+  ///
+  /// @param[in] ast_context
+  ///     The AST context to evaluate argument types in.
+  ///
+  /// @param[in] return_qualtype
+  ///     An opaque Clang QualType for the function result.  Should be
+  ///     defined in ast_context.
+  ///
+  /// @param[in] function_address
+  ///     The address of the function to call.
+  ///
+  /// @param[in] arg_value_list
+  ///     The default values to use when calling this function.  Can
+  ///     be overridden using WriteFunctionArguments().
+  //------------------------------------------------------------------
+  FunctionCaller(ExecutionContextScope &exe_scope,
+                 const CompilerType &return_type,
+                 const Address &function_address,
+                 const ValueList &arg_value_list, const char *name);
+
+  //------------------------------------------------------------------
+  /// Destructor
+  //------------------------------------------------------------------
+  ~FunctionCaller() override;
+
+  //------------------------------------------------------------------
+  /// Compile the wrapper function
+  ///
+  /// @param[in] thread_to_use_sp
+  ///     Compilation might end up calling functions.  Pass in the thread you
+  ///     want the compilation to use.  If you pass in an empty ThreadSP it will
+  ///     use the currently selected thread.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     The diagnostic manager to report parser errors to.
+  ///
+  /// @return
+  ///     The number of errors.
+  //------------------------------------------------------------------
+  virtual unsigned CompileFunction(lldb::ThreadSP thread_to_use_sp,
+                                   DiagnosticManager &diagnostic_manager) = 0;
+
+  //------------------------------------------------------------------
+  /// Insert the default function wrapper and its default argument struct
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to insert the function and its arguments
+  ///     into.
+  ///
+  /// @param[in,out] args_addr_ref
+  ///     The address of the structure to write the arguments into.  May
+  ///     be LLDB_INVALID_ADDRESS; if it is, a new structure is allocated
+  ///     and args_addr_ref is pointed to it.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     The diagnostic manager to report errors to.
+  ///
+  /// @return
+  ///     True on success; false otherwise.
+  //------------------------------------------------------------------
+  bool InsertFunction(ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref,
+                      DiagnosticManager &diagnostic_manager);
+
+  //------------------------------------------------------------------
+  /// Insert the default function wrapper (using the JIT)
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to insert the function and its arguments
+  ///     into.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     The diagnostic manager to report errors to.
+  ///
+  /// @return
+  ///     True on success; false otherwise.
+  //------------------------------------------------------------------
+  bool WriteFunctionWrapper(ExecutionContext &exe_ctx,
+                            DiagnosticManager &diagnostic_manager);
+
+  //------------------------------------------------------------------
+  /// Insert the default function argument struct
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to insert the function and its arguments
+  ///     into.
+  ///
+  /// @param[in,out] args_addr_ref
+  ///     The address of the structure to write the arguments into.  May
+  ///     be LLDB_INVALID_ADDRESS; if it is, a new structure is allocated
+  ///     and args_addr_ref is pointed to it.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     The diagnostic manager to report errors to.
+  ///
+  /// @return
+  ///     True on success; false otherwise.
+  //------------------------------------------------------------------
+  bool WriteFunctionArguments(ExecutionContext &exe_ctx,
+                              lldb::addr_t &args_addr_ref,
+                              DiagnosticManager &diagnostic_manager);
+
+  //------------------------------------------------------------------
+  /// Insert an argument struct with a non-default function address and
+  /// non-default argument values
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to insert the function and its arguments
+  ///     into.
+  ///
+  /// @param[in,out] args_addr_ref
+  ///     The address of the structure to write the arguments into.  May
+  ///     be LLDB_INVALID_ADDRESS; if it is, a new structure is allocated
+  ///     and args_addr_ref is pointed at it.
+  ///
+  /// @param[in] arg_values
+  ///     The values of the function's arguments.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     The diagnostic manager to report errors to.
+  ///
+  /// @return
+  ///     True on success; false otherwise.
+  //------------------------------------------------------------------
+  bool WriteFunctionArguments(ExecutionContext &exe_ctx,
+                              lldb::addr_t &args_addr_ref,
+                              ValueList &arg_values,
+                              DiagnosticManager &diagnostic_manager);
+
+  //------------------------------------------------------------------
+  /// Run the function this FunctionCaller was created with.
+  ///
+  /// This is the full version.
+  ///
+  /// @param[in] exe_ctx
+  ///     The thread & process in which this function will run.
+  ///
+  /// @param[in] args_addr_ptr
+  ///     If nullptr, the function will take care of allocating & deallocating
+  ///     the wrapper
+  ///     args structure.  Otherwise, if set to LLDB_INVALID_ADDRESS, a new
+  ///     structure
+  ///     will be allocated, filled and the address returned to you.  You are
+  ///     responsible
+  ///     for deallocating it.  And if passed in with a value other than
+  ///     LLDB_INVALID_ADDRESS,
+  ///     this should point to an already allocated structure with the values
+  ///     already written.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     The diagnostic manager to report errors to.
+  ///
+  /// @param[in] options
+  ///     The options for this expression execution.
+  ///
+  /// @param[out] results
+  ///     The result value will be put here after running the function.
+  ///
+  /// @return
+  ///     Returns one of the ExpressionResults enum indicating function call
+  ///     status.
+  //------------------------------------------------------------------
+  lldb::ExpressionResults
+  ExecuteFunction(ExecutionContext &exe_ctx, lldb::addr_t *args_addr_ptr,
+                  const EvaluateExpressionOptions &options,
+                  DiagnosticManager &diagnostic_manager, Value &results);
+
+  //------------------------------------------------------------------
+  /// Get a thread plan to run the function this FunctionCaller was created
+  /// with.
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to insert the function and its arguments
+  ///     into.
+  ///
+  /// @param[in] func_addr
+  ///     The address of the function in the target process.
+  ///
+  /// @param[in] args_addr
+  ///     The address of the argument struct.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     The diagnostic manager to report errors to.
+  ///
+  /// @param[in] stop_others
+  ///     True if other threads should pause during execution.
+  ///
+  /// @param[in] unwind_on_error
+  ///     True if the thread plan may simply be discarded if an error occurs.
+  ///
+  /// @return
+  ///     A ThreadPlan shared pointer for executing the function.
+  //------------------------------------------------------------------
+  lldb::ThreadPlanSP
+  GetThreadPlanToCallFunction(ExecutionContext &exe_ctx, lldb::addr_t args_addr,
+                              const EvaluateExpressionOptions &options,
+                              DiagnosticManager &diagnostic_manager);
+
+  //------------------------------------------------------------------
+  /// Get the result of the function from its struct
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to retrieve the result from.
+  ///
+  /// @param[in] args_addr
+  ///     The address of the argument struct.
+  ///
+  /// @param[out] ret_value
+  ///     The value returned by the function.
+  ///
+  /// @return
+  ///     True on success; false otherwise.
+  //------------------------------------------------------------------
+  bool FetchFunctionResults(ExecutionContext &exe_ctx, lldb::addr_t args_addr,
+                            Value &ret_value);
+
+  //------------------------------------------------------------------
+  /// Deallocate the arguments structure
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to insert the function and its arguments
+  ///     into.
+  ///
+  /// @param[in] args_addr
+  ///     The address of the argument struct.
+  //------------------------------------------------------------------
+  void DeallocateFunctionResults(ExecutionContext &exe_ctx,
+                                 lldb::addr_t args_addr);
+
+  //------------------------------------------------------------------
+  /// Interface for ClangExpression
+  //------------------------------------------------------------------
+
+  //------------------------------------------------------------------
+  /// Return the string that the parser should parse.  Must be a full
+  /// translation unit.
+  //------------------------------------------------------------------
+  const char *Text() override { return m_wrapper_function_text.c_str(); }
+
+  //------------------------------------------------------------------
+  /// Return the function name that should be used for executing the
+  /// expression.  Text() should contain the definition of this
+  /// function.
+  //------------------------------------------------------------------
+  const char *FunctionName() override {
+    return m_wrapper_function_name.c_str();
+  }
+
+  //------------------------------------------------------------------
+  /// Return the object that the parser should use when registering
+  /// local variables. May be nullptr if the Expression doesn't care.
+  //------------------------------------------------------------------
+  ExpressionVariableList *LocalVariables() { return nullptr; }
+
+  //------------------------------------------------------------------
+  /// Return true if validation code should be inserted into the
+  /// expression.
+  //------------------------------------------------------------------
+  bool NeedsValidation() override { return false; }
+
+  //------------------------------------------------------------------
+  /// Return true if external variables in the expression should be
+  /// resolved.
+  //------------------------------------------------------------------
+  bool NeedsVariableResolution() override { return false; }
+
+  ValueList GetArgumentValues() const { return m_arg_values; }
 
 protected:
-    // Note: the parser needs to be destructed before the execution unit, so
-    // declare the execution unit first.
-    std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
-    std::unique_ptr<ExpressionParser> m_parser;                     ///< The parser responsible for compiling the function.
-                                                                    ///< This will get made in CompileFunction, so it is
-                                                                    ///< safe to access it after that.
-
-    lldb::ModuleWP                  m_jit_module_wp;
-    std::string                     m_name;                         ///< The name of this clang function - for debugging purposes.
-    
-    Function                       *m_function_ptr;                 ///< The function we're going to call. May be nullptr if we don't have debug info for the function.
-    Address                         m_function_addr;                ///< If we don't have the FunctionSP, we at least need the address & return type.
-    CompilerType                    m_function_return_type;         ///< The opaque clang qual type for the function return type.
-
-    std::string                     m_wrapper_function_name;        ///< The name of the wrapper function.
-    std::string                     m_wrapper_function_text;        ///< The contents of the wrapper function.
-    std::string                     m_wrapper_struct_name;          ///< The name of the struct that contains the target function address, arguments, and result.
-    std::list<lldb::addr_t>         m_wrapper_args_addrs;           ///< The addresses of the arguments to the wrapper function.
-    
-    bool                            m_struct_valid;                 ///< True if the ASTStructExtractor has populated the variables below.
-    
-    //------------------------------------------------------------------
-    /// These values are populated by the ASTStructExtractor
-    size_t                          m_struct_size;                  ///< The size of the argument struct, in bytes.
-    std::vector<uint64_t>           m_member_offsets;               ///< The offset of each member in the struct, in bytes.
-    uint64_t                        m_return_size;                  ///< The size of the result variable, in bytes.
-    uint64_t                        m_return_offset;                ///< The offset of the result variable in the struct, in bytes.
-    //------------------------------------------------------------------
-
-    ValueList                       m_arg_values;                   ///< The default values of the arguments.
-    
-    bool                            m_compiled;                     ///< True if the wrapper function has already been parsed.
-    bool                            m_JITted;                       ///< True if the wrapper function has already been JIT-compiled.
+  // Note: the parser needs to be destructed before the execution unit, so
+  // declare the execution unit first.
+  std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
+  std::unique_ptr<ExpressionParser>
+      m_parser; ///< The parser responsible for compiling the function.
+                ///< This will get made in CompileFunction, so it is
+                ///< safe to access it after that.
+
+  lldb::ModuleWP m_jit_module_wp;
+  std::string
+      m_name; ///< The name of this clang function - for debugging purposes.
+
+  Function *m_function_ptr; ///< The function we're going to call. May be
+                            ///nullptr if we don't have debug info for the
+                            ///function.
+  Address m_function_addr;  ///< If we don't have the FunctionSP, we at least
+                            ///need the address & return type.
+  CompilerType m_function_return_type; ///< The opaque clang qual type for the
+                                       ///function return type.
+
+  std::string m_wrapper_function_name; ///< The name of the wrapper function.
+  std::string
+      m_wrapper_function_text;       ///< The contents of the wrapper function.
+  std::string m_wrapper_struct_name; ///< The name of the struct that contains
+                                     ///the target function address, arguments,
+                                     ///and result.
+  std::list<lldb::addr_t> m_wrapper_args_addrs; ///< The addresses of the
+                                                ///arguments to the wrapper
+                                                ///function.
+
+  bool m_struct_valid; ///< True if the ASTStructExtractor has populated the
+                       ///variables below.
+
+  //------------------------------------------------------------------
+  /// These values are populated by the ASTStructExtractor
+  size_t m_struct_size; ///< The size of the argument struct, in bytes.
+  std::vector<uint64_t>
+      m_member_offsets; ///< The offset of each member in the struct, in bytes.
+  uint64_t m_return_size;   ///< The size of the result variable, in bytes.
+  uint64_t m_return_offset; ///< The offset of the result variable in the
+                            ///struct, in bytes.
+  //------------------------------------------------------------------
+
+  ValueList m_arg_values; ///< The default values of the arguments.
+
+  bool m_compiled; ///< True if the wrapper function has already been parsed.
+  bool
+      m_JITted; ///< True if the wrapper function has already been JIT-compiled.
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Expression/IRDynamicChecks.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRDynamicChecks.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRDynamicChecks.h (original)
+++ lldb/trunk/include/lldb/Expression/IRDynamicChecks.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- IRDynamicChecks.h ---------------------------------------------*- C++ -*-===//
+//===-- IRDynamicChecks.h ---------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,25 +15,25 @@
 #include "llvm/Pass.h"
 
 namespace llvm {
-    class BasicBlock;
-    class CallInst;
-    class Constant;
-    class Function;
-    class Instruction;
-    class Module;
-    class DataLayout;
-    class Value;
+class BasicBlock;
+class CallInst;
+class Constant;
+class Function;
+class Instruction;
+class Module;
+class DataLayout;
+class Value;
 }
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class ClangExpressionDeclMap;
 class ExecutionContext;
 class Stream;
 
 //----------------------------------------------------------------------
-/// @class DynamicCheckerFunctions IRDynamicChecks.h "lldb/Expression/IRDynamicChecks.h"
+/// @class DynamicCheckerFunctions IRDynamicChecks.h
+/// "lldb/Expression/IRDynamicChecks.h"
 /// @brief Encapsulates dynamic check functions used by expressions.
 ///
 /// Each of the utility functions encapsulated in this class is responsible
@@ -44,46 +45,45 @@ class Stream;
 /// The class installs each checker function into the target process and
 /// makes it available to IRDynamicChecks to use.
 //----------------------------------------------------------------------
-class DynamicCheckerFunctions
-{
+class DynamicCheckerFunctions {
 public:
-    //------------------------------------------------------------------
-    /// Constructor
-    //------------------------------------------------------------------
-    DynamicCheckerFunctions ();
-    
-    //------------------------------------------------------------------
-    /// Destructor
-    //------------------------------------------------------------------
-    ~DynamicCheckerFunctions ();
-    
-    //------------------------------------------------------------------
-    /// Install the utility functions into a process.  This binds the
-    /// instance of DynamicCheckerFunctions to that process.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     A diagnostic manager to report errors to.
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to install the functions into.
-    ///
-    /// @return
-    ///     True on success; false on failure, or if the functions have
-    ///     already been installed.
-    //------------------------------------------------------------------
-    bool
-    Install(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx);
+  //------------------------------------------------------------------
+  /// Constructor
+  //------------------------------------------------------------------
+  DynamicCheckerFunctions();
+
+  //------------------------------------------------------------------
+  /// Destructor
+  //------------------------------------------------------------------
+  ~DynamicCheckerFunctions();
+
+  //------------------------------------------------------------------
+  /// Install the utility functions into a process.  This binds the
+  /// instance of DynamicCheckerFunctions to that process.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     A diagnostic manager to report errors to.
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to install the functions into.
+  ///
+  /// @return
+  ///     True on success; false on failure, or if the functions have
+  ///     already been installed.
+  //------------------------------------------------------------------
+  bool Install(DiagnosticManager &diagnostic_manager,
+               ExecutionContext &exe_ctx);
 
-    bool
-    DoCheckersExplainStop(lldb::addr_t addr, Stream &message);
+  bool DoCheckersExplainStop(lldb::addr_t addr, Stream &message);
 
-    std::unique_ptr<UtilityFunction> m_valid_pointer_check;
-    std::unique_ptr<UtilityFunction> m_objc_object_check;
+  std::unique_ptr<UtilityFunction> m_valid_pointer_check;
+  std::unique_ptr<UtilityFunction> m_objc_object_check;
 };
 
 //----------------------------------------------------------------------
 /// @class IRDynamicChecks IRDynamicChecks.h "lldb/Expression/IRDynamicChecks.h"
-/// @brief Adds dynamic checks to a user-entered expression to reduce its likelihood of crashing
+/// @brief Adds dynamic checks to a user-entered expression to reduce its
+/// likelihood of crashing
 ///
 /// When an IR function is executed in the target process, it may cause
 /// crashes or hangs by dereferencing NULL pointers, trying to call Objective-C
@@ -92,79 +92,79 @@ public:
 /// IRDynamicChecks adds calls to the functions in DynamicCheckerFunctions
 /// to appropriate locations in an expression's IR.
 //----------------------------------------------------------------------
-class IRDynamicChecks : public llvm::ModulePass
-{
+class IRDynamicChecks : public llvm::ModulePass {
 public:
-    //------------------------------------------------------------------
-    /// Constructor
-    ///
-    /// @param[in] checker_functions
-    ///     The checker functions for the target process.
-    ///
-    /// @param[in] func_name
-    ///     The name of the function to prepare for execution in the target.
-    ///
-    /// @param[in] decl_map
-    ///     The mapping used to look up entities in the target process. In
-    ///     this case, used to find objc_msgSend
-    //------------------------------------------------------------------
-    IRDynamicChecks (DynamicCheckerFunctions &checker_functions,
-                     const char* func_name = "$__lldb_expr");
-    
-    //------------------------------------------------------------------
-    /// Destructor
-    //------------------------------------------------------------------
-    ~IRDynamicChecks() override;
-    
-    //------------------------------------------------------------------
-    /// Run this IR transformer on a single module
-    ///
-    /// @param[in] M
-    ///     The module to run on.  This module is searched for the function
-    ///     $__lldb_expr, and that function is passed to the passes one by 
-    ///     one.
-    ///
-    /// @return
-    ///     True on success; false otherwise
-    //------------------------------------------------------------------
-    bool runOnModule(llvm::Module &M) override;
-    
-    //------------------------------------------------------------------
-    /// Interface stub
-    //------------------------------------------------------------------
-    void assignPassManager(llvm::PMStack &PMS,
-                           llvm::PassManagerType T = llvm::PMT_ModulePassManager)  override;
-    
-    //------------------------------------------------------------------
-    /// Returns PMT_ModulePassManager
-    //------------------------------------------------------------------
-    llvm::PassManagerType getPotentialPassManagerType() const override;
+  //------------------------------------------------------------------
+  /// Constructor
+  ///
+  /// @param[in] checker_functions
+  ///     The checker functions for the target process.
+  ///
+  /// @param[in] func_name
+  ///     The name of the function to prepare for execution in the target.
+  ///
+  /// @param[in] decl_map
+  ///     The mapping used to look up entities in the target process. In
+  ///     this case, used to find objc_msgSend
+  //------------------------------------------------------------------
+  IRDynamicChecks(DynamicCheckerFunctions &checker_functions,
+                  const char *func_name = "$__lldb_expr");
+
+  //------------------------------------------------------------------
+  /// Destructor
+  //------------------------------------------------------------------
+  ~IRDynamicChecks() override;
+
+  //------------------------------------------------------------------
+  /// Run this IR transformer on a single module
+  ///
+  /// @param[in] M
+  ///     The module to run on.  This module is searched for the function
+  ///     $__lldb_expr, and that function is passed to the passes one by
+  ///     one.
+  ///
+  /// @return
+  ///     True on success; false otherwise
+  //------------------------------------------------------------------
+  bool runOnModule(llvm::Module &M) override;
+
+  //------------------------------------------------------------------
+  /// Interface stub
+  //------------------------------------------------------------------
+  void assignPassManager(
+      llvm::PMStack &PMS,
+      llvm::PassManagerType T = llvm::PMT_ModulePassManager) override;
+
+  //------------------------------------------------------------------
+  /// Returns PMT_ModulePassManager
+  //------------------------------------------------------------------
+  llvm::PassManagerType getPotentialPassManagerType() const override;
 
 private:
-    //------------------------------------------------------------------
-    /// A basic block-level pass to find all pointer dereferences and
-    /// validate them before use.
-    //------------------------------------------------------------------
-    
-    //------------------------------------------------------------------
-    /// The top-level pass implementation
-    ///
-    /// @param[in] M
-    ///     The module currently being processed.
-    ///
-    /// @param[in] BB
-    ///     The basic block currently being processed.
-    ///
-    /// @return
-    ///     True on success; false otherwise
-    //------------------------------------------------------------------
-    bool FindDataLoads(llvm::Module &M, 
-                       llvm::BasicBlock &BB);
-    
-    std::string                 m_func_name;            ///< The name of the function to add checks to
-    DynamicCheckerFunctions    &m_checker_functions;    ///< The checker functions for the process
+  //------------------------------------------------------------------
+  /// A basic block-level pass to find all pointer dereferences and
+  /// validate them before use.
+  //------------------------------------------------------------------
+
+  //------------------------------------------------------------------
+  /// The top-level pass implementation
+  ///
+  /// @param[in] M
+  ///     The module currently being processed.
+  ///
+  /// @param[in] BB
+  ///     The basic block currently being processed.
+  ///
+  /// @return
+  ///     True on success; false otherwise
+  //------------------------------------------------------------------
+  bool FindDataLoads(llvm::Module &M, llvm::BasicBlock &BB);
+
+  std::string m_func_name; ///< The name of the function to add checks to
+  DynamicCheckerFunctions
+      &m_checker_functions; ///< The checker functions for the process
 };
-    
+
 } // namespace lldb_private
 
 #endif // liblldb_IRDynamicChecks_h_

Modified: lldb/trunk/include/lldb/Expression/IRExecutionUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRExecutionUnit.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRExecutionUnit.h (original)
+++ lldb/trunk/include/lldb/Expression/IRExecutionUnit.h Tue Sep  6 15:57:50 2016
@@ -18,28 +18,28 @@
 #include <vector>
 
 // Other libraries and framework includes
-#include "llvm/IR/Module.h"
 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
+#include "llvm/IR/Module.h"
 
 // Project includes
-#include "lldb/lldb-forward.h"
-#include "lldb/lldb-private.h"
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Expression/IRMemoryMap.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolContext.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private.h"
 
 namespace llvm {
-    
+
 class Module;
 class ExecutionEngine;
-    
+
 } // namespace llvm
 
 namespace lldb_private {
 
 class Error;
-    
+
 //----------------------------------------------------------------------
 /// @class IRExecutionUnit IRExecutionUnit.h "lldb/Expression/IRExecutionUnit.h"
 /// @brief Contains the IR and, optionally, JIT-compiled code for a module.
@@ -52,427 +52,382 @@ class Error;
 /// and knows how to use the JIT to make it into executable code.  It can
 /// then be used as input to the IR interpreter, or the address of the
 /// executable code can be passed to a thread plan to run in the target.
-/// 
-/// This class creates a subclass of LLVM's SectionMemoryManager, because that is
+///
+/// This class creates a subclass of LLVM's SectionMemoryManager, because that
+/// is
 /// how the JIT emits code.  Because LLDB needs to move JIT-compiled code
 /// into the target process, the IRExecutionUnit knows how to copy the
 /// emitted code into the target process.
 //----------------------------------------------------------------------
-class IRExecutionUnit :
-    public std::enable_shared_from_this<IRExecutionUnit>,
-    public IRMemoryMap,
-    public ObjectFileJITDelegate
-{
+class IRExecutionUnit : public std::enable_shared_from_this<IRExecutionUnit>,
+                        public IRMemoryMap,
+                        public ObjectFileJITDelegate {
 public:
-    //------------------------------------------------------------------
-    /// Constructor
-    //------------------------------------------------------------------
-    IRExecutionUnit (std::unique_ptr<llvm::LLVMContext> &context_ap,
-                     std::unique_ptr<llvm::Module> &module_ap,
-                     ConstString &name,
-                     const lldb::TargetSP &target_sp,
-                     const SymbolContext &sym_ctx,
-                     std::vector<std::string> &cpu_features);
-    
-    //------------------------------------------------------------------
-    /// Destructor
-    //------------------------------------------------------------------
-    ~IRExecutionUnit() override;
-    
-    ConstString GetFunctionName()
-    {
-        return m_name;
-    }
-    
-    llvm::Module *
-    GetModule()
-    {
-        return m_module;
-    }
-    
-    llvm::Function *
-    GetFunction()
-    {
-        return ((m_module != nullptr) ? m_module->getFunction(m_name.AsCString()) : nullptr);
-    }
-    
-    void
-    GetRunnableInfo (Error &error,
-                     lldb::addr_t &func_addr,
-                     lldb::addr_t &func_end);
-    
-    //------------------------------------------------------------------
-    /// Accessors for IRForTarget and other clients that may want binary
-    /// data placed on their behalf.  The binary data is owned by the
-    /// IRExecutionUnit unless the client explicitly chooses to free it.
-    //------------------------------------------------------------------
-    
+  //------------------------------------------------------------------
+  /// Constructor
+  //------------------------------------------------------------------
+  IRExecutionUnit(std::unique_ptr<llvm::LLVMContext> &context_ap,
+                  std::unique_ptr<llvm::Module> &module_ap, ConstString &name,
+                  const lldb::TargetSP &target_sp, const SymbolContext &sym_ctx,
+                  std::vector<std::string> &cpu_features);
+
+  //------------------------------------------------------------------
+  /// Destructor
+  //------------------------------------------------------------------
+  ~IRExecutionUnit() override;
+
+  ConstString GetFunctionName() { return m_name; }
+
+  llvm::Module *GetModule() { return m_module; }
+
+  llvm::Function *GetFunction() {
+    return ((m_module != nullptr) ? m_module->getFunction(m_name.AsCString())
+                                  : nullptr);
+  }
+
+  void GetRunnableInfo(Error &error, lldb::addr_t &func_addr,
+                       lldb::addr_t &func_end);
+
+  //------------------------------------------------------------------
+  /// Accessors for IRForTarget and other clients that may want binary
+  /// data placed on their behalf.  The binary data is owned by the
+  /// IRExecutionUnit unless the client explicitly chooses to free it.
+  //------------------------------------------------------------------
+
+  lldb::addr_t WriteNow(const uint8_t *bytes, size_t size, Error &error);
+
+  void FreeNow(lldb::addr_t allocation);
+
+  //------------------------------------------------------------------
+  /// ObjectFileJITDelegate overrides
+  //------------------------------------------------------------------
+  lldb::ByteOrder GetByteOrder() const override;
+
+  uint32_t GetAddressByteSize() const override;
+
+  void PopulateSymtab(lldb_private::ObjectFile *obj_file,
+                      lldb_private::Symtab &symtab) override;
+
+  void PopulateSectionList(lldb_private::ObjectFile *obj_file,
+                           lldb_private::SectionList &section_list) override;
+
+  bool GetArchitecture(lldb_private::ArchSpec &arch) override;
+
+  lldb::ModuleSP GetJITModule();
+
+  lldb::addr_t FindSymbol(const ConstString &name);
+
+  void GetStaticInitializers(std::vector<lldb::addr_t> &static_initializers);
+
+  //----------------------------------------------------------------------
+  /// @class JittedFunction IRExecutionUnit.h
+  /// "lldb/Expression/IRExecutionUnit.h"
+  /// @brief Encapsulates a single function that has been generated by the JIT.
+  ///
+  /// Functions that have been generated by the JIT are first resident in the
+  /// local process, and then placed in the target process.  JittedFunction
+  /// represents a function possibly resident in both.
+  //----------------------------------------------------------------------
+  struct JittedEntity {
+    ConstString m_name;        ///< The function's name
+    lldb::addr_t m_local_addr; ///< The address of the function in LLDB's memory
     lldb::addr_t
-    WriteNow (const uint8_t *bytes,
-              size_t size,
-              Error &error);
-    
-    void
-    FreeNow (lldb::addr_t allocation);
-    
-    //------------------------------------------------------------------
-    /// ObjectFileJITDelegate overrides
+        m_remote_addr; ///< The address of the function in the target's memory
+
     //------------------------------------------------------------------
-    lldb::ByteOrder
-    GetByteOrder() const override;
-    
-    uint32_t
-    GetAddressByteSize() const override;
-    
-    void
-    PopulateSymtab(lldb_private::ObjectFile *obj_file,
-		   lldb_private::Symtab &symtab) override;
-    
-    void
-    PopulateSectionList(lldb_private::ObjectFile *obj_file,
-			lldb_private::SectionList &section_list) override;
-    
-    bool
-    GetArchitecture(lldb_private::ArchSpec &arch) override;
-    
-    lldb::ModuleSP
-    GetJITModule ();
-        
-    lldb::addr_t
-    FindSymbol(const ConstString &name);
-    
-    void
-    GetStaticInitializers(std::vector <lldb::addr_t> &static_initializers);
-    
-    //----------------------------------------------------------------------
-    /// @class JittedFunction IRExecutionUnit.h "lldb/Expression/IRExecutionUnit.h"
-    /// @brief Encapsulates a single function that has been generated by the JIT.
-    ///
-    /// Functions that have been generated by the JIT are first resident in the
-    /// local process, and then placed in the target process.  JittedFunction
-    /// represents a function possibly resident in both.
-    //----------------------------------------------------------------------
-    struct JittedEntity {
-        ConstString m_name;             ///< The function's name
-        lldb::addr_t m_local_addr;      ///< The address of the function in LLDB's memory
-        lldb::addr_t m_remote_addr;     ///< The address of the function in the target's memory
-        
-        //------------------------------------------------------------------
-        /// Constructor
-        ///
-        /// Initializes class variabes.
-        ///
-        /// @param[in] name
-        ///     The name of the function.
-        ///
-        /// @param[in] local_addr
-        ///     The address of the function in LLDB, or LLDB_INVALID_ADDRESS if
-        ///     it is not present in LLDB's memory.
-        ///
-        /// @param[in] remote_addr
-        ///     The address of the function in the target, or LLDB_INVALID_ADDRESS
-        ///     if it is not present in the target's memory.
-        //------------------------------------------------------------------
-        JittedEntity (const char *name,
-                      lldb::addr_t local_addr = LLDB_INVALID_ADDRESS,
-                      lldb::addr_t remote_addr = LLDB_INVALID_ADDRESS) :
-        m_name (name),
-        m_local_addr (local_addr),
-        m_remote_addr (remote_addr)
-        {
-        }
-    };
-    
-    struct JittedFunction : JittedEntity
-    {
-        bool m_external;
-        JittedFunction (const char *name,
-                        bool external,
-                        lldb::addr_t local_addr = LLDB_INVALID_ADDRESS,
-                        lldb::addr_t remote_addr = LLDB_INVALID_ADDRESS) :
-        JittedEntity (name, local_addr, remote_addr),
-        m_external(external)
-        {}
-    };
-    
-    struct JittedGlobalVariable : JittedEntity
-    {
-        JittedGlobalVariable (const char *name,
-                              lldb::addr_t local_addr = LLDB_INVALID_ADDRESS,
-                              lldb::addr_t remote_addr = LLDB_INVALID_ADDRESS) :
-        JittedEntity (name, local_addr, remote_addr)
-        {}
-    };
-    
-    const std::vector<JittedFunction> &GetJittedFunctions()
-    {
-        return m_jitted_functions;
-    }
-    
-    const std::vector<JittedGlobalVariable> &GetJittedGlobalVariables()
-    {
-        return m_jitted_global_variables;
-    }
+    /// Constructor
+    ///
+    /// Initializes class variabes.
+    ///
+    /// @param[in] name
+    ///     The name of the function.
+    ///
+    /// @param[in] local_addr
+    ///     The address of the function in LLDB, or LLDB_INVALID_ADDRESS if
+    ///     it is not present in LLDB's memory.
+    ///
+    /// @param[in] remote_addr
+    ///     The address of the function in the target, or LLDB_INVALID_ADDRESS
+    ///     if it is not present in the target's memory.
+    //------------------------------------------------------------------
+    JittedEntity(const char *name,
+                 lldb::addr_t local_addr = LLDB_INVALID_ADDRESS,
+                 lldb::addr_t remote_addr = LLDB_INVALID_ADDRESS)
+        : m_name(name), m_local_addr(local_addr), m_remote_addr(remote_addr) {}
+  };
+
+  struct JittedFunction : JittedEntity {
+    bool m_external;
+    JittedFunction(const char *name, bool external,
+                   lldb::addr_t local_addr = LLDB_INVALID_ADDRESS,
+                   lldb::addr_t remote_addr = LLDB_INVALID_ADDRESS)
+        : JittedEntity(name, local_addr, remote_addr), m_external(external) {}
+  };
+
+  struct JittedGlobalVariable : JittedEntity {
+    JittedGlobalVariable(const char *name,
+                         lldb::addr_t local_addr = LLDB_INVALID_ADDRESS,
+                         lldb::addr_t remote_addr = LLDB_INVALID_ADDRESS)
+        : JittedEntity(name, local_addr, remote_addr) {}
+  };
+
+  const std::vector<JittedFunction> &GetJittedFunctions() {
+    return m_jitted_functions;
+  }
+
+  const std::vector<JittedGlobalVariable> &GetJittedGlobalVariables() {
+    return m_jitted_global_variables;
+  }
 
 private:
+  //------------------------------------------------------------------
+  /// Look up the object in m_address_map that contains a given address,
+  /// find where it was copied to, and return the remote address at the
+  /// same offset into the copied entity
+  ///
+  /// @param[in] local_address
+  ///     The address in the debugger.
+  ///
+  /// @return
+  ///     The address in the target process.
+  //------------------------------------------------------------------
+  lldb::addr_t GetRemoteAddressForLocal(lldb::addr_t local_address);
+
+  //------------------------------------------------------------------
+  /// Look up the object in m_address_map that contains a given address,
+  /// find where it was copied to, and return its address range in the
+  /// target process
+  ///
+  /// @param[in] local_address
+  ///     The address in the debugger.
+  ///
+  /// @return
+  ///     The range of the containing object in the target process.
+  //------------------------------------------------------------------
+  typedef std::pair<lldb::addr_t, uintptr_t> AddrRange;
+  AddrRange GetRemoteRangeForLocal(lldb::addr_t local_address);
+
+  //------------------------------------------------------------------
+  /// Commit all allocations to the process and record where they were stored.
+  ///
+  /// @param[in] process
+  ///     The process to allocate memory in.
+  ///
+  /// @return
+  ///     True <=> all allocations were performed successfully.
+  ///     This method will attempt to free allocated memory if the
+  ///     operation fails.
+  //------------------------------------------------------------------
+  bool CommitAllocations(lldb::ProcessSP &process_sp);
+
+  //------------------------------------------------------------------
+  /// Report all committed allocations to the execution engine.
+  ///
+  /// @param[in] engine
+  ///     The execution engine to notify.
+  //------------------------------------------------------------------
+  void ReportAllocations(llvm::ExecutionEngine &engine);
+
+  //------------------------------------------------------------------
+  /// Write the contents of all allocations to the process.
+  ///
+  /// @param[in] local_address
+  ///     The process containing the allocations.
+  ///
+  /// @return
+  ///     True <=> all allocations were performed successfully.
+  //------------------------------------------------------------------
+  bool WriteData(lldb::ProcessSP &process_sp);
+
+  Error DisassembleFunction(Stream &stream, lldb::ProcessSP &process_sp);
+
+  struct SearchSpec;
+
+  void CollectCandidateCNames(std::vector<SearchSpec> &C_specs,
+                              const ConstString &name);
+
+  void CollectCandidateCPlusPlusNames(std::vector<SearchSpec> &CPP_specs,
+                                      const std::vector<SearchSpec> &C_specs,
+                                      const SymbolContext &sc);
+
+  void CollectFallbackNames(std::vector<SearchSpec> &fallback_specs,
+                            const std::vector<SearchSpec> &C_specs);
+
+  lldb::addr_t FindInSymbols(const std::vector<SearchSpec> &specs,
+                             const lldb_private::SymbolContext &sc);
+
+  lldb::addr_t FindInRuntimes(const std::vector<SearchSpec> &specs,
+                              const lldb_private::SymbolContext &sc);
+
+  lldb::addr_t FindInUserDefinedSymbols(const std::vector<SearchSpec> &specs,
+                                        const lldb_private::SymbolContext &sc);
+
+  void ReportSymbolLookupError(const ConstString &name);
+
+  class MemoryManager : public llvm::SectionMemoryManager {
+  public:
+    MemoryManager(IRExecutionUnit &parent);
+
+    ~MemoryManager() override;
+
     //------------------------------------------------------------------
-    /// Look up the object in m_address_map that contains a given address,
-    /// find where it was copied to, and return the remote address at the
-    /// same offset into the copied entity
+    /// Allocate space for executable code, and add it to the
+    /// m_spaceBlocks map
     ///
-    /// @param[in] local_address
-    ///     The address in the debugger.
+    /// @param[in] Size
+    ///     The size of the area.
     ///
-    /// @return
-    ///     The address in the target process.
-    //------------------------------------------------------------------
-    lldb::addr_t
-    GetRemoteAddressForLocal (lldb::addr_t local_address);
-    
-    //------------------------------------------------------------------
-    /// Look up the object in m_address_map that contains a given address,
-    /// find where it was copied to, and return its address range in the
-    /// target process
+    /// @param[in] Alignment
+    ///     The required alignment of the area.
     ///
-    /// @param[in] local_address
-    ///     The address in the debugger.
+    /// @param[in] SectionID
+    ///     A unique identifier for the section.
     ///
     /// @return
-    ///     The range of the containing object in the target process.
+    ///     Allocated space.
     //------------------------------------------------------------------
-    typedef std::pair <lldb::addr_t, uintptr_t> AddrRange;
-    AddrRange
-    GetRemoteRangeForLocal (lldb::addr_t local_address);
-    
+    uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
+                                 unsigned SectionID,
+                                 llvm::StringRef SectionName) override;
+
     //------------------------------------------------------------------
-    /// Commit all allocations to the process and record where they were stored.
+    /// Allocate space for data, and add it to the m_spaceBlocks map
     ///
-    /// @param[in] process
-    ///     The process to allocate memory in.
+    /// @param[in] Size
+    ///     The size of the area.
     ///
-    /// @return
-    ///     True <=> all allocations were performed successfully.
-    ///     This method will attempt to free allocated memory if the
-    ///     operation fails.
-    //------------------------------------------------------------------
-    bool
-    CommitAllocations (lldb::ProcessSP &process_sp);
-    
-    //------------------------------------------------------------------
-    /// Report all committed allocations to the execution engine.
+    /// @param[in] Alignment
+    ///     The required alignment of the area.
+    ///
+    /// @param[in] SectionID
+    ///     A unique identifier for the section.
+    ///
+    /// @param[in] IsReadOnly
+    ///     Flag indicating the section is read-only.
     ///
-    /// @param[in] engine
-    ///     The execution engine to notify.
+    /// @return
+    ///     Allocated space.
     //------------------------------------------------------------------
-    void
-    ReportAllocations (llvm::ExecutionEngine &engine);
-    
+    uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
+                                 unsigned SectionID,
+                                 llvm::StringRef SectionName,
+                                 bool IsReadOnly) override;
+
     //------------------------------------------------------------------
-    /// Write the contents of all allocations to the process. 
+    /// Called when object loading is complete and section page
+    /// permissions can be applied. Currently unimplemented for LLDB.
     ///
-    /// @param[in] local_address
-    ///     The process containing the allocations.
+    /// @param[out] ErrMsg
+    ///     The error that prevented the page protection from succeeding.
     ///
     /// @return
-    ///     True <=> all allocations were performed successfully.
+    ///     True in case of failure, false in case of success.
     //------------------------------------------------------------------
-    bool
-    WriteData (lldb::ProcessSP &process_sp);
-    
-    Error
-    DisassembleFunction (Stream &stream,
-                         lldb::ProcessSP &process_sp);
-
-    struct SearchSpec;
-    
-    void
-    CollectCandidateCNames(std::vector<SearchSpec> &C_specs,
-                           const ConstString &name);
-    
-    void
-    CollectCandidateCPlusPlusNames(std::vector<SearchSpec> &CPP_specs,
-                                   const std::vector<SearchSpec> &C_specs,
-                                   const SymbolContext &sc);
-    
-    void
-    CollectFallbackNames(std::vector<SearchSpec> &fallback_specs,
-                         const std::vector<SearchSpec> &C_specs);
-    
-    lldb::addr_t
-    FindInSymbols(const std::vector<SearchSpec> &specs,
-                  const lldb_private::SymbolContext &sc);
-    
-    lldb::addr_t
-    FindInRuntimes(const std::vector<SearchSpec> &specs,
-                   const lldb_private::SymbolContext &sc);
-    
-    lldb::addr_t
-    FindInUserDefinedSymbols(const std::vector<SearchSpec> &specs,
-                             const lldb_private::SymbolContext &sc);
-    
-    void
-    ReportSymbolLookupError(const ConstString &name);
-
-    class MemoryManager : public llvm::SectionMemoryManager
-    {
-    public:
-        MemoryManager (IRExecutionUnit &parent);
-        
-        ~MemoryManager() override;
-        
-        //------------------------------------------------------------------
-        /// Allocate space for executable code, and add it to the
-        /// m_spaceBlocks map
-        ///
-        /// @param[in] Size
-        ///     The size of the area.
-        ///
-        /// @param[in] Alignment
-        ///     The required alignment of the area.
-        ///
-        /// @param[in] SectionID
-        ///     A unique identifier for the section.
-        ///
-        /// @return
-        ///     Allocated space.
-        //------------------------------------------------------------------
-        uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
-				     unsigned SectionID,
-				     llvm::StringRef SectionName) override;
-        
-        //------------------------------------------------------------------
-        /// Allocate space for data, and add it to the m_spaceBlocks map
-        ///
-        /// @param[in] Size
-        ///     The size of the area.
-        ///
-        /// @param[in] Alignment
-        ///     The required alignment of the area.
-        ///
-        /// @param[in] SectionID
-        ///     A unique identifier for the section.
-        ///
-        /// @param[in] IsReadOnly
-        ///     Flag indicating the section is read-only.
-        ///
-        /// @return
-        ///     Allocated space.
-        //------------------------------------------------------------------
-        uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
-				     unsigned SectionID,
-				     llvm::StringRef SectionName,
-				     bool IsReadOnly) override;
-        
-        //------------------------------------------------------------------
-        /// Called when object loading is complete and section page
-        /// permissions can be applied. Currently unimplemented for LLDB.
-        ///
-        /// @param[out] ErrMsg
-        ///     The error that prevented the page protection from succeeding.
-        ///
-        /// @return
-        ///     True in case of failure, false in case of success.
-        //------------------------------------------------------------------
-        bool finalizeMemory(std::string *ErrMsg) override {
-            // TODO: Ensure that the instruction cache is flushed because
-            // relocations are updated by dy-load.  See:
-            //   sys::Memory::InvalidateInstructionCache
-            //   llvm::SectionMemoryManager
-            return false;
-        }
-        
-        void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) override {
-        }
-        
-        uint64_t getSymbolAddress(const std::string &Name) override;
-
-        void *getPointerToNamedFunction(const std::string &Name,
-					bool AbortOnFailure = true) override;
-
-    private:
-        std::unique_ptr<SectionMemoryManager>    m_default_mm_ap;    ///< The memory allocator to use in actually creating space.  All calls are passed through to it.
-        IRExecutionUnit                    &m_parent;           ///< The execution unit this is a proxy for.
-    };
-    
-    static const unsigned eSectionIDInvalid = (unsigned)-1;
-    
-    //----------------------------------------------------------------------
-    /// @class AllocationRecord IRExecutionUnit.h "lldb/Expression/IRExecutionUnit.h"
-    /// @brief Encapsulates a single allocation request made by the JIT.
-    ///
-    /// Allocations made by the JIT are first queued up and then applied in
-    /// bulk to the underlying process.
-    //----------------------------------------------------------------------
-    enum class AllocationKind {
-        Stub, Code, Data, Global, Bytes
-    };
-    
-    static lldb::SectionType
-    GetSectionTypeFromSectionName (const llvm::StringRef &name,
-                                   AllocationKind alloc_kind);
-    
-    struct AllocationRecord {
-        std::string         m_name;
-        lldb::addr_t        m_process_address;
-        uintptr_t           m_host_address;
-        uint32_t            m_permissions;
-        lldb::SectionType   m_sect_type;
-        size_t              m_size;
-        unsigned            m_alignment;
-        unsigned            m_section_id;
-        
-        AllocationRecord (uintptr_t host_address,
-                          uint32_t permissions,
-                          lldb::SectionType sect_type,
-                          size_t size,
-                          unsigned alignment,
-                          unsigned section_id,
-                          const char *name) :
-            m_name (),
-            m_process_address(LLDB_INVALID_ADDRESS),
-            m_host_address(host_address),
-            m_permissions(permissions),
-            m_sect_type (sect_type),
-            m_size(size),
-            m_alignment(alignment),
-            m_section_id(section_id)
-        {
-            if (name && name[0])
-                m_name = name;
-        }
-        
-        void dump (Log *log);
-    };
-    
-    bool
-    CommitOneAllocation (lldb::ProcessSP &process_sp, Error &error, AllocationRecord &record);
-    
-    typedef std::vector<AllocationRecord>   RecordVector;
-    RecordVector                            m_records;
-
-    std::unique_ptr<llvm::LLVMContext>       m_context_ap;
-    std::unique_ptr<llvm::ExecutionEngine>   m_execution_engine_ap;
-    std::unique_ptr<llvm::Module>            m_module_ap;            ///< Holder for the module until it's been handed off
-    llvm::Module                           *m_module;               ///< Owned by the execution engine
-    std::vector<std::string>                m_cpu_features;
-    std::vector<JittedFunction>             m_jitted_functions;     ///< A vector of all functions that have been JITted into machine code
-    std::vector<JittedGlobalVariable>       m_jitted_global_variables; ///< A vector of all functions that have been JITted into machine code
-    const ConstString                       m_name;
-    SymbolContext                           m_sym_ctx;              ///< Used for symbol lookups
-    std::vector<ConstString>                m_failed_lookups;
-    
-    std::atomic<bool>                       m_did_jit;
-
-    lldb::addr_t                            m_function_load_addr;
-    lldb::addr_t                            m_function_end_load_addr;
-    
-    bool                                    m_strip_underscore;     ///< True for platforms where global symbols have a _ prefix
-    bool                                    m_reported_allocations; ///< True after allocations have been reported.  It is possible that
-                                                                    ///< sections will be allocated when this is true, in which case they weren't
-                                                                    ///< depended on by any function.  (Top-level code defining a variable, but
-                                                                    ///< defining no functions using that variable, would do this.)  If this
-                                                                    ///< is true, any allocations need to be committed immediately -- no
-                                                                    ///< opportunity for relocation.
+    bool finalizeMemory(std::string *ErrMsg) override {
+      // TODO: Ensure that the instruction cache is flushed because
+      // relocations are updated by dy-load.  See:
+      //   sys::Memory::InvalidateInstructionCache
+      //   llvm::SectionMemoryManager
+      return false;
+    }
+
+    void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr,
+                          size_t Size) override {}
+
+    uint64_t getSymbolAddress(const std::string &Name) override;
+
+    void *getPointerToNamedFunction(const std::string &Name,
+                                    bool AbortOnFailure = true) override;
+
+  private:
+    std::unique_ptr<SectionMemoryManager> m_default_mm_ap; ///< The memory
+                                                           ///allocator to use
+                                                           ///in actually
+                                                           ///creating space.
+                                                           ///All calls are
+                                                           ///passed through to
+                                                           ///it.
+    IRExecutionUnit &m_parent; ///< The execution unit this is a proxy for.
+  };
+
+  static const unsigned eSectionIDInvalid = (unsigned)-1;
+
+  //----------------------------------------------------------------------
+  /// @class AllocationRecord IRExecutionUnit.h
+  /// "lldb/Expression/IRExecutionUnit.h"
+  /// @brief Encapsulates a single allocation request made by the JIT.
+  ///
+  /// Allocations made by the JIT are first queued up and then applied in
+  /// bulk to the underlying process.
+  //----------------------------------------------------------------------
+  enum class AllocationKind { Stub, Code, Data, Global, Bytes };
+
+  static lldb::SectionType
+  GetSectionTypeFromSectionName(const llvm::StringRef &name,
+                                AllocationKind alloc_kind);
+
+  struct AllocationRecord {
+    std::string m_name;
+    lldb::addr_t m_process_address;
+    uintptr_t m_host_address;
+    uint32_t m_permissions;
+    lldb::SectionType m_sect_type;
+    size_t m_size;
+    unsigned m_alignment;
+    unsigned m_section_id;
+
+    AllocationRecord(uintptr_t host_address, uint32_t permissions,
+                     lldb::SectionType sect_type, size_t size,
+                     unsigned alignment, unsigned section_id, const char *name)
+        : m_name(), m_process_address(LLDB_INVALID_ADDRESS),
+          m_host_address(host_address), m_permissions(permissions),
+          m_sect_type(sect_type), m_size(size), m_alignment(alignment),
+          m_section_id(section_id) {
+      if (name && name[0])
+        m_name = name;
+    }
+
+    void dump(Log *log);
+  };
+
+  bool CommitOneAllocation(lldb::ProcessSP &process_sp, Error &error,
+                           AllocationRecord &record);
+
+  typedef std::vector<AllocationRecord> RecordVector;
+  RecordVector m_records;
+
+  std::unique_ptr<llvm::LLVMContext> m_context_ap;
+  std::unique_ptr<llvm::ExecutionEngine> m_execution_engine_ap;
+  std::unique_ptr<llvm::Module>
+      m_module_ap;        ///< Holder for the module until it's been handed off
+  llvm::Module *m_module; ///< Owned by the execution engine
+  std::vector<std::string> m_cpu_features;
+  std::vector<JittedFunction> m_jitted_functions; ///< A vector of all functions
+                                                  ///that have been JITted into
+                                                  ///machine code
+  std::vector<JittedGlobalVariable> m_jitted_global_variables; ///< A vector of
+                                                               ///all functions
+                                                               ///that have been
+                                                               ///JITted into
+                                                               ///machine code
+  const ConstString m_name;
+  SymbolContext m_sym_ctx; ///< Used for symbol lookups
+  std::vector<ConstString> m_failed_lookups;
+
+  std::atomic<bool> m_did_jit;
+
+  lldb::addr_t m_function_load_addr;
+  lldb::addr_t m_function_end_load_addr;
+
+  bool m_strip_underscore; ///< True for platforms where global symbols have a _
+                           ///prefix
+  bool m_reported_allocations; ///< True after allocations have been reported.
+                               ///It is possible that
+  ///< sections will be allocated when this is true, in which case they weren't
+  ///< depended on by any function.  (Top-level code defining a variable, but
+  ///< defining no functions using that variable, would do this.)  If this
+  ///< is true, any allocations need to be committed immediately -- no
+  ///< opportunity for relocation.
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Expression/IRInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRInterpreter.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRInterpreter.h (original)
+++ lldb/trunk/include/lldb/Expression/IRInterpreter.h Tue Sep  6 15:57:50 2016
@@ -10,22 +10,21 @@
 #ifndef liblldb_IRInterpreter_h_
 #define liblldb_IRInterpreter_h_
 
-#include "lldb/lldb-public.h"
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/Stream.h"
+#include "lldb/lldb-public.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Pass.h"
 
 namespace llvm {
-    class Function;
-    class Module;
+class Function;
+class Module;
 }
 
 namespace lldb_private {
 
 class ClangExpressionDeclMap;
 class IRMemoryMap;
-    
 }
 
 //----------------------------------------------------------------------
@@ -37,29 +36,23 @@ class IRMemoryMap;
 /// in the debugger, manipulating variables but not executing any code
 /// in the target.  The IRInterpreter attempts to do this.
 //----------------------------------------------------------------------
-class IRInterpreter
-{
+class IRInterpreter {
 public:
-    static bool
-    CanInterpret (llvm::Module &module,
-                  llvm::Function &function,
-                  lldb_private::Error &error,
-                  const bool support_function_calls);
-    
-    static bool
-    Interpret (llvm::Module &module,
-               llvm::Function &function,
-               llvm::ArrayRef<lldb::addr_t> args,
-               lldb_private::IRExecutionUnit &execution_unit,
-               lldb_private::Error &error,
-               lldb::addr_t stack_frame_bottom,
-               lldb::addr_t stack_frame_top,
-               lldb_private::ExecutionContext &exe_ctx);
-    
-private:   
-    static bool
-    supportsFunction (llvm::Function &llvm_function,
-                      lldb_private::Error &err);
+  static bool CanInterpret(llvm::Module &module, llvm::Function &function,
+                           lldb_private::Error &error,
+                           const bool support_function_calls);
+
+  static bool Interpret(llvm::Module &module, llvm::Function &function,
+                        llvm::ArrayRef<lldb::addr_t> args,
+                        lldb_private::IRExecutionUnit &execution_unit,
+                        lldb_private::Error &error,
+                        lldb::addr_t stack_frame_bottom,
+                        lldb::addr_t stack_frame_top,
+                        lldb_private::ExecutionContext &exe_ctx);
+
+private:
+  static bool supportsFunction(llvm::Function &llvm_function,
+                               lldb_private::Error &err);
 };
 
 #endif

Modified: lldb/trunk/include/lldb/Expression/IRMemoryMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRMemoryMap.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRMemoryMap.h (original)
+++ lldb/trunk/include/lldb/Expression/IRMemoryMap.h Tue Sep  6 15:57:50 2016
@@ -10,14 +10,13 @@
 #ifndef lldb_IRMemoryMap_h_
 #define lldb_IRMemoryMap_h_
 
-#include "lldb/lldb-public.h"
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/UserID.h"
+#include "lldb/lldb-public.h"
 
 #include <map>
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 //----------------------------------------------------------------------
 /// @class IRMemoryMap IRMemoryMap.h "lldb/Expression/IRMemoryMap.h"
@@ -35,111 +34,106 @@ namespace lldb_private
 /// exist, allocations still get made-up addresses.  If an inferior appears
 /// at some point, then those addresses need to be re-mapped.
 //----------------------------------------------------------------------
-class IRMemoryMap
-{
+class IRMemoryMap {
 public:
-    IRMemoryMap (lldb::TargetSP target_sp);
-    ~IRMemoryMap ();
-    
-    enum AllocationPolicy {
-        eAllocationPolicyInvalid        = 0,    ///< It is an error for an allocation to have this policy.
-        eAllocationPolicyHostOnly,              ///< This allocation was created in the host and will never make it into the process.
-                                                ///< It is an error to create other types of allocations while such allocations exist.
-        eAllocationPolicyMirror,                ///< The intent is that this allocation exist both in the host and the process and have
-                                                ///< the same content in both.
-        eAllocationPolicyProcessOnly            ///< The intent is that this allocation exist only in the process.
-    };
-
-    lldb::addr_t Malloc (size_t size,
-                         uint8_t alignment,
-                         uint32_t permissions,
-                         AllocationPolicy policy,
-                         bool zero_memory,
-                         Error &error);
-    void Leak (lldb::addr_t process_address, Error &error);
-    void Free (lldb::addr_t process_address, Error &error);
-    
-    void WriteMemory (lldb::addr_t process_address, const uint8_t *bytes, size_t size, Error &error);
-    void WriteScalarToMemory (lldb::addr_t process_address, Scalar &scalar, size_t size, Error &error);
-    void WritePointerToMemory (lldb::addr_t process_address, lldb::addr_t address, Error &error);
-    void ReadMemory (uint8_t *bytes, lldb::addr_t process_address, size_t size, Error &error);
-    void ReadScalarFromMemory (Scalar &scalar, lldb::addr_t process_address, size_t size, Error &error);
-    void ReadPointerFromMemory (lldb::addr_t *address, lldb::addr_t process_address, Error &error);
-    bool GetAllocSize(lldb::addr_t address, size_t &size);
-    void GetMemoryData (DataExtractor &extractor, lldb::addr_t process_address, size_t size, Error &error);
-    
-    lldb::ByteOrder GetByteOrder();
-    uint32_t GetAddressByteSize();
-    
-    // This function can return NULL.
-    ExecutionContextScope *GetBestExecutionContextScope() const;
-
-    lldb::TargetSP
-    GetTarget ()
-    {
-        return m_target_wp.lock();
-    }
+  IRMemoryMap(lldb::TargetSP target_sp);
+  ~IRMemoryMap();
 
-protected:
-    // This function should only be used if you know you are using the JIT.
-    // Any other cases should use GetBestExecutionContextScope().
+  enum AllocationPolicy {
+    eAllocationPolicyInvalid =
+        0, ///< It is an error for an allocation to have this policy.
+    eAllocationPolicyHostOnly, ///< This allocation was created in the host and
+                               ///will never make it into the process.
+    ///< It is an error to create other types of allocations while such
+    ///allocations exist.
+    eAllocationPolicyMirror, ///< The intent is that this allocation exist both
+                             ///in the host and the process and have
+                             ///< the same content in both.
+    eAllocationPolicyProcessOnly ///< The intent is that this allocation exist
+                                 ///only in the process.
+  };
+
+  lldb::addr_t Malloc(size_t size, uint8_t alignment, uint32_t permissions,
+                      AllocationPolicy policy, bool zero_memory, Error &error);
+  void Leak(lldb::addr_t process_address, Error &error);
+  void Free(lldb::addr_t process_address, Error &error);
+
+  void WriteMemory(lldb::addr_t process_address, const uint8_t *bytes,
+                   size_t size, Error &error);
+  void WriteScalarToMemory(lldb::addr_t process_address, Scalar &scalar,
+                           size_t size, Error &error);
+  void WritePointerToMemory(lldb::addr_t process_address, lldb::addr_t address,
+                            Error &error);
+  void ReadMemory(uint8_t *bytes, lldb::addr_t process_address, size_t size,
+                  Error &error);
+  void ReadScalarFromMemory(Scalar &scalar, lldb::addr_t process_address,
+                            size_t size, Error &error);
+  void ReadPointerFromMemory(lldb::addr_t *address,
+                             lldb::addr_t process_address, Error &error);
+  bool GetAllocSize(lldb::addr_t address, size_t &size);
+  void GetMemoryData(DataExtractor &extractor, lldb::addr_t process_address,
+                     size_t size, Error &error);
 
-    lldb::ProcessWP &
-    GetProcessWP ()
-    {
-        return m_process_wp;
-    }
+  lldb::ByteOrder GetByteOrder();
+  uint32_t GetAddressByteSize();
 
-private:
-    struct Allocation
-    {
-        lldb::addr_t    m_process_alloc;    ///< The (unaligned) base for the remote allocation
-        lldb::addr_t    m_process_start;    ///< The base address of the allocation in the process
-        size_t          m_size;             ///< The size of the requested allocation
-        uint32_t        m_permissions;      ///< The access permissions on the memory in the process.  In the host, the memory is always read/write.
-        uint8_t         m_alignment;        ///< The alignment of the requested allocation
-        DataBufferHeap  m_data;
-        
-        ///< Flags
-        AllocationPolicy    m_policy;
-        bool                m_leak;
-    public:
-        Allocation (lldb::addr_t process_alloc,
-                    lldb::addr_t process_start,
-                    size_t size,
-                    uint32_t permissions,
-                    uint8_t alignment,
-                    AllocationPolicy m_policy);
-
-        Allocation () :
-            m_process_alloc (LLDB_INVALID_ADDRESS),
-            m_process_start (LLDB_INVALID_ADDRESS),
-            m_size (0),
-            m_permissions (0),
-            m_alignment (0),
-            m_data (),
-            m_policy (eAllocationPolicyInvalid),
-            m_leak (false)
-        {
-        }
-    };
-    
-    lldb::ProcessWP                             m_process_wp;
-    lldb::TargetWP                              m_target_wp;
-    typedef std::map<lldb::addr_t, Allocation>  AllocationMap;
-    AllocationMap                               m_allocations;
-        
-    lldb::addr_t FindSpace (size_t size);
-    bool ContainsHostOnlyAllocations ();
-    AllocationMap::iterator FindAllocation (lldb::addr_t addr, size_t size);
+  // This function can return NULL.
+  ExecutionContextScope *GetBestExecutionContextScope() const;
 
-    // Returns true if the given allocation intersects any allocation in the memory map.
-    bool IntersectsAllocation (lldb::addr_t addr, size_t size) const;
+  lldb::TargetSP GetTarget() { return m_target_wp.lock(); }
 
-    // Returns true if the two given allocations intersect each other.
-    static bool AllocationsIntersect (lldb::addr_t addr1, size_t size1, lldb::addr_t addr2, size_t size2);
+protected:
+  // This function should only be used if you know you are using the JIT.
+  // Any other cases should use GetBestExecutionContextScope().
+
+  lldb::ProcessWP &GetProcessWP() { return m_process_wp; }
+
+private:
+  struct Allocation {
+    lldb::addr_t
+        m_process_alloc; ///< The (unaligned) base for the remote allocation
+    lldb::addr_t
+        m_process_start; ///< The base address of the allocation in the process
+    size_t m_size;       ///< The size of the requested allocation
+    uint32_t m_permissions; ///< The access permissions on the memory in the
+                            ///process.  In the host, the memory is always
+                            ///read/write.
+    uint8_t m_alignment;    ///< The alignment of the requested allocation
+    DataBufferHeap m_data;
+
+    ///< Flags
+    AllocationPolicy m_policy;
+    bool m_leak;
+
+  public:
+    Allocation(lldb::addr_t process_alloc, lldb::addr_t process_start,
+               size_t size, uint32_t permissions, uint8_t alignment,
+               AllocationPolicy m_policy);
+
+    Allocation()
+        : m_process_alloc(LLDB_INVALID_ADDRESS),
+          m_process_start(LLDB_INVALID_ADDRESS), m_size(0), m_permissions(0),
+          m_alignment(0), m_data(), m_policy(eAllocationPolicyInvalid),
+          m_leak(false) {}
+  };
+
+  lldb::ProcessWP m_process_wp;
+  lldb::TargetWP m_target_wp;
+  typedef std::map<lldb::addr_t, Allocation> AllocationMap;
+  AllocationMap m_allocations;
+
+  lldb::addr_t FindSpace(size_t size);
+  bool ContainsHostOnlyAllocations();
+  AllocationMap::iterator FindAllocation(lldb::addr_t addr, size_t size);
+
+  // Returns true if the given allocation intersects any allocation in the
+  // memory map.
+  bool IntersectsAllocation(lldb::addr_t addr, size_t size) const;
+
+  // Returns true if the two given allocations intersect each other.
+  static bool AllocationsIntersect(lldb::addr_t addr1, size_t size1,
+                                   lldb::addr_t addr2, size_t size2);
 };
-    
 }
 
 #endif

Modified: lldb/trunk/include/lldb/Expression/LLVMUserExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/LLVMUserExpression.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/LLVMUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/LLVMUserExpression.h Tue Sep  6 15:57:50 2016
@@ -12,8 +12,8 @@
 
 // C Includes
 // C++ Includes
-#include <string>
 #include <map>
+#include <string>
 #include <vector>
 
 // Other libraries and framework includes
@@ -22,106 +22,116 @@
 // Project includes
 #include "lldb/Expression/UserExpression.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 //----------------------------------------------------------------------
-/// @class LLVMUserExpression LLVMUserExpression.h "lldb/Expression/LLVMUserExpression.h"
+/// @class LLVMUserExpression LLVMUserExpression.h
+/// "lldb/Expression/LLVMUserExpression.h"
 /// @brief Encapsulates a one-time expression for use in lldb.
 ///
 /// LLDB uses expressions for various purposes, notably to call functions
 /// and as a backend for the expr command.  LLVMUserExpression is a virtual base
 /// class that encapsulates the objects needed to parse and JIT an expression.
 /// The actual parsing part will be provided by the specific implementations
-/// of LLVMUserExpression - which will be vended through the appropriate TypeSystem.
+/// of LLVMUserExpression - which will be vended through the appropriate
+/// TypeSystem.
 //----------------------------------------------------------------------
-class LLVMUserExpression : public UserExpression
-{
+class LLVMUserExpression : public UserExpression {
 public:
-    // The IRPasses struct is filled in by a runtime after an expression is compiled and can be used to to run
-    // fixups/analysis passes as required. EarlyPasses are run on the generated module before lldb runs its own IR
-    // fixups and inserts instrumentation code/pointer checks. LatePasses are run after the module has been processed by
-    // llvm, before the module is assembled and run in the ThreadPlan.
-    struct IRPasses
-    {
-        IRPasses() : EarlyPasses(nullptr), LatePasses(nullptr){};
-        std::shared_ptr<llvm::legacy::PassManager> EarlyPasses;
-        std::shared_ptr<llvm::legacy::PassManager> LatePasses;
-    };
-
-    LLVMUserExpression(ExecutionContextScope &exe_scope, const char *expr, const char *expr_prefix,
-                       lldb::LanguageType language, ResultType desired_type,
-                       const EvaluateExpressionOptions &options);
-    ~LLVMUserExpression() override;
-
-    bool
-    FinalizeJITExecution(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
-                         lldb::ExpressionVariableSP &result,
-                         lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
-                         lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS) override;
-
-    bool
-    CanInterpret() override
-    {
-        return m_can_interpret;
-    }
-
-    //------------------------------------------------------------------
-    /// Return the string that the parser should parse.  Must be a full
-    /// translation unit.
-    //------------------------------------------------------------------
-    const char *
-    Text() override
-    {
-        return m_transformed_text.c_str();
-    }
+  // The IRPasses struct is filled in by a runtime after an expression is
+  // compiled and can be used to to run
+  // fixups/analysis passes as required. EarlyPasses are run on the generated
+  // module before lldb runs its own IR
+  // fixups and inserts instrumentation code/pointer checks. LatePasses are run
+  // after the module has been processed by
+  // llvm, before the module is assembled and run in the ThreadPlan.
+  struct IRPasses {
+    IRPasses() : EarlyPasses(nullptr), LatePasses(nullptr){};
+    std::shared_ptr<llvm::legacy::PassManager> EarlyPasses;
+    std::shared_ptr<llvm::legacy::PassManager> LatePasses;
+  };
+
+  LLVMUserExpression(ExecutionContextScope &exe_scope, const char *expr,
+                     const char *expr_prefix, lldb::LanguageType language,
+                     ResultType desired_type,
+                     const EvaluateExpressionOptions &options);
+  ~LLVMUserExpression() override;
+
+  bool FinalizeJITExecution(
+      DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+      lldb::ExpressionVariableSP &result,
+      lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
+      lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS) override;
+
+  bool CanInterpret() override { return m_can_interpret; }
+
+  //------------------------------------------------------------------
+  /// Return the string that the parser should parse.  Must be a full
+  /// translation unit.
+  //------------------------------------------------------------------
+  const char *Text() override { return m_transformed_text.c_str(); }
 
-    lldb::ModuleSP GetJITModule() override;
+  lldb::ModuleSP GetJITModule() override;
 
 protected:
-    lldb::ExpressionResults
-    DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
-              const EvaluateExpressionOptions &options, lldb::UserExpressionSP &shared_ptr_to_me,
-              lldb::ExpressionVariableSP &result) override;
-
-    virtual void
-    ScanContext(ExecutionContext &exe_ctx, lldb_private::Error &err) = 0;
-
-    bool
-    PrepareToExecuteJITExpression(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
-                                  lldb::addr_t &struct_address);
-
-    virtual bool
-    AddArguments(ExecutionContext &exe_ctx, std::vector<lldb::addr_t> &args, lldb::addr_t struct_address,
-                 DiagnosticManager &diagnostic_manager) = 0;
-
-    lldb::addr_t m_stack_frame_bottom; ///< The bottom of the allocated stack frame.
-    lldb::addr_t m_stack_frame_top;    ///< The top of the allocated stack frame.
-
-    bool m_allow_cxx;               ///< True if the language allows C++.
-    bool m_allow_objc;              ///< True if the language allows Objective-C.
-    std::string m_transformed_text; ///< The text of the expression, as send to the parser
-
-    std::shared_ptr<IRExecutionUnit> m_execution_unit_sp; ///< The execution unit the expression is stored in.
-    std::unique_ptr<Materializer> m_materializer_ap;      ///< The materializer to use when running the expression.
-    lldb::ModuleWP m_jit_module_wp;
-    bool m_enforce_valid_object; ///< True if the expression parser should enforce the presence of a valid class pointer
-                                 ///in order to generate the expression as a method.
-    bool m_in_cplusplus_method;  ///< True if the expression is compiled as a C++ member function (true if it was parsed
-                                 ///when exe_ctx was in a C++ method).
-    bool m_in_objectivec_method; ///< True if the expression is compiled as an Objective-C method (true if it was parsed
-                                 ///when exe_ctx was in an Objective-C method).
-    bool m_in_static_method; ///< True if the expression is compiled as a static (or class) method (currently true if it
-                             ///was parsed when exe_ctx was in an Objective-C class method).
-    bool m_needs_object_ptr; ///< True if "this" or "self" must be looked up and passed in.  False if the expression
-                             ///doesn't really use them and they can be NULL.
-    bool m_const_object;     ///< True if "this" is const.
-    Target *m_target;        ///< The target for storing persistent data like types and variables.
-
-    bool m_can_interpret; ///< True if the expression could be evaluated statically; false otherwise.
-    lldb::addr_t
-        m_materialized_address; ///< The address at which the arguments to the expression have been materialized.
-    Materializer::DematerializerSP m_dematerializer_sp; ///< The dematerializer.
+  lldb::ExpressionResults
+  DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+            const EvaluateExpressionOptions &options,
+            lldb::UserExpressionSP &shared_ptr_to_me,
+            lldb::ExpressionVariableSP &result) override;
+
+  virtual void ScanContext(ExecutionContext &exe_ctx,
+                           lldb_private::Error &err) = 0;
+
+  bool PrepareToExecuteJITExpression(DiagnosticManager &diagnostic_manager,
+                                     ExecutionContext &exe_ctx,
+                                     lldb::addr_t &struct_address);
+
+  virtual bool AddArguments(ExecutionContext &exe_ctx,
+                            std::vector<lldb::addr_t> &args,
+                            lldb::addr_t struct_address,
+                            DiagnosticManager &diagnostic_manager) = 0;
+
+  lldb::addr_t
+      m_stack_frame_bottom;       ///< The bottom of the allocated stack frame.
+  lldb::addr_t m_stack_frame_top; ///< The top of the allocated stack frame.
+
+  bool m_allow_cxx;  ///< True if the language allows C++.
+  bool m_allow_objc; ///< True if the language allows Objective-C.
+  std::string
+      m_transformed_text; ///< The text of the expression, as send to the parser
+
+  std::shared_ptr<IRExecutionUnit>
+      m_execution_unit_sp; ///< The execution unit the expression is stored in.
+  std::unique_ptr<Materializer> m_materializer_ap; ///< The materializer to use
+                                                   ///when running the
+                                                   ///expression.
+  lldb::ModuleWP m_jit_module_wp;
+  bool m_enforce_valid_object; ///< True if the expression parser should enforce
+                               ///the presence of a valid class pointer
+  /// in order to generate the expression as a method.
+  bool m_in_cplusplus_method;  ///< True if the expression is compiled as a C++
+                               ///member function (true if it was parsed
+                               /// when exe_ctx was in a C++ method).
+  bool m_in_objectivec_method; ///< True if the expression is compiled as an
+                               ///Objective-C method (true if it was parsed
+                               /// when exe_ctx was in an Objective-C method).
+  bool m_in_static_method; ///< True if the expression is compiled as a static
+                           ///(or class) method (currently true if it
+  /// was parsed when exe_ctx was in an Objective-C class method).
+  bool m_needs_object_ptr; ///< True if "this" or "self" must be looked up and
+                           ///passed in.  False if the expression
+                           /// doesn't really use them and they can be NULL.
+  bool m_const_object;     ///< True if "this" is const.
+  Target *m_target; ///< The target for storing persistent data like types and
+                    ///variables.
+
+  bool m_can_interpret; ///< True if the expression could be evaluated
+                        ///statically; false otherwise.
+  lldb::addr_t m_materialized_address; ///< The address at which the arguments
+                                       ///to the expression have been
+                                       ///materialized.
+  Materializer::DematerializerSP m_dematerializer_sp; ///< The dematerializer.
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Expression/Materializer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/Materializer.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/Materializer.h (original)
+++ lldb/trunk/include/lldb/Expression/Materializer.h Tue Sep  6 15:57:50 2016
@@ -17,168 +17,128 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private-types.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Expression/IRMemoryMap.h"
 #include "lldb/Symbol/TaggedASTType.h"
 #include "lldb/Target/StackFrame.h"
+#include "lldb/lldb-private-types.h"
 
-namespace lldb_private
-{
-    
-class Materializer
-{
+namespace lldb_private {
+
+class Materializer {
 public:
-    Materializer ();
-    ~Materializer ();
-    
-    class Dematerializer
-    {
-    public:
-        Dematerializer () :
-            m_materializer(nullptr),
-            m_map(nullptr),
-            m_process_address(LLDB_INVALID_ADDRESS)
-        {
-        }
-        
-        ~Dematerializer ()
-        {
-            Wipe ();
-        }
-        
-        void Dematerialize (Error &err,
-                            lldb::addr_t frame_top,
-                            lldb::addr_t frame_bottom);
-        
-        void Wipe ();
-        
-        bool IsValid ()
-        {
-            return m_materializer && m_map && (m_process_address != LLDB_INVALID_ADDRESS);
-        }
-
-    private:
-        friend class Materializer;
-
-        Dematerializer (Materializer &materializer,
-                        lldb::StackFrameSP &frame_sp,
-                        IRMemoryMap &map,
-                        lldb::addr_t process_address) :
-            m_materializer(&materializer),
-            m_map(&map),
-            m_process_address(process_address)
-        {
-            if (frame_sp)
-            {
-                m_thread_wp = frame_sp->GetThread();
-                m_stack_id = frame_sp->GetStackID();
-            }
-        }
-        
-        Materializer       *m_materializer;
-        lldb::ThreadWP      m_thread_wp;
-        StackID             m_stack_id;
-        IRMemoryMap        *m_map;
-        lldb::addr_t        m_process_address;
-    };
-    
-    typedef std::shared_ptr<Dematerializer> DematerializerSP;
-    typedef std::weak_ptr<Dematerializer> DematerializerWP;
-    
-    DematerializerSP Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err);
-    
-    class PersistentVariableDelegate
-    {
-    public:
-        virtual ~PersistentVariableDelegate();
-        virtual ConstString GetName() = 0;
-        virtual void DidDematerialize(lldb::ExpressionVariableSP &variable) = 0;
-    };
-
-    uint32_t AddPersistentVariable (lldb::ExpressionVariableSP &persistent_variable_sp,
-                                    PersistentVariableDelegate *delegate,
-                                    Error &err);
-    uint32_t AddVariable (lldb::VariableSP &variable_sp,
-                          Error &err);
-    uint32_t AddResultVariable (const CompilerType &type,
-                                bool is_lvalue,
-                                bool keep_in_memory,
-                                PersistentVariableDelegate *delegate,
-                                Error &err);
-    uint32_t AddSymbol (const Symbol &symbol_sp,
-                        Error &err);
-    uint32_t AddRegister (const RegisterInfo &register_info,
-                          Error &err);
-    
-    uint32_t GetStructAlignment ()
-    {
-        return m_struct_alignment;
+  Materializer();
+  ~Materializer();
+
+  class Dematerializer {
+  public:
+    Dematerializer()
+        : m_materializer(nullptr), m_map(nullptr),
+          m_process_address(LLDB_INVALID_ADDRESS) {}
+
+    ~Dematerializer() { Wipe(); }
+
+    void Dematerialize(Error &err, lldb::addr_t frame_top,
+                       lldb::addr_t frame_bottom);
+
+    void Wipe();
+
+    bool IsValid() {
+      return m_materializer && m_map &&
+             (m_process_address != LLDB_INVALID_ADDRESS);
     }
-    
-    uint32_t GetStructByteSize ()
-    {
-        return m_current_offset;
+
+  private:
+    friend class Materializer;
+
+    Dematerializer(Materializer &materializer, lldb::StackFrameSP &frame_sp,
+                   IRMemoryMap &map, lldb::addr_t process_address)
+        : m_materializer(&materializer), m_map(&map),
+          m_process_address(process_address) {
+      if (frame_sp) {
+        m_thread_wp = frame_sp->GetThread();
+        m_stack_id = frame_sp->GetStackID();
+      }
     }
-    
-    class Entity
-    {
-    public:
-        Entity () :
-            m_alignment(1),
-            m_size(0),
-            m_offset(0)
-        {
-        }
-
-        virtual ~Entity() = default;
-
-        virtual void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err) = 0;
-        virtual void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address,
-                                    lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err) = 0;
-        virtual void DumpToLog (IRMemoryMap &map, lldb::addr_t process_address, Log *log) = 0;
-        virtual void Wipe (IRMemoryMap &map, lldb::addr_t process_address) = 0;
-        
-        uint32_t GetAlignment ()
-        {
-            return m_alignment;
-        }
-        
-        uint32_t GetSize ()
-        {
-            return m_size;
-        }
-        
-        uint32_t GetOffset ()
-        {
-            return m_offset;
-        }
-        
-        void SetOffset (uint32_t offset)
-        {
-            m_offset = offset;
-        }
-
-    protected:
-        void SetSizeAndAlignmentFromType (CompilerType &type);
-        
-        uint32_t    m_alignment;
-        uint32_t    m_size;
-        uint32_t    m_offset;
-    };
+
+    Materializer *m_materializer;
+    lldb::ThreadWP m_thread_wp;
+    StackID m_stack_id;
+    IRMemoryMap *m_map;
+    lldb::addr_t m_process_address;
+  };
+
+  typedef std::shared_ptr<Dematerializer> DematerializerSP;
+  typedef std::weak_ptr<Dematerializer> DematerializerWP;
+
+  DematerializerSP Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
+                               lldb::addr_t process_address, Error &err);
+
+  class PersistentVariableDelegate {
+  public:
+    virtual ~PersistentVariableDelegate();
+    virtual ConstString GetName() = 0;
+    virtual void DidDematerialize(lldb::ExpressionVariableSP &variable) = 0;
+  };
+
+  uint32_t
+  AddPersistentVariable(lldb::ExpressionVariableSP &persistent_variable_sp,
+                        PersistentVariableDelegate *delegate, Error &err);
+  uint32_t AddVariable(lldb::VariableSP &variable_sp, Error &err);
+  uint32_t AddResultVariable(const CompilerType &type, bool is_lvalue,
+                             bool keep_in_memory,
+                             PersistentVariableDelegate *delegate, Error &err);
+  uint32_t AddSymbol(const Symbol &symbol_sp, Error &err);
+  uint32_t AddRegister(const RegisterInfo &register_info, Error &err);
+
+  uint32_t GetStructAlignment() { return m_struct_alignment; }
+
+  uint32_t GetStructByteSize() { return m_current_offset; }
+
+  class Entity {
+  public:
+    Entity() : m_alignment(1), m_size(0), m_offset(0) {}
+
+    virtual ~Entity() = default;
+
+    virtual void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
+                             lldb::addr_t process_address, Error &err) = 0;
+    virtual void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
+                               lldb::addr_t process_address,
+                               lldb::addr_t frame_top,
+                               lldb::addr_t frame_bottom, Error &err) = 0;
+    virtual void DumpToLog(IRMemoryMap &map, lldb::addr_t process_address,
+                           Log *log) = 0;
+    virtual void Wipe(IRMemoryMap &map, lldb::addr_t process_address) = 0;
+
+    uint32_t GetAlignment() { return m_alignment; }
+
+    uint32_t GetSize() { return m_size; }
+
+    uint32_t GetOffset() { return m_offset; }
+
+    void SetOffset(uint32_t offset) { m_offset = offset; }
+
+  protected:
+    void SetSizeAndAlignmentFromType(CompilerType &type);
+
+    uint32_t m_alignment;
+    uint32_t m_size;
+    uint32_t m_offset;
+  };
 
 private:
-    uint32_t AddStructMember (Entity &entity);
-    
-    typedef std::unique_ptr<Entity>  EntityUP;
-    typedef std::vector<EntityUP>   EntityVector;
-    
-    DematerializerWP                m_dematerializer_wp;
-    EntityVector                    m_entities;
-    uint32_t                        m_current_offset;
-    uint32_t                        m_struct_alignment;
+  uint32_t AddStructMember(Entity &entity);
+
+  typedef std::unique_ptr<Entity> EntityUP;
+  typedef std::vector<EntityUP> EntityVector;
+
+  DematerializerWP m_dematerializer_wp;
+  EntityVector m_entities;
+  uint32_t m_current_offset;
+  uint32_t m_struct_alignment;
 };
-    
+
 } // namespace lldb_private
 
 #endif // liblldb_Materializer_h

Modified: lldb/trunk/include/lldb/Expression/REPL.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/REPL.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/REPL.h (original)
+++ lldb/trunk/include/lldb/Expression/REPL.h Tue Sep  6 15:57:50 2016
@@ -16,194 +16,159 @@
 
 // Other libraries and framework includes
 // Project includes
+#include "lldb/../../source/Commands/CommandObjectExpression.h"
 #include "lldb/Interpreter/OptionGroupFormat.h"
 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
-#include "lldb/../../source/Commands/CommandObjectExpression.h"
 
-namespace lldb_private
-{
-    
-class REPL : public IOHandlerDelegate
-{
+namespace lldb_private {
+
+class REPL : public IOHandlerDelegate {
 public:
-    //----------------------------------------------------------------------
-    // See TypeSystem.h for how to add subclasses to this.
-    //----------------------------------------------------------------------
-    enum LLVMCastKind {
-        eKindClang,
-        eKindSwift,
-        eKindGo,
-        kNumKinds
-    };
-    
-    LLVMCastKind getKind() const { return m_kind; }
-    
-    REPL(LLVMCastKind kind, Target &target);
-    
-    ~REPL() override;
-    
-    //------------------------------------------------------------------
-    /// Get a REPL with an existing target (or, failing that, a debugger to use), and (optional) extra arguments for the compiler.
-    ///
-    /// @param[out] error
-    ///     If this language is supported but the REPL couldn't be created, this error is populated with the reason.
-    ///
-    /// @param[in] language
-    ///     The language to create a REPL for.
-    ///
-    /// @param[in] debugger
-    ///     If provided, and target is nullptr, the debugger to use when setting up a top-level REPL.
-    ///
-    /// @param[in] target
-    ///     If provided, the target to put the REPL inside.
-    ///
-    /// @param[in] repl_options
-    ///     If provided, additional options for the compiler when parsing REPL expressions.
-    ///
-    /// @return
-    ///     The range of the containing object in the target process.
-    //------------------------------------------------------------------
-    static lldb::REPLSP
-    Create (Error &Error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options);
-
-    void
-    SetFormatOptions (const OptionGroupFormat &options)
-    {
-        m_format_options = options;
-    }
-    
-    void
-    SetValueObjectDisplayOptions (const OptionGroupValueObjectDisplay &options)
-    {
-        m_varobj_options = options;
-    }
-    
-    void
-    SetCommandOptions (const CommandObjectExpression::CommandOptions &options)
-    {
-        m_command_options = options;
-    }
-    
-    void
-    SetCompilerOptions (const char *options)
-    {
-        if (options)
-            m_compiler_options = options;
-    }
-    
-    lldb::IOHandlerSP
-    GetIOHandler ();
-    
-    Error
-    RunLoop ();
-    
-    //------------------------------------------------------------------
-    // IOHandler::Delegate functions
-    //------------------------------------------------------------------
-    void
-    IOHandlerActivated (IOHandler &io_handler) override;
-
-    bool
-    IOHandlerInterrupt (IOHandler &io_handler) override;
-    
-    void
-    IOHandlerInputInterrupted (IOHandler &io_handler,
-                               std::string &line) override;
-
-    const char *
-    IOHandlerGetFixIndentationCharacters () override;
-    
-    ConstString
-    IOHandlerGetControlSequence (char ch) override;
-    
-    const char *
-    IOHandlerGetCommandPrefix () override;
-    
-    const char *
-    IOHandlerGetHelpPrologue () override;
-    
-    bool
-    IOHandlerIsInputComplete (IOHandler &io_handler,
-                              StringList &lines) override;
-    
-    int
-    IOHandlerFixIndentation (IOHandler &io_handler,
-                             const StringList &lines,
-                             int cursor_position) override;
-    
-    void
-    IOHandlerInputComplete (IOHandler &io_handler,
-                            std::string &line) override;
-    
-    int
-    IOHandlerComplete (IOHandler &io_handler,
-                       const char *current_line,
-                       const char *cursor,
-                       const char *last_char,
-                       int skip_first_n_matches,
-                       int max_matches,
-                       StringList &matches) override;
+  //----------------------------------------------------------------------
+  // See TypeSystem.h for how to add subclasses to this.
+  //----------------------------------------------------------------------
+  enum LLVMCastKind { eKindClang, eKindSwift, eKindGo, kNumKinds };
+
+  LLVMCastKind getKind() const { return m_kind; }
+
+  REPL(LLVMCastKind kind, Target &target);
+
+  ~REPL() override;
+
+  //------------------------------------------------------------------
+  /// Get a REPL with an existing target (or, failing that, a debugger to use),
+  /// and (optional) extra arguments for the compiler.
+  ///
+  /// @param[out] error
+  ///     If this language is supported but the REPL couldn't be created, this
+  ///     error is populated with the reason.
+  ///
+  /// @param[in] language
+  ///     The language to create a REPL for.
+  ///
+  /// @param[in] debugger
+  ///     If provided, and target is nullptr, the debugger to use when setting
+  ///     up a top-level REPL.
+  ///
+  /// @param[in] target
+  ///     If provided, the target to put the REPL inside.
+  ///
+  /// @param[in] repl_options
+  ///     If provided, additional options for the compiler when parsing REPL
+  ///     expressions.
+  ///
+  /// @return
+  ///     The range of the containing object in the target process.
+  //------------------------------------------------------------------
+  static lldb::REPLSP Create(Error &Error, lldb::LanguageType language,
+                             Debugger *debugger, Target *target,
+                             const char *repl_options);
+
+  void SetFormatOptions(const OptionGroupFormat &options) {
+    m_format_options = options;
+  }
+
+  void
+  SetValueObjectDisplayOptions(const OptionGroupValueObjectDisplay &options) {
+    m_varobj_options = options;
+  }
+
+  void
+  SetCommandOptions(const CommandObjectExpression::CommandOptions &options) {
+    m_command_options = options;
+  }
+
+  void SetCompilerOptions(const char *options) {
+    if (options)
+      m_compiler_options = options;
+  }
+
+  lldb::IOHandlerSP GetIOHandler();
+
+  Error RunLoop();
+
+  //------------------------------------------------------------------
+  // IOHandler::Delegate functions
+  //------------------------------------------------------------------
+  void IOHandlerActivated(IOHandler &io_handler) override;
+
+  bool IOHandlerInterrupt(IOHandler &io_handler) override;
+
+  void IOHandlerInputInterrupted(IOHandler &io_handler,
+                                 std::string &line) override;
+
+  const char *IOHandlerGetFixIndentationCharacters() override;
+
+  ConstString IOHandlerGetControlSequence(char ch) override;
+
+  const char *IOHandlerGetCommandPrefix() override;
+
+  const char *IOHandlerGetHelpPrologue() override;
+
+  bool IOHandlerIsInputComplete(IOHandler &io_handler,
+                                StringList &lines) override;
+
+  int IOHandlerFixIndentation(IOHandler &io_handler, const StringList &lines,
+                              int cursor_position) override;
+
+  void IOHandlerInputComplete(IOHandler &io_handler,
+                              std::string &line) override;
+
+  int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
+                        const char *cursor, const char *last_char,
+                        int skip_first_n_matches, int max_matches,
+                        StringList &matches) override;
 
 protected:
-    static int
-    CalculateActualIndentation (const StringList &lines);
+  static int CalculateActualIndentation(const StringList &lines);
+
+  //----------------------------------------------------------------------
+  // Subclasses should override these functions to implement a functional REPL.
+  //----------------------------------------------------------------------
+
+  virtual Error DoInitialization() = 0;
+
+  virtual ConstString GetSourceFileBasename() = 0;
+
+  virtual const char *GetAutoIndentCharacters() = 0;
+
+  virtual bool SourceIsComplete(const std::string &source) = 0;
+
+  virtual lldb::offset_t GetDesiredIndentation(
+      const StringList &lines, int cursor_position,
+      int tab_size) = 0; // LLDB_INVALID_OFFSET means no change
+
+  virtual lldb::LanguageType GetLanguage() = 0;
+
+  virtual bool PrintOneVariable(Debugger &debugger,
+                                lldb::StreamFileSP &output_sp,
+                                lldb::ValueObjectSP &valobj_sp,
+                                ExpressionVariable *var = nullptr) = 0;
+
+  virtual int CompleteCode(const std::string &current_code,
+                           StringList &matches) = 0;
+
+  OptionGroupFormat m_format_options = OptionGroupFormat(lldb::eFormatDefault);
+  OptionGroupValueObjectDisplay m_varobj_options;
+  CommandObjectExpression::CommandOptions m_command_options;
+  std::string m_compiler_options;
+
+  bool m_enable_auto_indent = true;
+  std::string m_indent_str; // Use this string for each level of indentation
+  std::string m_current_indent_str;
+  uint32_t m_current_indent_level = 0;
+
+  std::string m_repl_source_path;
+  bool m_dedicated_repl_mode = false;
+
+  StringList m_code; // All accumulated REPL statements are saved here
 
-    //----------------------------------------------------------------------
-    // Subclasses should override these functions to implement a functional REPL.
-    //----------------------------------------------------------------------
-    
-    virtual Error
-    DoInitialization () = 0;
-    
-    virtual ConstString
-    GetSourceFileBasename () = 0;
-    
-    virtual const char *
-    GetAutoIndentCharacters () = 0;
-    
-    virtual bool
-    SourceIsComplete (const std::string &source) = 0;
-    
-    virtual lldb::offset_t
-    GetDesiredIndentation (const StringList &lines,
-                           int cursor_position,
-                           int tab_size) = 0; // LLDB_INVALID_OFFSET means no change
-    
-    virtual lldb::LanguageType
-    GetLanguage () = 0;
-    
-    virtual bool
-    PrintOneVariable (Debugger &debugger,
-                      lldb::StreamFileSP &output_sp,
-                      lldb::ValueObjectSP &valobj_sp,
-                      ExpressionVariable *var = nullptr) = 0;
-    
-    virtual int
-    CompleteCode(const std::string &current_code,
-                 StringList &matches) = 0;
-    
-    OptionGroupFormat m_format_options = OptionGroupFormat(lldb::eFormatDefault);
-    OptionGroupValueObjectDisplay m_varobj_options;
-    CommandObjectExpression::CommandOptions m_command_options;
-    std::string m_compiler_options;
-    
-    bool m_enable_auto_indent = true;
-    std::string m_indent_str; // Use this string for each level of indentation
-    std::string m_current_indent_str;
-    uint32_t m_current_indent_level = 0;
-    
-    std::string m_repl_source_path;
-    bool m_dedicated_repl_mode = false;
-    
-    StringList m_code; // All accumulated REPL statements are saved here
-    
-    Target &m_target;
-    lldb::IOHandlerSP m_io_handler_sp;
-    LLVMCastKind m_kind;
+  Target &m_target;
+  lldb::IOHandlerSP m_io_handler_sp;
+  LLVMCastKind m_kind;
 
 private:
-    std::string
-    GetSourcePath();
+  std::string GetSourcePath();
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Expression/UserExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/UserExpression.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/UserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/UserExpression.h Tue Sep  6 15:57:50 2016
@@ -18,16 +18,15 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-forward.h"
-#include "lldb/lldb-private.h"
 #include "lldb/Core/Address.h"
 #include "lldb/Expression/Expression.h"
 #include "lldb/Expression/Materializer.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Target.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 //----------------------------------------------------------------------
 /// @class UserExpression UserExpression.h "lldb/Expression/UserExpression.h"
@@ -40,308 +39,274 @@ namespace lldb_private
 /// implementations of UserExpression - which will be vended through the
 /// appropriate TypeSystem.
 //----------------------------------------------------------------------
-class UserExpression : public Expression
-{
+class UserExpression : public Expression {
 public:
-    enum { kDefaultTimeout = 500000u };
+  enum { kDefaultTimeout = 500000u };
 
-    //------------------------------------------------------------------
-    /// Constructor
-    ///
-    /// @param[in] expr
-    ///     The expression to parse.
-    ///
-    /// @param[in] expr_prefix
-    ///     If non-nullptr, a C string containing translation-unit level
-    ///     definitions to be included when the expression is parsed.
-    ///
-    /// @param[in] language
-    ///     If not eLanguageTypeUnknown, a language to use when parsing
-    ///     the expression.  Currently restricted to those languages
-    ///     supported by Clang.
-    ///
-    /// @param[in] desired_type
-    ///     If not eResultTypeAny, the type to use for the expression
-    ///     result.
-    //------------------------------------------------------------------
-    UserExpression (ExecutionContextScope &exe_scope,
-                    const char *expr,
-                    const char *expr_prefix,
-                    lldb::LanguageType language,
-                    ResultType desired_type,
-                    const EvaluateExpressionOptions &options);
-
-    //------------------------------------------------------------------
-    /// Destructor
-    //------------------------------------------------------------------
-    ~UserExpression() override;
-
-    //------------------------------------------------------------------
-    /// Parse the expression
-    ///
-    /// @param[in] diagnostic_manager
-    ///     A diagnostic manager to report parse errors and warnings to.
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to use when looking up entities that
-    ///     are needed for parsing (locations of functions, types of
-    ///     variables, persistent variables, etc.)
-    ///
-    /// @param[in] execution_policy
-    ///     Determines whether interpretation is possible or mandatory.
-    ///
-    /// @param[in] keep_result_in_memory
-    ///     True if the resulting persistent variable should reside in
-    ///     target memory, if applicable.
-    ///
-    /// @return
-    ///     True on success (no errors); false otherwise.
-    //------------------------------------------------------------------
-    virtual bool
-    Parse(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
-          lldb_private::ExecutionPolicy execution_policy, bool keep_result_in_memory, bool generate_debug_info) = 0;
-
-    virtual bool CanInterpret() = 0;
-
-    bool
-    MatchesContext (ExecutionContext &exe_ctx);
-
-    //------------------------------------------------------------------
-    /// Execute the parsed expression by callinng the derived class's
-    /// DoExecute method.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     A diagnostic manager to report errors to.
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to use when looking up entities that
-    ///     are needed for parsing (locations of variables, etc.)
-    ///
-    /// @param[in] options
-    ///     Expression evaluation options.
-    ///
-    /// @param[in] shared_ptr_to_me
-    ///     This is a shared pointer to this UserExpression.  This is
-    ///     needed because Execute can push a thread plan that will hold onto
-    ///     the UserExpression for an unbounded period of time.  So you
-    ///     need to give the thread plan a reference to this object that can
-    ///     keep it alive.
-    ///
-    /// @param[in] result
-    ///     A pointer to direct at the persistent variable in which the
-    ///     expression's result is stored.
-    ///
-    /// @return
-    ///     A Process::Execution results value.
-    //------------------------------------------------------------------
-    lldb::ExpressionResults
-    Execute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options,
-            lldb::UserExpressionSP &shared_ptr_to_me, lldb::ExpressionVariableSP &result);
-
-    //------------------------------------------------------------------
-    /// Apply the side effects of the function to program state.
-    ///
-    /// @param[in] diagnostic_manager
-    ///     A diagnostic manager to report errors to.
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to use when looking up entities that
-    ///     are needed for parsing (locations of variables, etc.)
-    ///
-    /// @param[in] result
-    ///     A pointer to direct at the persistent variable in which the
-    ///     expression's result is stored.
-    ///
-    /// @param[in] function_stack_pointer
-    ///     A pointer to the base of the function's stack frame.  This
-    ///     is used to determine whether the expression result resides in
-    ///     memory that will still be valid, or whether it needs to be
-    ///     treated as homeless for the purpose of future expressions.
-    ///
-    /// @return
-    ///     A Process::Execution results value.
-    //------------------------------------------------------------------
-    virtual bool
-    FinalizeJITExecution(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
-                         lldb::ExpressionVariableSP &result, lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
-                         lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS) = 0;
-
-    //------------------------------------------------------------------
-    /// Return the string that the parser should parse.
-    //------------------------------------------------------------------
-    const char *
-    Text() override
-    {
-        return m_expr_text.c_str();
-    }
-
-    //------------------------------------------------------------------
-    /// Return the string that the user typed.
-    //------------------------------------------------------------------
-    const char *
-    GetUserText ()
-    {
-        return m_expr_text.c_str();
-    }
-
-    //------------------------------------------------------------------
-    /// Return the function name that should be used for executing the
-    /// expression.  Text() should contain the definition of this
-    /// function.
-    //------------------------------------------------------------------
-    const char *
-    FunctionName() override
-    {
-        return "$__lldb_expr";
-    }
-
-    //------------------------------------------------------------------
-    /// Return the language that should be used when parsing.  To use
-    /// the default, return eLanguageTypeUnknown.
-    //------------------------------------------------------------------
-    lldb::LanguageType
-    Language() override
-    {
-        return m_language;
-    }
-
-    //------------------------------------------------------------------
-    /// Return the desired result type of the function, or
-    /// eResultTypeAny if indifferent.
-    //------------------------------------------------------------------
-    ResultType
-    DesiredResultType() override
-    {
-        return m_desired_type;
-    }
-
-    //------------------------------------------------------------------
-    /// Return true if validation code should be inserted into the
-    /// expression.
-    //------------------------------------------------------------------
-    bool
-    NeedsValidation() override
-    {
-        return true;
-    }
-
-    //------------------------------------------------------------------
-    /// Return true if external variables in the expression should be
-    /// resolved.
-    //------------------------------------------------------------------
-    bool
-    NeedsVariableResolution() override
-    {
-        return true;
-    }
-    
-    EvaluateExpressionOptions *
-    GetOptions() override
-    {
-        return &m_options;
-    }
-    
-    virtual lldb::ExpressionVariableSP
-    GetResultAfterDematerialization(ExecutionContextScope *exe_scope)
-    {
-        return lldb::ExpressionVariableSP();
-    }
-
-    virtual lldb::ModuleSP
-    GetJITModule()
-    {
-        return lldb::ModuleSP();
-    }
-
-    //------------------------------------------------------------------
-    /// Evaluate one expression in the scratch context of the
-    /// target passed in the exe_ctx and return its result.
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to use when evaluating the expression.
-    ///
-    /// @param[in] options
-    ///     Expression evaluation options.  N.B. The language in the
-    ///     evaluation options will be used to determine the language used for
-    ///     expression evaluation.
-    ///
-    /// @param[in] expr_cstr
-    ///     A C string containing the expression to be evaluated.
-    ///
-    /// @param[in] expr_prefix
-    ///     If non-nullptr, a C string containing translation-unit level
-    ///     definitions to be included when the expression is parsed.
-    ///
-    /// @param[in,out] result_valobj_sp
-    ///      If execution is successful, the result valobj is placed here.
-    ///
-    /// @param[out] error
-    ///     Filled in with an error in case the expression evaluation
-    ///     fails to parse, run, or evaluated.
-    ///
-    /// @param[in] line_offset
-    ///     The offset of the first line of the expression from the "beginning" of a virtual source file used for error reporting and debug info.
-    ///
-    /// @param[out] fixed_expression
-    ///     If non-nullptr, the fixed expression is copied into the provided string.
-    ///
-    /// @param[out] jit_module_sp_ptr
-    ///     If non-nullptr, used to persist the generated IR module.
-    ///
-    /// @result
-    ///      A Process::ExpressionResults value.  eExpressionCompleted for success.
-    //------------------------------------------------------------------
-    static lldb::ExpressionResults
-    Evaluate(ExecutionContext &exe_ctx,
-             const EvaluateExpressionOptions& options,
-             const char *expr_cstr,
-             const char *expr_prefix,
-             lldb::ValueObjectSP &result_valobj_sp,
-             Error &error,
-             uint32_t line_offset = 0,
-             std::string *fixed_expression = nullptr,
-             lldb::ModuleSP *jit_module_sp_ptr = nullptr);
-
-    static const Error::ValueType kNoResult = 0x1001; ///< ValueObject::GetError() returns this if there is no result from the expression.
-    
-    const char *
-    GetFixedText()
-    {
-        if (m_fixed_text.empty())
-            return nullptr;
-        return m_fixed_text.c_str();
-    }
+  //------------------------------------------------------------------
+  /// Constructor
+  ///
+  /// @param[in] expr
+  ///     The expression to parse.
+  ///
+  /// @param[in] expr_prefix
+  ///     If non-nullptr, a C string containing translation-unit level
+  ///     definitions to be included when the expression is parsed.
+  ///
+  /// @param[in] language
+  ///     If not eLanguageTypeUnknown, a language to use when parsing
+  ///     the expression.  Currently restricted to those languages
+  ///     supported by Clang.
+  ///
+  /// @param[in] desired_type
+  ///     If not eResultTypeAny, the type to use for the expression
+  ///     result.
+  //------------------------------------------------------------------
+  UserExpression(ExecutionContextScope &exe_scope, const char *expr,
+                 const char *expr_prefix, lldb::LanguageType language,
+                 ResultType desired_type,
+                 const EvaluateExpressionOptions &options);
+
+  //------------------------------------------------------------------
+  /// Destructor
+  //------------------------------------------------------------------
+  ~UserExpression() override;
+
+  //------------------------------------------------------------------
+  /// Parse the expression
+  ///
+  /// @param[in] diagnostic_manager
+  ///     A diagnostic manager to report parse errors and warnings to.
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to use when looking up entities that
+  ///     are needed for parsing (locations of functions, types of
+  ///     variables, persistent variables, etc.)
+  ///
+  /// @param[in] execution_policy
+  ///     Determines whether interpretation is possible or mandatory.
+  ///
+  /// @param[in] keep_result_in_memory
+  ///     True if the resulting persistent variable should reside in
+  ///     target memory, if applicable.
+  ///
+  /// @return
+  ///     True on success (no errors); false otherwise.
+  //------------------------------------------------------------------
+  virtual bool Parse(DiagnosticManager &diagnostic_manager,
+                     ExecutionContext &exe_ctx,
+                     lldb_private::ExecutionPolicy execution_policy,
+                     bool keep_result_in_memory, bool generate_debug_info) = 0;
+
+  virtual bool CanInterpret() = 0;
+
+  bool MatchesContext(ExecutionContext &exe_ctx);
+
+  //------------------------------------------------------------------
+  /// Execute the parsed expression by callinng the derived class's
+  /// DoExecute method.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     A diagnostic manager to report errors to.
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to use when looking up entities that
+  ///     are needed for parsing (locations of variables, etc.)
+  ///
+  /// @param[in] options
+  ///     Expression evaluation options.
+  ///
+  /// @param[in] shared_ptr_to_me
+  ///     This is a shared pointer to this UserExpression.  This is
+  ///     needed because Execute can push a thread plan that will hold onto
+  ///     the UserExpression for an unbounded period of time.  So you
+  ///     need to give the thread plan a reference to this object that can
+  ///     keep it alive.
+  ///
+  /// @param[in] result
+  ///     A pointer to direct at the persistent variable in which the
+  ///     expression's result is stored.
+  ///
+  /// @return
+  ///     A Process::Execution results value.
+  //------------------------------------------------------------------
+  lldb::ExpressionResults Execute(DiagnosticManager &diagnostic_manager,
+                                  ExecutionContext &exe_ctx,
+                                  const EvaluateExpressionOptions &options,
+                                  lldb::UserExpressionSP &shared_ptr_to_me,
+                                  lldb::ExpressionVariableSP &result);
+
+  //------------------------------------------------------------------
+  /// Apply the side effects of the function to program state.
+  ///
+  /// @param[in] diagnostic_manager
+  ///     A diagnostic manager to report errors to.
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to use when looking up entities that
+  ///     are needed for parsing (locations of variables, etc.)
+  ///
+  /// @param[in] result
+  ///     A pointer to direct at the persistent variable in which the
+  ///     expression's result is stored.
+  ///
+  /// @param[in] function_stack_pointer
+  ///     A pointer to the base of the function's stack frame.  This
+  ///     is used to determine whether the expression result resides in
+  ///     memory that will still be valid, or whether it needs to be
+  ///     treated as homeless for the purpose of future expressions.
+  ///
+  /// @return
+  ///     A Process::Execution results value.
+  //------------------------------------------------------------------
+  virtual bool FinalizeJITExecution(
+      DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+      lldb::ExpressionVariableSP &result,
+      lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
+      lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS) = 0;
+
+  //------------------------------------------------------------------
+  /// Return the string that the parser should parse.
+  //------------------------------------------------------------------
+  const char *Text() override { return m_expr_text.c_str(); }
+
+  //------------------------------------------------------------------
+  /// Return the string that the user typed.
+  //------------------------------------------------------------------
+  const char *GetUserText() { return m_expr_text.c_str(); }
+
+  //------------------------------------------------------------------
+  /// Return the function name that should be used for executing the
+  /// expression.  Text() should contain the definition of this
+  /// function.
+  //------------------------------------------------------------------
+  const char *FunctionName() override { return "$__lldb_expr"; }
+
+  //------------------------------------------------------------------
+  /// Return the language that should be used when parsing.  To use
+  /// the default, return eLanguageTypeUnknown.
+  //------------------------------------------------------------------
+  lldb::LanguageType Language() override { return m_language; }
+
+  //------------------------------------------------------------------
+  /// Return the desired result type of the function, or
+  /// eResultTypeAny if indifferent.
+  //------------------------------------------------------------------
+  ResultType DesiredResultType() override { return m_desired_type; }
+
+  //------------------------------------------------------------------
+  /// Return true if validation code should be inserted into the
+  /// expression.
+  //------------------------------------------------------------------
+  bool NeedsValidation() override { return true; }
+
+  //------------------------------------------------------------------
+  /// Return true if external variables in the expression should be
+  /// resolved.
+  //------------------------------------------------------------------
+  bool NeedsVariableResolution() override { return true; }
+
+  EvaluateExpressionOptions *GetOptions() override { return &m_options; }
+
+  virtual lldb::ExpressionVariableSP
+  GetResultAfterDematerialization(ExecutionContextScope *exe_scope) {
+    return lldb::ExpressionVariableSP();
+  }
+
+  virtual lldb::ModuleSP GetJITModule() { return lldb::ModuleSP(); }
+
+  //------------------------------------------------------------------
+  /// Evaluate one expression in the scratch context of the
+  /// target passed in the exe_ctx and return its result.
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to use when evaluating the expression.
+  ///
+  /// @param[in] options
+  ///     Expression evaluation options.  N.B. The language in the
+  ///     evaluation options will be used to determine the language used for
+  ///     expression evaluation.
+  ///
+  /// @param[in] expr_cstr
+  ///     A C string containing the expression to be evaluated.
+  ///
+  /// @param[in] expr_prefix
+  ///     If non-nullptr, a C string containing translation-unit level
+  ///     definitions to be included when the expression is parsed.
+  ///
+  /// @param[in,out] result_valobj_sp
+  ///      If execution is successful, the result valobj is placed here.
+  ///
+  /// @param[out] error
+  ///     Filled in with an error in case the expression evaluation
+  ///     fails to parse, run, or evaluated.
+  ///
+  /// @param[in] line_offset
+  ///     The offset of the first line of the expression from the "beginning" of
+  ///     a virtual source file used for error reporting and debug info.
+  ///
+  /// @param[out] fixed_expression
+  ///     If non-nullptr, the fixed expression is copied into the provided
+  ///     string.
+  ///
+  /// @param[out] jit_module_sp_ptr
+  ///     If non-nullptr, used to persist the generated IR module.
+  ///
+  /// @result
+  ///      A Process::ExpressionResults value.  eExpressionCompleted for
+  ///      success.
+  //------------------------------------------------------------------
+  static lldb::ExpressionResults
+  Evaluate(ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options,
+           const char *expr_cstr, const char *expr_prefix,
+           lldb::ValueObjectSP &result_valobj_sp, Error &error,
+           uint32_t line_offset = 0, std::string *fixed_expression = nullptr,
+           lldb::ModuleSP *jit_module_sp_ptr = nullptr);
+
+  static const Error::ValueType kNoResult =
+      0x1001; ///< ValueObject::GetError() returns this if there is no result
+              ///from the expression.
+
+  const char *GetFixedText() {
+    if (m_fixed_text.empty())
+      return nullptr;
+    return m_fixed_text.c_str();
+  }
 
 protected:
-    virtual lldb::ExpressionResults
-    DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options,
-            lldb::UserExpressionSP &shared_ptr_to_me, lldb::ExpressionVariableSP &result) = 0;
-
-    static lldb::addr_t
-    GetObjectPointer (lldb::StackFrameSP frame_sp,
-                      ConstString &object_name,
-                      Error &err);
-
-    //------------------------------------------------------------------
-    /// Populate m_in_cplusplus_method and m_in_objectivec_method based on the environment.
-    //------------------------------------------------------------------
-
-    void
-    InstallContext (ExecutionContext &exe_ctx);
-
-    bool
-    LockAndCheckContext (ExecutionContext &exe_ctx,
-                         lldb::TargetSP &target_sp,
-                         lldb::ProcessSP &process_sp,
-                         lldb::StackFrameSP &frame_sp);
-
-    Address                                     m_address;              ///< The address the process is stopped in.
-    std::string                                 m_expr_text;            ///< The text of the expression, as typed by the user
-    std::string                                 m_expr_prefix;          ///< The text of the translation-level definitions, as provided by the user
-    std::string                                 m_fixed_text;           ///< The text of the expression with fix-its applied - this won't be set if the fixed text doesn't parse.
-    lldb::LanguageType                          m_language;             ///< The language to use when parsing (eLanguageTypeUnknown means use defaults)
-    ResultType                                  m_desired_type;         ///< The type to coerce the expression's result to.  If eResultTypeAny, inferred from the expression.
-    EvaluateExpressionOptions                   m_options;              ///< Additional options provided by the user.
+  virtual lldb::ExpressionResults
+  DoExecute(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
+            const EvaluateExpressionOptions &options,
+            lldb::UserExpressionSP &shared_ptr_to_me,
+            lldb::ExpressionVariableSP &result) = 0;
+
+  static lldb::addr_t GetObjectPointer(lldb::StackFrameSP frame_sp,
+                                       ConstString &object_name, Error &err);
+
+  //------------------------------------------------------------------
+  /// Populate m_in_cplusplus_method and m_in_objectivec_method based on the
+  /// environment.
+  //------------------------------------------------------------------
+
+  void InstallContext(ExecutionContext &exe_ctx);
+
+  bool LockAndCheckContext(ExecutionContext &exe_ctx, lldb::TargetSP &target_sp,
+                           lldb::ProcessSP &process_sp,
+                           lldb::StackFrameSP &frame_sp);
+
+  Address m_address;       ///< The address the process is stopped in.
+  std::string m_expr_text; ///< The text of the expression, as typed by the user
+  std::string m_expr_prefix; ///< The text of the translation-level definitions,
+                             ///as provided by the user
+  std::string m_fixed_text; ///< The text of the expression with fix-its applied
+                            ///- this won't be set if the fixed text doesn't
+                            ///parse.
+  lldb::LanguageType m_language; ///< The language to use when parsing
+                                 ///(eLanguageTypeUnknown means use defaults)
+  ResultType m_desired_type; ///< The type to coerce the expression's result to.
+                             ///If eResultTypeAny, inferred from the expression.
+  EvaluateExpressionOptions
+      m_options; ///< Additional options provided by the user.
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Expression/UtilityFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/UtilityFunction.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/UtilityFunction.h (original)
+++ lldb/trunk/include/lldb/Expression/UtilityFunction.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- UtilityFunction.h ----------------------------------------*- C++ -*-===//
+//===-- UtilityFunction.h ----------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -17,146 +18,124 @@
 
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Expression/Expression.h"
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private.h"
-#include "lldb/Expression/Expression.h"
 
-namespace lldb_private 
-{
+namespace lldb_private {
 
 //----------------------------------------------------------------------
 /// @class UtilityFunction UtilityFunction.h "lldb/Expression/UtilityFunction.h"
-/// @brief Encapsulates a bit of source code that provides a function that is callable
+/// @brief Encapsulates a bit of source code that provides a function that is
+/// callable
 ///
 /// LLDB uses expressions for various purposes, notably to call functions
 /// and as a backend for the expr command.  UtilityFunction encapsulates
 /// a self-contained function meant to be used from other code.  Utility
-/// functions can perform error-checking for ClangUserExpressions, 
+/// functions can perform error-checking for ClangUserExpressions,
 //----------------------------------------------------------------------
-class UtilityFunction : public Expression
-{
+class UtilityFunction : public Expression {
 public:
-    //------------------------------------------------------------------
-    /// Constructor
-    ///
-    /// @param[in] text
-    ///     The text of the function.  Must be a full translation unit.
-    ///
-    /// @param[in] name
-    ///     The name of the function, as used in the text.
-    //------------------------------------------------------------------
-    UtilityFunction (ExecutionContextScope &exe_scope,
-                     const char *text,
-                     const char *name);
-    
-    ~UtilityFunction() override;
-
-    //------------------------------------------------------------------
-    /// Install the utility function into a process
-    ///
-    /// @param[in] diagnostic_manager
-    ///     A diagnostic manager to print parse errors and warnings to.
-    ///
-    /// @param[in] exe_ctx
-    ///     The execution context to install the utility function to.
-    ///
-    /// @return
-    ///     True on success (no errors); false otherwise.
-    //------------------------------------------------------------------
-    virtual bool
-    Install(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx) = 0;
-
-    //------------------------------------------------------------------
-    /// Check whether the given PC is inside the function
-    ///
-    /// Especially useful if the function dereferences nullptr to indicate a failed
-    /// assert.
-    ///
-    /// @param[in] pc
-    ///     The program counter to check.
-    ///
-    /// @return
-    ///     True if the program counter falls within the function's bounds;
-    ///     false if not (or the function is not JIT compiled)
-    //------------------------------------------------------------------
-    bool
-    ContainsAddress (lldb::addr_t address)
-    {
-        // nothing is both >= LLDB_INVALID_ADDRESS and < LLDB_INVALID_ADDRESS,
-        // so this always returns false if the function is not JIT compiled yet
-        return (address >= m_jit_start_addr && address < m_jit_end_addr);
-    }
-
-    //------------------------------------------------------------------
-    /// Return the string that the parser should parse.  Must be a full
-    /// translation unit.
-    //------------------------------------------------------------------
-    const char *
-    Text() override
-    {
-        return m_function_text.c_str();
-    }
-    
-    //------------------------------------------------------------------
-    /// Return the function name that should be used for executing the
-    /// expression.  Text() should contain the definition of this
-    /// function.
-    //------------------------------------------------------------------
-    const char *
-    FunctionName() override
-    {
-        return m_function_name.c_str();
-    }
-    
-    //------------------------------------------------------------------
-    /// Return the object that the parser should use when registering
-    /// local variables. May be nullptr if the Expression doesn't care.
-    //------------------------------------------------------------------
-    ExpressionVariableList *
-    LocalVariables ()
-    {
-        return nullptr;
-    }
-    
-    //------------------------------------------------------------------
-    /// Return true if validation code should be inserted into the
-    /// expression.
-    //------------------------------------------------------------------
-    bool
-    NeedsValidation() override
-    {
-        return false;
-    }
-    
-    //------------------------------------------------------------------
-    /// Return true if external variables in the expression should be
-    /// resolved.
-    //------------------------------------------------------------------
-    bool
-    NeedsVariableResolution() override
-    {
-        return false;
-    }
-    
-    // This makes the function caller function.
-    // Pass in the ThreadSP if you have one available, compilation can end up calling code (e.g. to look up indirect
-    // functions) and we don't want this to wander onto another thread.
-    FunctionCaller *
-    MakeFunctionCaller(const CompilerType &return_type, const ValueList &arg_value_list, lldb::ThreadSP compilation_thread, Error &error);
-    
-    // This one retrieves the function caller that is already made.  If you haven't made it yet, this returns nullptr
-    FunctionCaller *
-    GetFunctionCaller()
-    {
-        return m_caller_up.get();
-    }
-    
+  //------------------------------------------------------------------
+  /// Constructor
+  ///
+  /// @param[in] text
+  ///     The text of the function.  Must be a full translation unit.
+  ///
+  /// @param[in] name
+  ///     The name of the function, as used in the text.
+  //------------------------------------------------------------------
+  UtilityFunction(ExecutionContextScope &exe_scope, const char *text,
+                  const char *name);
+
+  ~UtilityFunction() override;
+
+  //------------------------------------------------------------------
+  /// Install the utility function into a process
+  ///
+  /// @param[in] diagnostic_manager
+  ///     A diagnostic manager to print parse errors and warnings to.
+  ///
+  /// @param[in] exe_ctx
+  ///     The execution context to install the utility function to.
+  ///
+  /// @return
+  ///     True on success (no errors); false otherwise.
+  //------------------------------------------------------------------
+  virtual bool Install(DiagnosticManager &diagnostic_manager,
+                       ExecutionContext &exe_ctx) = 0;
+
+  //------------------------------------------------------------------
+  /// Check whether the given PC is inside the function
+  ///
+  /// Especially useful if the function dereferences nullptr to indicate a
+  /// failed
+  /// assert.
+  ///
+  /// @param[in] pc
+  ///     The program counter to check.
+  ///
+  /// @return
+  ///     True if the program counter falls within the function's bounds;
+  ///     false if not (or the function is not JIT compiled)
+  //------------------------------------------------------------------
+  bool ContainsAddress(lldb::addr_t address) {
+    // nothing is both >= LLDB_INVALID_ADDRESS and < LLDB_INVALID_ADDRESS,
+    // so this always returns false if the function is not JIT compiled yet
+    return (address >= m_jit_start_addr && address < m_jit_end_addr);
+  }
+
+  //------------------------------------------------------------------
+  /// Return the string that the parser should parse.  Must be a full
+  /// translation unit.
+  //------------------------------------------------------------------
+  const char *Text() override { return m_function_text.c_str(); }
+
+  //------------------------------------------------------------------
+  /// Return the function name that should be used for executing the
+  /// expression.  Text() should contain the definition of this
+  /// function.
+  //------------------------------------------------------------------
+  const char *FunctionName() override { return m_function_name.c_str(); }
+
+  //------------------------------------------------------------------
+  /// Return the object that the parser should use when registering
+  /// local variables. May be nullptr if the Expression doesn't care.
+  //------------------------------------------------------------------
+  ExpressionVariableList *LocalVariables() { return nullptr; }
+
+  //------------------------------------------------------------------
+  /// Return true if validation code should be inserted into the
+  /// expression.
+  //------------------------------------------------------------------
+  bool NeedsValidation() override { return false; }
+
+  //------------------------------------------------------------------
+  /// Return true if external variables in the expression should be
+  /// resolved.
+  //------------------------------------------------------------------
+  bool NeedsVariableResolution() override { return false; }
+
+  // This makes the function caller function.
+  // Pass in the ThreadSP if you have one available, compilation can end up
+  // calling code (e.g. to look up indirect
+  // functions) and we don't want this to wander onto another thread.
+  FunctionCaller *MakeFunctionCaller(const CompilerType &return_type,
+                                     const ValueList &arg_value_list,
+                                     lldb::ThreadSP compilation_thread,
+                                     Error &error);
+
+  // This one retrieves the function caller that is already made.  If you
+  // haven't made it yet, this returns nullptr
+  FunctionCaller *GetFunctionCaller() { return m_caller_up.get(); }
+
 protected:
-    std::shared_ptr<IRExecutionUnit>         m_execution_unit_sp;
-    lldb::ModuleWP                           m_jit_module_wp;
-    std::string                              m_function_text;    ///< The text of the function.  Must be a well-formed translation unit.
-    std::string                              m_function_name;    ///< The name of the function.
-    std::unique_ptr<FunctionCaller>          m_caller_up;
+  std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
+  lldb::ModuleWP m_jit_module_wp;
+  std::string m_function_text; ///< The text of the function.  Must be a
+                               ///well-formed translation unit.
+  std::string m_function_name; ///< The name of the function.
+  std::unique_ptr<FunctionCaller> m_caller_up;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Config.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Config.h (original)
+++ lldb/trunk/include/lldb/Host/Config.h Tue Sep  6 15:57:50 2016
@@ -22,7 +22,8 @@
 
 #include "lldb/Host/linux/Config.h"
 
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ||                   \
+    defined(__OpenBSD__)
 
 #include "lldb/Host/freebsd/Config.h"
 
@@ -30,7 +31,7 @@
 
 #include "lldb/Host/netbsd/Config.h"
 
-#elif defined(__MINGW__) || defined (__MINGW32__)
+#elif defined(__MINGW__) || defined(__MINGW32__)
 
 #include "lldb/Host/mingw/Config.h"
 

Modified: lldb/trunk/include/lldb/Host/Debug.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Debug.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Debug.h (original)
+++ lldb/trunk/include/lldb/Host/Debug.h Tue Sep  6 15:57:50 2016
@@ -20,191 +20,141 @@
 
 namespace lldb_private {
 
-    //------------------------------------------------------------------
-    // Tells a thread what it needs to do when the process is resumed.
-    //------------------------------------------------------------------
-    struct ResumeAction
-    {
-        lldb::tid_t tid;        // The thread ID that this action applies to, LLDB_INVALID_THREAD_ID for the default thread action
-        lldb::StateType state;  // Valid values are eStateStopped/eStateSuspended, eStateRunning, and eStateStepping.
-        int signal;             // When resuming this thread, resume it with this signal if this value is > 0
-    };
-
-    //------------------------------------------------------------------
-    // A class that contains instructions for all threads for
-    // NativeProcessProtocol::Resume(). Each thread can either run, stay
-    // suspended, or step when the process is resumed. We optionally
-    // have the ability to also send a signal to the thread when the
-    // action is run or step.
-    //------------------------------------------------------------------
-    class ResumeActionList
-    {
-    public:
-        ResumeActionList () :
-            m_actions (),
-            m_signal_handled ()
-        {
-        }
-
-        ResumeActionList (lldb::StateType default_action, int signal) :
-            m_actions(),
-            m_signal_handled ()
-        {
-            SetDefaultThreadActionIfNeeded (default_action, signal);
-        }
-
-        ResumeActionList (const ResumeAction *actions, size_t num_actions) :
-            m_actions (),
-            m_signal_handled ()
-        {
-            if (actions && num_actions)
-            {
-                m_actions.assign (actions, actions + num_actions);
-                m_signal_handled.assign (num_actions, false);
-            }
-        }
-
-        ~ResumeActionList() = default;
-
-        bool
-        IsEmpty() const
-        {
-            return m_actions.empty();
-        }
-
-        void
-        Append (const ResumeAction &action)
-        {
-            m_actions.push_back (action);
-            m_signal_handled.push_back (false);
-        }
-
-        void
-        AppendAction (lldb::tid_t tid,
-                      lldb::StateType state,
-                      int signal = 0)
-        {
-            ResumeAction action = { tid, state, signal };
-            Append (action);
-        }
-
-        void
-        AppendResumeAll ()
-        {
-            AppendAction (LLDB_INVALID_THREAD_ID, lldb::eStateRunning);
-        }
-
-        void
-        AppendSuspendAll ()
-        {
-            AppendAction (LLDB_INVALID_THREAD_ID, lldb::eStateStopped);
-        }
-
-        void
-        AppendStepAll ()
-        {
-            AppendAction (LLDB_INVALID_THREAD_ID, lldb::eStateStepping);
-        }
-
-        const ResumeAction *
-        GetActionForThread (lldb::tid_t tid, bool default_ok) const
-        {
-            const size_t num_actions = m_actions.size();
-            for (size_t i=0; i<num_actions; ++i)
-            {
-                if (m_actions[i].tid == tid)
-                    return &m_actions[i];
-            }
-            if (default_ok && tid != LLDB_INVALID_THREAD_ID)
-                return GetActionForThread (LLDB_INVALID_THREAD_ID, false);
-            return nullptr;
-        }
-
-        size_t
-        NumActionsWithState (lldb::StateType state) const
-        {
-            size_t count = 0;
-            const size_t num_actions = m_actions.size();
-            for (size_t i=0; i<num_actions; ++i)
-            {
-                if (m_actions[i].state == state)
-                    ++count;
-            }
-            return count;
-        }
-
-        bool
-        SetDefaultThreadActionIfNeeded (lldb::StateType action, int signal)
-        {
-            if (GetActionForThread (LLDB_INVALID_THREAD_ID, true) == nullptr)
-            {
-                // There isn't a default action so we do need to set it.
-                ResumeAction default_action = {LLDB_INVALID_THREAD_ID, action, signal };
-                m_actions.push_back (default_action);
-                m_signal_handled.push_back (false);
-                return true; // Return true as we did add the default action
-            }
-            return false;
-        }
-
-        void
-        SetSignalHandledForThread (lldb::tid_t tid) const
-        {
-            if (tid != LLDB_INVALID_THREAD_ID)
-            {
-                const size_t num_actions = m_actions.size();
-                for (size_t i=0; i<num_actions; ++i)
-                {
-                    if (m_actions[i].tid == tid)
-                        m_signal_handled[i] = true;
-                }
-            }
-        }
-
-        const ResumeAction *
-        GetFirst() const
-        {
-            return m_actions.data();
-        }
-
-        size_t
-        GetSize () const
-        {
-            return m_actions.size();
-        }
-
-        void
-        Clear()
-        {
-            m_actions.clear();
-            m_signal_handled.clear();
-        }
-
-    protected:
-        std::vector<ResumeAction> m_actions;
-        mutable std::vector<bool> m_signal_handled;
-    };
-
-    struct ThreadStopInfo
-    {
-        lldb::StopReason reason;
-        union
-        {
-            // eStopReasonSignal
-            struct
-            {
-                uint32_t signo;
-            } signal;
-
-            // eStopReasonException
-            struct
-            {
-                uint64_t type;
-                uint32_t data_count;
-                lldb::addr_t data[8];
-            } exception;
-        } details;
-    };
+//------------------------------------------------------------------
+// Tells a thread what it needs to do when the process is resumed.
+//------------------------------------------------------------------
+struct ResumeAction {
+  lldb::tid_t tid;       // The thread ID that this action applies to,
+                         // LLDB_INVALID_THREAD_ID for the default thread action
+  lldb::StateType state; // Valid values are eStateStopped/eStateSuspended,
+                         // eStateRunning, and eStateStepping.
+  int signal; // When resuming this thread, resume it with this signal if this
+              // value is > 0
+};
+
+//------------------------------------------------------------------
+// A class that contains instructions for all threads for
+// NativeProcessProtocol::Resume(). Each thread can either run, stay
+// suspended, or step when the process is resumed. We optionally
+// have the ability to also send a signal to the thread when the
+// action is run or step.
+//------------------------------------------------------------------
+class ResumeActionList {
+public:
+  ResumeActionList() : m_actions(), m_signal_handled() {}
+
+  ResumeActionList(lldb::StateType default_action, int signal)
+      : m_actions(), m_signal_handled() {
+    SetDefaultThreadActionIfNeeded(default_action, signal);
+  }
+
+  ResumeActionList(const ResumeAction *actions, size_t num_actions)
+      : m_actions(), m_signal_handled() {
+    if (actions && num_actions) {
+      m_actions.assign(actions, actions + num_actions);
+      m_signal_handled.assign(num_actions, false);
+    }
+  }
+
+  ~ResumeActionList() = default;
+
+  bool IsEmpty() const { return m_actions.empty(); }
+
+  void Append(const ResumeAction &action) {
+    m_actions.push_back(action);
+    m_signal_handled.push_back(false);
+  }
+
+  void AppendAction(lldb::tid_t tid, lldb::StateType state, int signal = 0) {
+    ResumeAction action = {tid, state, signal};
+    Append(action);
+  }
+
+  void AppendResumeAll() {
+    AppendAction(LLDB_INVALID_THREAD_ID, lldb::eStateRunning);
+  }
+
+  void AppendSuspendAll() {
+    AppendAction(LLDB_INVALID_THREAD_ID, lldb::eStateStopped);
+  }
+
+  void AppendStepAll() {
+    AppendAction(LLDB_INVALID_THREAD_ID, lldb::eStateStepping);
+  }
+
+  const ResumeAction *GetActionForThread(lldb::tid_t tid,
+                                         bool default_ok) const {
+    const size_t num_actions = m_actions.size();
+    for (size_t i = 0; i < num_actions; ++i) {
+      if (m_actions[i].tid == tid)
+        return &m_actions[i];
+    }
+    if (default_ok && tid != LLDB_INVALID_THREAD_ID)
+      return GetActionForThread(LLDB_INVALID_THREAD_ID, false);
+    return nullptr;
+  }
+
+  size_t NumActionsWithState(lldb::StateType state) const {
+    size_t count = 0;
+    const size_t num_actions = m_actions.size();
+    for (size_t i = 0; i < num_actions; ++i) {
+      if (m_actions[i].state == state)
+        ++count;
+    }
+    return count;
+  }
+
+  bool SetDefaultThreadActionIfNeeded(lldb::StateType action, int signal) {
+    if (GetActionForThread(LLDB_INVALID_THREAD_ID, true) == nullptr) {
+      // There isn't a default action so we do need to set it.
+      ResumeAction default_action = {LLDB_INVALID_THREAD_ID, action, signal};
+      m_actions.push_back(default_action);
+      m_signal_handled.push_back(false);
+      return true; // Return true as we did add the default action
+    }
+    return false;
+  }
+
+  void SetSignalHandledForThread(lldb::tid_t tid) const {
+    if (tid != LLDB_INVALID_THREAD_ID) {
+      const size_t num_actions = m_actions.size();
+      for (size_t i = 0; i < num_actions; ++i) {
+        if (m_actions[i].tid == tid)
+          m_signal_handled[i] = true;
+      }
+    }
+  }
+
+  const ResumeAction *GetFirst() const { return m_actions.data(); }
+
+  size_t GetSize() const { return m_actions.size(); }
+
+  void Clear() {
+    m_actions.clear();
+    m_signal_handled.clear();
+  }
+
+protected:
+  std::vector<ResumeAction> m_actions;
+  mutable std::vector<bool> m_signal_handled;
+};
+
+struct ThreadStopInfo {
+  lldb::StopReason reason;
+  union {
+    // eStopReasonSignal
+    struct {
+      uint32_t signo;
+    } signal;
+
+    // eStopReasonException
+    struct {
+      uint64_t type;
+      uint32_t data_count;
+      lldb::addr_t data[8];
+    } exception;
+  } details;
+};
 }
 
 #endif // liblldb_Debug_h_

Modified: lldb/trunk/include/lldb/Host/Editline.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Editline.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Editline.h (original)
+++ lldb/trunk/include/lldb/Host/Editline.h Tue Sep  6 15:57:50 2016
@@ -7,40 +7,51 @@
 //
 //===----------------------------------------------------------------------===//
 
-//TODO: wire up window size changes
+// TODO: wire up window size changes
 
-// If we ever get a private copy of libedit, there are a number of defects that would be nice to fix;
-// a) Sometimes text just disappears while editing.  In an 80-column editor paste the following text, without
+// If we ever get a private copy of libedit, there are a number of defects that
+// would be nice to fix;
+// a) Sometimes text just disappears while editing.  In an 80-column editor
+// paste the following text, without
 //    the quotes:
-//    "This is a test of the input system missing Hello, World!  Do you disappear when it gets to a particular length?"
-//    Now press ^A to move to the start and type 3 characters, and you'll see a good amount of the text will
+//    "This is a test of the input system missing Hello, World!  Do you
+//    disappear when it gets to a particular length?"
+//    Now press ^A to move to the start and type 3 characters, and you'll see a
+//    good amount of the text will
 //    disappear.  It's still in the buffer, just invisible.
-// b) The prompt printing logic for dealing with ANSI formatting characters is broken, which is why we're
+// b) The prompt printing logic for dealing with ANSI formatting characters is
+// broken, which is why we're
 //    working around it here.
-// c) When resizing the terminal window, if the cursor moves between rows libedit will get confused.
-// d) The incremental search uses escape to cancel input, so it's confused by ANSI sequences starting with escape.
-// e) Emoji support is fairly terrible, presumably it doesn't understand composed characters?
+// c) When resizing the terminal window, if the cursor moves between rows
+// libedit will get confused.
+// d) The incremental search uses escape to cancel input, so it's confused by
+// ANSI sequences starting with escape.
+// e) Emoji support is fairly terrible, presumably it doesn't understand
+// composed characters?
 
 #ifndef liblldb_Editline_h_
 #define liblldb_Editline_h_
 #if defined(__cplusplus)
 
+#include <locale>
 #include <sstream>
 #include <vector>
-#include <locale>
 
-// components needed to handle wide characters ( <codecvt>, codecvt_utf8, libedit built with '--enable-widec' )
-// are available on some platforms. The wchar_t versions of libedit functions will only be
-// used in cases where this is true.  This is a compile time dependecy, for now selected per target Platform
-#if defined (__APPLE__) || defined(__NetBSD__)
+// components needed to handle wide characters ( <codecvt>, codecvt_utf8,
+// libedit built with '--enable-widec' )
+// are available on some platforms. The wchar_t versions of libedit functions
+// will only be
+// used in cases where this is true.  This is a compile time dependecy, for now
+// selected per target Platform
+#if defined(__APPLE__) || defined(__NetBSD__)
 #define LLDB_EDITLINE_USE_WCHAR 1
 #include <codecvt>
 #else
 #define LLDB_EDITLINE_USE_WCHAR 0
 #endif
 
-#include "lldb/lldb-private.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
+#include "lldb/lldb-private.h"
 
 #if defined(_WIN32)
 #include "lldb/Host/windows/editlinewin.h"
@@ -59,320 +70,298 @@
 #include "lldb/Host/Predicate.h"
 
 namespace lldb_private {
-    namespace line_editor {
+namespace line_editor {
 
-        // type alias's to help manage 8 bit and wide character versions of libedit
+// type alias's to help manage 8 bit and wide character versions of libedit
 #if LLDB_EDITLINE_USE_WCHAR
-        using EditLineStringType = std::wstring;
-        using EditLineStringStreamType = std::wstringstream;
-        using EditLineCharType = wchar_t;
+using EditLineStringType = std::wstring;
+using EditLineStringStreamType = std::wstringstream;
+using EditLineCharType = wchar_t;
 #else
-        using EditLineStringType=std::string;
-        using EditLineStringStreamType = std::stringstream;
-        using EditLineCharType = char;
+using EditLineStringType = std::string;
+using EditLineStringStreamType = std::stringstream;
+using EditLineCharType = char;
 #endif
 
-        typedef int (* EditlineGetCharCallbackType)(::EditLine * editline, EditLineCharType * c);
-        typedef unsigned char (* EditlineCommandCallbackType)(::EditLine * editline, int ch);
-        typedef const char * (* EditlinePromptCallbackType)(::EditLine * editline);
-
-        class EditlineHistory;
-        
-        typedef std::shared_ptr<EditlineHistory> EditlineHistorySP;
-
-        typedef bool (* IsInputCompleteCallbackType) (
-            Editline * editline,
-            StringList & lines,
-            void * baton);
-        
-        typedef int (* FixIndentationCallbackType) (
-            Editline * editline,
-            const StringList & lines,
-            int cursor_position,
-            void * baton);
-        
-        typedef int (* CompleteCallbackType) (
-            const char * current_line,
-            const char * cursor,
-            const char * last_char,
-            int skip_first_n_matches,
-            int max_matches,
-            StringList & matches,
-            void * baton);
-        
-        /// Status used to decide when and how to start editing another line in multi-line sessions
-        enum class EditorStatus
-        {
-            
-            /// The default state proceeds to edit the current line
-            Editing,
-            
-            /// Editing complete, returns the complete set of edited lines
-            Complete,
-            
-            /// End of input reported
-            EndOfInput,
-
-            /// Editing interrupted
-            Interrupted
-        };
-        
-        /// Established locations that can be easily moved among with MoveCursor
-        enum class CursorLocation
-        {
-            /// The start of the first line in a multi-line edit session
-            BlockStart,
-            
-            /// The start of the current line in a multi-line edit session
-            EditingPrompt,
-            
-            /// The location of the cursor on the current line in a multi-line edit session
-            EditingCursor,
-            
-            /// The location immediately after the last character in a multi-line edit session
-            BlockEnd
-        };
-    }
-    
-    using namespace line_editor;
-    
-    /// Instances of Editline provide an abstraction over libedit's EditLine facility.  Both
-    /// single- and multi-line editing are supported.
-    class Editline
-    {
-    public:
-        Editline (const char * editor_name, FILE * input_file, FILE * output_file, FILE * error_file, bool color_prompts);
-        
-        ~Editline();
-        
-        /// Uses the user data storage of EditLine to retrieve an associated instance of Editline.
-        static Editline *
-        InstanceFor (::EditLine * editline);
-        
-        /// Sets a string to be used as a prompt, or combined with a line number to form a prompt.
-        void
-        SetPrompt (const char * prompt);
-        
-        /// Sets an alternate string to be used as a prompt for the second line and beyond in multi-line
-        /// editing scenarios.
-        void
-        SetContinuationPrompt (const char * continuation_prompt);
-        
-        /// Required to update the width of the terminal registered for I/O.  It is critical that this
-        /// be correct at all times.
-        void
-        TerminalSizeChanged();
-        
-        /// Returns the prompt established by SetPrompt()
-        const char *
-        GetPrompt();
-        
-        /// Returns the index of the line currently being edited
-        uint32_t
-        GetCurrentLine();
-
-        /// Interrupt the current edit as if ^C was pressed
-        bool
-        Interrupt();
-
-        /// Cancel this edit and oblitarate all trace of it
-        bool
-        Cancel();
-        
-        /// Register a callback for the tab key
-        void
-        SetAutoCompleteCallback (CompleteCallbackType callback, void * baton);
-        
-        /// Register a callback for testing whether multi-line input is complete
-        void
-        SetIsInputCompleteCallback (IsInputCompleteCallbackType callback, void * baton);
-        
-        /// Register a callback for determining the appropriate indentation for a line
-        /// when creating a newline.  An optional set of insertable characters can also
-        /// trigger the callback.
-        bool
-        SetFixIndentationCallback (FixIndentationCallbackType callback,
-                                   void * baton,
-                                   const char * indent_chars);
-
-        /// Prompts for and reads a single line of user input.
-        bool
-        GetLine (std::string &line, bool &interrupted);
-        
-        /// Prompts for and reads a multi-line batch of user input.
-        bool
-        GetLines (int first_line_number, StringList &lines, bool &interrupted);
-        
-        void
-        PrintAsync (Stream *stream, const char *s, size_t len);
-
-    private:
-        
-        /// Sets the lowest line number for multi-line editing sessions.  A value of zero suppresses
-        /// line number printing in the prompt.
-        void
-        SetBaseLineNumber (int line_number);
-        
-        /// Returns the complete prompt by combining the prompt or continuation prompt with line numbers
-        /// as appropriate.  The line index is a zero-based index into the current multi-line session.
-        std::string
-        PromptForIndex (int line_index);
-        
-        /// Sets the current line index between line edits to allow free movement between lines.  Updates
-        /// the prompt to match.
-        void
-        SetCurrentLine (int line_index);
-        
-        /// Determines the width of the prompt in characters.  The width is guaranteed to be the same for
-        /// all lines of the current multi-line session.
-        int
-        GetPromptWidth();
-        
-        /// Returns true if the underlying EditLine session's keybindings are Emacs-based, or false if
-        /// they are VI-based.
-        bool
-        IsEmacs();
-        
-        /// Returns true if the current EditLine buffer contains nothing but spaces, or is empty.
-        bool
-        IsOnlySpaces();
-        
-        /// Helper method used by MoveCursor to determine relative line position.
-        int
-        GetLineIndexForLocation (CursorLocation location, int cursor_row);
-        
-        /// Move the cursor from one well-established location to another using relative line positioning
-        /// and absolute column positioning.
-        void
-        MoveCursor (CursorLocation from, CursorLocation to);
-        
-        /// Clear from cursor position to bottom of screen and print input lines including prompts, optionally
-        /// starting from a specific line.  Lines are drawn with an extra space at the end to reserve room for
-        /// the rightmost cursor position.
-        void
-        DisplayInput (int firstIndex = 0);
-        
-        /// Counts the number of rows a given line of content will end up occupying, taking into account both
-        /// the preceding prompt and a single trailing space occupied by a cursor when at the end of the line.
-        int
-        CountRowsForLine (const EditLineStringType & content);
-        
-        /// Save the line currently being edited
-        void
-        SaveEditedLine();
-        
-        /// Convert the current input lines into a UTF8 StringList
-        StringList
-        GetInputAsStringList(int line_count = UINT32_MAX);
-        
-        /// Replaces the current multi-line session with the next entry from history.  When the parameter is
-        /// true it will take the next earlier entry from history, when it is false it takes the next most
-        /// recent.
-        unsigned char
-        RecallHistory (bool earlier);
-        
-        /// Character reading implementation for EditLine that supports our multi-line editing trickery.
-        int
-        GetCharacter (EditLineCharType * c);
-        
-        /// Prompt implementation for EditLine.
-        const char *
-        Prompt();
-
-        /// Line break command used when meta+return is pressed in multi-line mode.
-        unsigned char
-        BreakLineCommand (int ch);
-
-        /// Command used when return is pressed in multi-line mode.
-        unsigned char
-        EndOrAddLineCommand(int ch);
-
-        /// Delete command used when delete is pressed in multi-line mode.
-        unsigned char
-        DeleteNextCharCommand (int ch);
-        
-        /// Delete command used when backspace is pressed in multi-line mode.
-        unsigned char
-        DeletePreviousCharCommand (int ch);
-        
-        /// Line navigation command used when ^P or up arrow are pressed in multi-line mode.
-        unsigned char
-        PreviousLineCommand (int ch);
-        
-        /// Line navigation command used when ^N or down arrow are pressed in multi-line mode.
-        unsigned char
-        NextLineCommand (int ch);
-
-        /// History navigation command used when Alt + up arrow is pressed in multi-line mode.
-        unsigned char
-        PreviousHistoryCommand(int ch);
-
-        /// History navigation command used when Alt + down arrow is pressed in multi-line mode.
-        unsigned char
-        NextHistoryCommand(int ch);
-
-        /// Buffer start command used when Esc < is typed in multi-line emacs mode.
-        unsigned char
-        BufferStartCommand (int ch);
-        
-        /// Buffer end command used when Esc > is typed in multi-line emacs mode.
-        unsigned char
-        BufferEndCommand (int ch);
-
-        /// Context-sensitive tab insertion or code completion command used when the tab key is typed.
-        unsigned char
-        TabCommand (int ch);
-        
-        /// Respond to normal character insertion by fixing line indentation
-        unsigned char
-        FixIndentationCommand (int ch);
-
-        /// Revert line command used when moving between lines.
-        unsigned char
-        RevertLineCommand (int ch);
-
-        /// Ensures that the current EditLine instance is properly configured for single or multi-line editing.
-        void
-        ConfigureEditor (bool multiline);
-        
-    private:
+typedef int (*EditlineGetCharCallbackType)(::EditLine *editline,
+                                           EditLineCharType *c);
+typedef unsigned char (*EditlineCommandCallbackType)(::EditLine *editline,
+                                                     int ch);
+typedef const char *(*EditlinePromptCallbackType)(::EditLine *editline);
+
+class EditlineHistory;
+
+typedef std::shared_ptr<EditlineHistory> EditlineHistorySP;
+
+typedef bool (*IsInputCompleteCallbackType)(Editline *editline,
+                                            StringList &lines, void *baton);
+
+typedef int (*FixIndentationCallbackType)(Editline *editline,
+                                          const StringList &lines,
+                                          int cursor_position, void *baton);
+
+typedef int (*CompleteCallbackType)(const char *current_line,
+                                    const char *cursor, const char *last_char,
+                                    int skip_first_n_matches, int max_matches,
+                                    StringList &matches, void *baton);
+
+/// Status used to decide when and how to start editing another line in
+/// multi-line sessions
+enum class EditorStatus {
+
+  /// The default state proceeds to edit the current line
+  Editing,
+
+  /// Editing complete, returns the complete set of edited lines
+  Complete,
+
+  /// End of input reported
+  EndOfInput,
+
+  /// Editing interrupted
+  Interrupted
+};
+
+/// Established locations that can be easily moved among with MoveCursor
+enum class CursorLocation {
+  /// The start of the first line in a multi-line edit session
+  BlockStart,
+
+  /// The start of the current line in a multi-line edit session
+  EditingPrompt,
+
+  /// The location of the cursor on the current line in a multi-line edit
+  /// session
+  EditingCursor,
+
+  /// The location immediately after the last character in a multi-line edit
+  /// session
+  BlockEnd
+};
+}
+
+using namespace line_editor;
+
+/// Instances of Editline provide an abstraction over libedit's EditLine
+/// facility.  Both
+/// single- and multi-line editing are supported.
+class Editline {
+public:
+  Editline(const char *editor_name, FILE *input_file, FILE *output_file,
+           FILE *error_file, bool color_prompts);
+
+  ~Editline();
+
+  /// Uses the user data storage of EditLine to retrieve an associated instance
+  /// of Editline.
+  static Editline *InstanceFor(::EditLine *editline);
+
+  /// Sets a string to be used as a prompt, or combined with a line number to
+  /// form a prompt.
+  void SetPrompt(const char *prompt);
+
+  /// Sets an alternate string to be used as a prompt for the second line and
+  /// beyond in multi-line
+  /// editing scenarios.
+  void SetContinuationPrompt(const char *continuation_prompt);
+
+  /// Required to update the width of the terminal registered for I/O.  It is
+  /// critical that this
+  /// be correct at all times.
+  void TerminalSizeChanged();
+
+  /// Returns the prompt established by SetPrompt()
+  const char *GetPrompt();
+
+  /// Returns the index of the line currently being edited
+  uint32_t GetCurrentLine();
+
+  /// Interrupt the current edit as if ^C was pressed
+  bool Interrupt();
+
+  /// Cancel this edit and oblitarate all trace of it
+  bool Cancel();
+
+  /// Register a callback for the tab key
+  void SetAutoCompleteCallback(CompleteCallbackType callback, void *baton);
+
+  /// Register a callback for testing whether multi-line input is complete
+  void SetIsInputCompleteCallback(IsInputCompleteCallbackType callback,
+                                  void *baton);
+
+  /// Register a callback for determining the appropriate indentation for a line
+  /// when creating a newline.  An optional set of insertable characters can
+  /// also
+  /// trigger the callback.
+  bool SetFixIndentationCallback(FixIndentationCallbackType callback,
+                                 void *baton, const char *indent_chars);
+
+  /// Prompts for and reads a single line of user input.
+  bool GetLine(std::string &line, bool &interrupted);
+
+  /// Prompts for and reads a multi-line batch of user input.
+  bool GetLines(int first_line_number, StringList &lines, bool &interrupted);
+
+  void PrintAsync(Stream *stream, const char *s, size_t len);
+
+private:
+  /// Sets the lowest line number for multi-line editing sessions.  A value of
+  /// zero suppresses
+  /// line number printing in the prompt.
+  void SetBaseLineNumber(int line_number);
+
+  /// Returns the complete prompt by combining the prompt or continuation prompt
+  /// with line numbers
+  /// as appropriate.  The line index is a zero-based index into the current
+  /// multi-line session.
+  std::string PromptForIndex(int line_index);
+
+  /// Sets the current line index between line edits to allow free movement
+  /// between lines.  Updates
+  /// the prompt to match.
+  void SetCurrentLine(int line_index);
+
+  /// Determines the width of the prompt in characters.  The width is guaranteed
+  /// to be the same for
+  /// all lines of the current multi-line session.
+  int GetPromptWidth();
+
+  /// Returns true if the underlying EditLine session's keybindings are
+  /// Emacs-based, or false if
+  /// they are VI-based.
+  bool IsEmacs();
+
+  /// Returns true if the current EditLine buffer contains nothing but spaces,
+  /// or is empty.
+  bool IsOnlySpaces();
+
+  /// Helper method used by MoveCursor to determine relative line position.
+  int GetLineIndexForLocation(CursorLocation location, int cursor_row);
+
+  /// Move the cursor from one well-established location to another using
+  /// relative line positioning
+  /// and absolute column positioning.
+  void MoveCursor(CursorLocation from, CursorLocation to);
+
+  /// Clear from cursor position to bottom of screen and print input lines
+  /// including prompts, optionally
+  /// starting from a specific line.  Lines are drawn with an extra space at the
+  /// end to reserve room for
+  /// the rightmost cursor position.
+  void DisplayInput(int firstIndex = 0);
+
+  /// Counts the number of rows a given line of content will end up occupying,
+  /// taking into account both
+  /// the preceding prompt and a single trailing space occupied by a cursor when
+  /// at the end of the line.
+  int CountRowsForLine(const EditLineStringType &content);
+
+  /// Save the line currently being edited
+  void SaveEditedLine();
+
+  /// Convert the current input lines into a UTF8 StringList
+  StringList GetInputAsStringList(int line_count = UINT32_MAX);
+
+  /// Replaces the current multi-line session with the next entry from history.
+  /// When the parameter is
+  /// true it will take the next earlier entry from history, when it is false it
+  /// takes the next most
+  /// recent.
+  unsigned char RecallHistory(bool earlier);
+
+  /// Character reading implementation for EditLine that supports our multi-line
+  /// editing trickery.
+  int GetCharacter(EditLineCharType *c);
+
+  /// Prompt implementation for EditLine.
+  const char *Prompt();
+
+  /// Line break command used when meta+return is pressed in multi-line mode.
+  unsigned char BreakLineCommand(int ch);
+
+  /// Command used when return is pressed in multi-line mode.
+  unsigned char EndOrAddLineCommand(int ch);
+
+  /// Delete command used when delete is pressed in multi-line mode.
+  unsigned char DeleteNextCharCommand(int ch);
+
+  /// Delete command used when backspace is pressed in multi-line mode.
+  unsigned char DeletePreviousCharCommand(int ch);
+
+  /// Line navigation command used when ^P or up arrow are pressed in multi-line
+  /// mode.
+  unsigned char PreviousLineCommand(int ch);
+
+  /// Line navigation command used when ^N or down arrow are pressed in
+  /// multi-line mode.
+  unsigned char NextLineCommand(int ch);
+
+  /// History navigation command used when Alt + up arrow is pressed in
+  /// multi-line mode.
+  unsigned char PreviousHistoryCommand(int ch);
+
+  /// History navigation command used when Alt + down arrow is pressed in
+  /// multi-line mode.
+  unsigned char NextHistoryCommand(int ch);
+
+  /// Buffer start command used when Esc < is typed in multi-line emacs mode.
+  unsigned char BufferStartCommand(int ch);
+
+  /// Buffer end command used when Esc > is typed in multi-line emacs mode.
+  unsigned char BufferEndCommand(int ch);
+
+  /// Context-sensitive tab insertion or code completion command used when the
+  /// tab key is typed.
+  unsigned char TabCommand(int ch);
+
+  /// Respond to normal character insertion by fixing line indentation
+  unsigned char FixIndentationCommand(int ch);
+
+  /// Revert line command used when moving between lines.
+  unsigned char RevertLineCommand(int ch);
+
+  /// Ensures that the current EditLine instance is properly configured for
+  /// single or multi-line editing.
+  void ConfigureEditor(bool multiline);
+
+private:
 #if LLDB_EDITLINE_USE_WCHAR
-        std::wstring_convert<std::codecvt_utf8<wchar_t>> m_utf8conv;
+  std::wstring_convert<std::codecvt_utf8<wchar_t>> m_utf8conv;
 #endif
-        ::EditLine * m_editline = nullptr;
-        EditlineHistorySP m_history_sp;
-        bool m_in_history = false;
-        std::vector<EditLineStringType> m_live_history_lines;
-        bool m_multiline_enabled = false;
-        std::vector<EditLineStringType> m_input_lines;
-        EditorStatus m_editor_status;
-        bool m_color_prompts = true;
-        int m_terminal_width = 0;
-        int m_base_line_number = 0;
-        unsigned m_current_line_index = 0;
-        int m_current_line_rows = -1;
-        int m_revert_cursor_index = 0;
-        int m_line_number_digits = 3;
-        std::string m_set_prompt;
-        std::string m_set_continuation_prompt;
-        std::string m_current_prompt;
-        bool m_needs_prompt_repaint = false;
-        std::string m_editor_name;
-        FILE * m_input_file;
-        FILE * m_output_file;
-        FILE * m_error_file;
-        ConnectionFileDescriptor m_input_connection;
-        IsInputCompleteCallbackType m_is_input_complete_callback = nullptr;
-        void * m_is_input_complete_callback_baton = nullptr;
-        FixIndentationCallbackType m_fix_indentation_callback = nullptr;
-        void * m_fix_indentation_callback_baton = nullptr;
-        const char * m_fix_indentation_callback_chars = nullptr;
-        CompleteCallbackType m_completion_callback = nullptr;
-        void * m_completion_callback_baton = nullptr;
+  ::EditLine *m_editline = nullptr;
+  EditlineHistorySP m_history_sp;
+  bool m_in_history = false;
+  std::vector<EditLineStringType> m_live_history_lines;
+  bool m_multiline_enabled = false;
+  std::vector<EditLineStringType> m_input_lines;
+  EditorStatus m_editor_status;
+  bool m_color_prompts = true;
+  int m_terminal_width = 0;
+  int m_base_line_number = 0;
+  unsigned m_current_line_index = 0;
+  int m_current_line_rows = -1;
+  int m_revert_cursor_index = 0;
+  int m_line_number_digits = 3;
+  std::string m_set_prompt;
+  std::string m_set_continuation_prompt;
+  std::string m_current_prompt;
+  bool m_needs_prompt_repaint = false;
+  std::string m_editor_name;
+  FILE *m_input_file;
+  FILE *m_output_file;
+  FILE *m_error_file;
+  ConnectionFileDescriptor m_input_connection;
+  IsInputCompleteCallbackType m_is_input_complete_callback = nullptr;
+  void *m_is_input_complete_callback_baton = nullptr;
+  FixIndentationCallbackType m_fix_indentation_callback = nullptr;
+  void *m_fix_indentation_callback_baton = nullptr;
+  const char *m_fix_indentation_callback_chars = nullptr;
+  CompleteCallbackType m_completion_callback = nullptr;
+  void *m_completion_callback_baton = nullptr;
 
-        std::mutex m_output_mutex;
-    };
+  std::mutex m_output_mutex;
+};
 }
 
-#endif  // #if defined(__cplusplus)
-#endif  // liblldb_Editline_h_
+#endif // #if defined(__cplusplus)
+#endif // liblldb_Editline_h_

Modified: lldb/trunk/include/lldb/Host/Endian.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Endian.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Endian.h (original)
+++ lldb/trunk/include/lldb/Host/Endian.h Tue Sep  6 15:57:50 2016
@@ -16,18 +16,17 @@ namespace lldb_private {
 
 namespace endian {
 
-    static union EndianTest
-    {
-        uint32_t num;
-        uint8_t  bytes[sizeof(uint32_t)];
-    } const endianTest = { 0x01020304 };
-    
-    inline lldb::ByteOrder InlHostByteOrder() { return (lldb::ByteOrder)endianTest.bytes[0]; }
+static union EndianTest {
+  uint32_t num;
+  uint8_t bytes[sizeof(uint32_t)];
+} const endianTest = {0x01020304};
 
-//    ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0];
+inline lldb::ByteOrder InlHostByteOrder() {
+  return (lldb::ByteOrder)endianTest.bytes[0];
 }
 
+//    ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0];
+}
 }
 
-#endif  // liblldb_host_endian_h_
-
+#endif // liblldb_host_endian_h_

Modified: lldb/trunk/include/lldb/Host/File.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/File.h (original)
+++ lldb/trunk/include/lldb/Host/File.h Tue Sep  6 15:57:50 2016
@@ -18,9 +18,9 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Host/IOObject.h"
 #include "lldb/Host/PosixApi.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
 
@@ -31,528 +31,460 @@ namespace lldb_private {
 /// A file class that divides abstracts the LLDB core from host file
 /// functionality.
 //----------------------------------------------------------------------
-class File : public IOObject
-{
+class File : public IOObject {
 public:
-    static int kInvalidDescriptor;
-    static FILE * kInvalidStream;
+  static int kInvalidDescriptor;
+  static FILE *kInvalidStream;
+
+  enum OpenOptions {
+    eOpenOptionRead = (1u << 0),  // Open file for reading
+    eOpenOptionWrite = (1u << 1), // Open file for writing
+    eOpenOptionAppend =
+        (1u << 2), // Don't truncate file when opening, append to end of file
+    eOpenOptionTruncate = (1u << 3),    // Truncate file when opening
+    eOpenOptionNonBlocking = (1u << 4), // File reads
+    eOpenOptionCanCreate = (1u << 5),   // Create file if doesn't already exist
+    eOpenOptionCanCreateNewOnly =
+        (1u << 6), // Can create file only if it doesn't already exist
+    eOpenOptionDontFollowSymlinks = (1u << 7),
+    eOpenOptionCloseOnExec =
+        (1u << 8) // Close the file when executing a new process
+  };
+
+  static mode_t ConvertOpenOptionsForPOSIXOpen(uint32_t open_options);
+
+  File()
+      : IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
+        m_stream(kInvalidStream), m_options(0), m_own_stream(false),
+        m_is_interactive(eLazyBoolCalculate),
+        m_is_real_terminal(eLazyBoolCalculate) {}
+
+  File(FILE *fh, bool transfer_ownership)
+      : IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
+        m_stream(fh), m_options(0), m_own_stream(transfer_ownership),
+        m_is_interactive(eLazyBoolCalculate),
+        m_is_real_terminal(eLazyBoolCalculate) {}
+
+  //------------------------------------------------------------------
+  /// Constructor with path.
+  ///
+  /// Takes a path to a file which can be just a filename, or a full
+  /// path. If \a path is not nullptr or empty, this function will call
+  /// File::Open (const char *path, uint32_t options, uint32_t permissions).
+  ///
+  /// @param[in] path
+  ///     The full or partial path to a file.
+  ///
+  /// @param[in] options
+  ///     Options to use when opening (see File::OpenOptions)
+  ///
+  /// @param[in] permissions
+  ///     Options to use when opening (see File::Permissions)
+  ///
+  /// @see File::Open (const char *path, uint32_t options, uint32_t permissions)
+  //------------------------------------------------------------------
+  File(const char *path, uint32_t options,
+       uint32_t permissions = lldb::eFilePermissionsFileDefault);
+
+  //------------------------------------------------------------------
+  /// Constructor with FileSpec.
+  ///
+  /// Takes a FileSpec pointing to a file which can be just a filename, or a
+  /// full
+  /// path. If \a path is not nullptr or empty, this function will call
+  /// File::Open (const char *path, uint32_t options, uint32_t permissions).
+  ///
+  /// @param[in] filespec
+  ///     The FileSpec for this file.
+  ///
+  /// @param[in] options
+  ///     Options to use when opening (see File::OpenOptions)
+  ///
+  /// @param[in] permissions
+  ///     Options to use when opening (see File::Permissions)
+  ///
+  /// @see File::Open (const char *path, uint32_t options, uint32_t permissions)
+  //------------------------------------------------------------------
+  File(const FileSpec &filespec, uint32_t options,
+       uint32_t permissions = lldb::eFilePermissionsFileDefault);
+
+  File(int fd, bool transfer_ownership)
+      : IOObject(eFDTypeFile, transfer_ownership), m_descriptor(fd),
+        m_stream(kInvalidStream), m_options(0), m_own_stream(false),
+        m_is_interactive(eLazyBoolCalculate),
+        m_is_real_terminal(eLazyBoolCalculate) {}
+
+  //------------------------------------------------------------------
+  /// Destructor.
+  ///
+  /// The destructor is virtual in case this class is subclassed.
+  //------------------------------------------------------------------
+  ~File() override;
+
+  bool IsValid() const override {
+    return DescriptorIsValid() || StreamIsValid();
+  }
+
+  //------------------------------------------------------------------
+  /// Convert to pointer operator.
+  ///
+  /// This allows code to check a File object to see if it
+  /// contains anything valid using code such as:
+  ///
+  /// @code
+  /// File file(...);
+  /// if (file)
+  /// { ...
+  /// @endcode
+  ///
+  /// @return
+  ///     A pointer to this object if either the directory or filename
+  ///     is valid, nullptr otherwise.
+  //------------------------------------------------------------------
+  operator bool() const { return DescriptorIsValid() || StreamIsValid(); }
+
+  //------------------------------------------------------------------
+  /// Logical NOT operator.
+  ///
+  /// This allows code to check a File object to see if it is
+  /// invalid using code such as:
+  ///
+  /// @code
+  /// File file(...);
+  /// if (!file)
+  /// { ...
+  /// @endcode
+  ///
+  /// @return
+  ///     Returns \b true if the object has an empty directory and
+  ///     filename, \b false otherwise.
+  //------------------------------------------------------------------
+  bool operator!() const { return !DescriptorIsValid() && !StreamIsValid(); }
+
+  //------------------------------------------------------------------
+  /// Get the file spec for this file.
+  ///
+  /// @return
+  ///     A reference to the file specification object.
+  //------------------------------------------------------------------
+  Error GetFileSpec(FileSpec &file_spec) const;
+
+  //------------------------------------------------------------------
+  /// Open a file for read/writing with the specified options.
+  ///
+  /// Takes a path to a file which can be just a filename, or a full
+  /// path.
+  ///
+  /// @param[in] path
+  ///     The full or partial path to a file.
+  ///
+  /// @param[in] options
+  ///     Options to use when opening (see File::OpenOptions)
+  ///
+  /// @param[in] permissions
+  ///     Options to use when opening (see File::Permissions)
+  //------------------------------------------------------------------
+  Error Open(const char *path, uint32_t options,
+             uint32_t permissions = lldb::eFilePermissionsFileDefault);
+
+  Error Close() override;
+
+  void Clear();
+
+  int GetDescriptor() const;
+
+  WaitableHandle GetWaitableHandle() override;
+
+  void SetDescriptor(int fd, bool transfer_ownership);
+
+  FILE *GetStream();
+
+  void SetStream(FILE *fh, bool transfer_ownership);
+
+  //------------------------------------------------------------------
+  /// Read bytes from a file from the current file position.
+  ///
+  /// NOTE: This function is NOT thread safe. Use the read function
+  /// that takes an "off_t &offset" to ensure correct operation in
+  /// multi-threaded environments.
+  ///
+  /// @param[in] buf
+  ///     A buffer where to put the bytes that are read.
+  ///
+  /// @param[in,out] num_bytes
+  ///     The number of bytes to read form the current file position
+  ///     which gets modified with the number of bytes that were read.
+  ///
+  /// @return
+  ///     An error object that indicates success or the reason for
+  ///     failure.
+  //------------------------------------------------------------------
+  Error Read(void *buf, size_t &num_bytes) override;
+
+  //------------------------------------------------------------------
+  /// Write bytes to a file at the current file position.
+  ///
+  /// NOTE: This function is NOT thread safe. Use the write function
+  /// that takes an "off_t &offset" to ensure correct operation in
+  /// multi-threaded environments.
+  ///
+  /// @param[in] buf
+  ///     A buffer where to put the bytes that are read.
+  ///
+  /// @param[in,out] num_bytes
+  ///     The number of bytes to write to the current file position
+  ///     which gets modified with the number of bytes that were
+  ///     written.
+  ///
+  /// @return
+  ///     An error object that indicates success or the reason for
+  ///     failure.
+  //------------------------------------------------------------------
+  Error Write(const void *buf, size_t &num_bytes) override;
+
+  //------------------------------------------------------------------
+  /// Seek to an offset relative to the beginning of the file.
+  ///
+  /// NOTE: This function is NOT thread safe, other threads that
+  /// access this object might also change the current file position.
+  /// For thread safe reads and writes see the following functions:
+  /// @see File::Read (void *, size_t, off_t &)
+  /// @see File::Write (const void *, size_t, off_t &)
+  ///
+  /// @param[in] offset
+  ///     The offset to seek to within the file relative to the
+  ///     beginning of the file.
+  ///
+  /// @param[in] error_ptr
+  ///     A pointer to a lldb_private::Error object that will be
+  ///     filled in if non-nullptr.
+  ///
+  /// @return
+  ///     The resulting seek offset, or -1 on error.
+  //------------------------------------------------------------------
+  off_t SeekFromStart(off_t offset, Error *error_ptr = nullptr);
+
+  //------------------------------------------------------------------
+  /// Seek to an offset relative to the current file position.
+  ///
+  /// NOTE: This function is NOT thread safe, other threads that
+  /// access this object might also change the current file position.
+  /// For thread safe reads and writes see the following functions:
+  /// @see File::Read (void *, size_t, off_t &)
+  /// @see File::Write (const void *, size_t, off_t &)
+  ///
+  /// @param[in] offset
+  ///     The offset to seek to within the file relative to the
+  ///     current file position.
+  ///
+  /// @param[in] error_ptr
+  ///     A pointer to a lldb_private::Error object that will be
+  ///     filled in if non-nullptr.
+  ///
+  /// @return
+  ///     The resulting seek offset, or -1 on error.
+  //------------------------------------------------------------------
+  off_t SeekFromCurrent(off_t offset, Error *error_ptr = nullptr);
+
+  //------------------------------------------------------------------
+  /// Seek to an offset relative to the end of the file.
+  ///
+  /// NOTE: This function is NOT thread safe, other threads that
+  /// access this object might also change the current file position.
+  /// For thread safe reads and writes see the following functions:
+  /// @see File::Read (void *, size_t, off_t &)
+  /// @see File::Write (const void *, size_t, off_t &)
+  ///
+  /// @param[in,out] offset
+  ///     The offset to seek to within the file relative to the
+  ///     end of the file which gets filled in with the resulting
+  ///     absolute file offset.
+  ///
+  /// @param[in] error_ptr
+  ///     A pointer to a lldb_private::Error object that will be
+  ///     filled in if non-nullptr.
+  ///
+  /// @return
+  ///     The resulting seek offset, or -1 on error.
+  //------------------------------------------------------------------
+  off_t SeekFromEnd(off_t offset, Error *error_ptr = nullptr);
+
+  //------------------------------------------------------------------
+  /// Read bytes from a file from the specified file offset.
+  ///
+  /// NOTE: This function is thread safe in that clients manager their
+  /// own file position markers and reads on other threads won't mess
+  /// up the current read.
+  ///
+  /// @param[in] dst
+  ///     A buffer where to put the bytes that are read.
+  ///
+  /// @param[in,out] num_bytes
+  ///     The number of bytes to read form the current file position
+  ///     which gets modified with the number of bytes that were read.
+  ///
+  /// @param[in,out] offset
+  ///     The offset within the file from which to read \a num_bytes
+  ///     bytes. This offset gets incremented by the number of bytes
+  ///     that were read.
+  ///
+  /// @return
+  ///     An error object that indicates success or the reason for
+  ///     failure.
+  //------------------------------------------------------------------
+  Error Read(void *dst, size_t &num_bytes, off_t &offset);
+
+  //------------------------------------------------------------------
+  /// Read bytes from a file from the specified file offset.
+  ///
+  /// NOTE: This function is thread safe in that clients manager their
+  /// own file position markers and reads on other threads won't mess
+  /// up the current read.
+  ///
+  /// @param[in,out] num_bytes
+  ///     The number of bytes to read form the current file position
+  ///     which gets modified with the number of bytes that were read.
+  ///
+  /// @param[in,out] offset
+  ///     The offset within the file from which to read \a num_bytes
+  ///     bytes. This offset gets incremented by the number of bytes
+  ///     that were read.
+  ///
+  /// @param[in] null_terminate
+  ///     Ensure that the data that is read is terminated with a NULL
+  ///     character so that the data can be used as a C string.
+  ///
+  /// @param[out] data_buffer_sp
+  ///     A data buffer to create and fill in that will contain any
+  ///     data that is read from the file. This buffer will be reset
+  ///     if an error occurs.
+  ///
+  /// @return
+  ///     An error object that indicates success or the reason for
+  ///     failure.
+  //------------------------------------------------------------------
+  Error Read(size_t &num_bytes, off_t &offset, bool null_terminate,
+             lldb::DataBufferSP &data_buffer_sp);
+
+  //------------------------------------------------------------------
+  /// Write bytes to a file at the specified file offset.
+  ///
+  /// NOTE: This function is thread safe in that clients manager their
+  /// own file position markers, though clients will need to implement
+  /// their own locking externally to avoid multiple people writing
+  /// to the file at the same time.
+  ///
+  /// @param[in] src
+  ///     A buffer containing the bytes to write.
+  ///
+  /// @param[in,out] num_bytes
+  ///     The number of bytes to write to the file at offset \a offset.
+  ///     \a num_bytes gets modified with the number of bytes that
+  ///     were read.
+  ///
+  /// @param[in,out] offset
+  ///     The offset within the file at which to write \a num_bytes
+  ///     bytes. This offset gets incremented by the number of bytes
+  ///     that were written.
+  ///
+  /// @return
+  ///     An error object that indicates success or the reason for
+  ///     failure.
+  //------------------------------------------------------------------
+  Error Write(const void *src, size_t &num_bytes, off_t &offset);
+
+  //------------------------------------------------------------------
+  /// Flush the current stream
+  ///
+  /// @return
+  ///     An error object that indicates success or the reason for
+  ///     failure.
+  //------------------------------------------------------------------
+  Error Flush();
+
+  //------------------------------------------------------------------
+  /// Sync to disk.
+  ///
+  /// @return
+  ///     An error object that indicates success or the reason for
+  ///     failure.
+  //------------------------------------------------------------------
+  Error Sync();
+
+  //------------------------------------------------------------------
+  /// Get the permissions for a this file.
+  ///
+  /// @return
+  ///     Bits logical OR'ed together from the permission bits defined
+  ///     in lldb_private::File::Permissions.
+  //------------------------------------------------------------------
+  uint32_t GetPermissions(Error &error) const;
+
+  static uint32_t GetPermissions(const FileSpec &file_spec, Error &error);
+
+  //------------------------------------------------------------------
+  /// Return true if this file is interactive.
+  ///
+  /// @return
+  ///     True if this file is a terminal (tty or pty), false
+  ///     otherwise.
+  //------------------------------------------------------------------
+  bool GetIsInteractive();
+
+  //------------------------------------------------------------------
+  /// Return true if this file from a real terminal.
+  ///
+  /// Just knowing a file is a interactive isn't enough, we also need
+  /// to know if the terminal has a width and height so we can do
+  /// cursor movement and other terminal manipulations by sending
+  /// escape sequences.
+  ///
+  /// @return
+  ///     True if this file is a terminal (tty, not a pty) that has
+  ///     a non-zero width and height, false otherwise.
+  //------------------------------------------------------------------
+  bool GetIsRealTerminal();
+
+  bool GetIsTerminalWithColors();
+
+  //------------------------------------------------------------------
+  /// Output printf formatted output to the stream.
+  ///
+  /// Print some formatted output to the stream.
+  ///
+  /// @param[in] format
+  ///     A printf style format string.
+  ///
+  /// @param[in] ...
+  ///     Variable arguments that are needed for the printf style
+  ///     format string \a format.
+  //------------------------------------------------------------------
+  size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
+
+  size_t PrintfVarArg(const char *format, va_list args);
 
-    enum OpenOptions
-    {
-        eOpenOptionRead                 = (1u << 0),    // Open file for reading
-        eOpenOptionWrite                = (1u << 1),    // Open file for writing
-        eOpenOptionAppend               = (1u << 2),    // Don't truncate file when opening, append to end of file
-        eOpenOptionTruncate             = (1u << 3),    // Truncate file when opening
-        eOpenOptionNonBlocking          = (1u << 4),    // File reads
-        eOpenOptionCanCreate            = (1u << 5),    // Create file if doesn't already exist
-        eOpenOptionCanCreateNewOnly     = (1u << 6),    // Can create file only if it doesn't already exist
-        eOpenOptionDontFollowSymlinks   = (1u << 7),
-        eOpenOptionCloseOnExec          = (1u << 8)     // Close the file when executing a new process
-    };
-    
-    static mode_t
-    ConvertOpenOptionsForPOSIXOpen (uint32_t open_options);
-    
-    File() : 
-        IOObject(eFDTypeFile, false),
-        m_descriptor (kInvalidDescriptor),
-        m_stream (kInvalidStream),
-        m_options (0),
-        m_own_stream (false),
-        m_is_interactive (eLazyBoolCalculate),
-        m_is_real_terminal (eLazyBoolCalculate)
-    {
-    }
-    
-    File (FILE *fh, bool transfer_ownership) :
-        IOObject(eFDTypeFile, false),
-        m_descriptor (kInvalidDescriptor),
-        m_stream (fh),
-        m_options (0),
-        m_own_stream (transfer_ownership),
-        m_is_interactive (eLazyBoolCalculate),
-        m_is_real_terminal (eLazyBoolCalculate)
-    {
-    }
-
-    //------------------------------------------------------------------
-    /// Constructor with path.
-    ///
-    /// Takes a path to a file which can be just a filename, or a full
-    /// path. If \a path is not nullptr or empty, this function will call
-    /// File::Open (const char *path, uint32_t options, uint32_t permissions).
-    ///
-    /// @param[in] path
-    ///     The full or partial path to a file.
-    ///
-    /// @param[in] options
-    ///     Options to use when opening (see File::OpenOptions)
-    ///
-    /// @param[in] permissions
-    ///     Options to use when opening (see File::Permissions)
-    ///
-    /// @see File::Open (const char *path, uint32_t options, uint32_t permissions)
-    //------------------------------------------------------------------
-    File (const char *path,
-          uint32_t options,
-          uint32_t permissions = lldb::eFilePermissionsFileDefault);
-
-    //------------------------------------------------------------------
-    /// Constructor with FileSpec.
-    ///
-    /// Takes a FileSpec pointing to a file which can be just a filename, or a full
-    /// path. If \a path is not nullptr or empty, this function will call
-    /// File::Open (const char *path, uint32_t options, uint32_t permissions).
-    ///
-    /// @param[in] filespec
-    ///     The FileSpec for this file.
-    ///
-    /// @param[in] options
-    ///     Options to use when opening (see File::OpenOptions)
-    ///
-    /// @param[in] permissions
-    ///     Options to use when opening (see File::Permissions)
-    ///
-    /// @see File::Open (const char *path, uint32_t options, uint32_t permissions)
-    //------------------------------------------------------------------
-    File (const FileSpec& filespec,
-          uint32_t options,
-          uint32_t permissions = lldb::eFilePermissionsFileDefault);
-    
-    File (int fd, bool transfer_ownership) :
-        IOObject(eFDTypeFile, transfer_ownership),
-        m_descriptor (fd),
-        m_stream (kInvalidStream),
-        m_options (0),
-        m_own_stream (false),
-        m_is_interactive (eLazyBoolCalculate),
-        m_is_real_terminal (eLazyBoolCalculate)
-    {
-    }
-
-    //------------------------------------------------------------------
-    /// Destructor.
-    ///
-    /// The destructor is virtual in case this class is subclassed.
-    //------------------------------------------------------------------
-    ~File() override;
-
-    bool
-    IsValid() const override
-    {
-        return DescriptorIsValid() || StreamIsValid();
-    }
-
-    //------------------------------------------------------------------
-    /// Convert to pointer operator.
-    ///
-    /// This allows code to check a File object to see if it
-    /// contains anything valid using code such as:
-    ///
-    /// @code
-    /// File file(...);
-    /// if (file)
-    /// { ...
-    /// @endcode
-    ///
-    /// @return
-    ///     A pointer to this object if either the directory or filename
-    ///     is valid, nullptr otherwise.
-    //------------------------------------------------------------------
-    operator
-    bool () const
-    {
-        return DescriptorIsValid() || StreamIsValid();
-    }
-
-    //------------------------------------------------------------------
-    /// Logical NOT operator.
-    ///
-    /// This allows code to check a File object to see if it is
-    /// invalid using code such as:
-    ///
-    /// @code
-    /// File file(...);
-    /// if (!file)
-    /// { ...
-    /// @endcode
-    ///
-    /// @return
-    ///     Returns \b true if the object has an empty directory and
-    ///     filename, \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    operator! () const
-    {
-        return !DescriptorIsValid() && !StreamIsValid();
-    }
-
-    //------------------------------------------------------------------
-    /// Get the file spec for this file.
-    ///
-    /// @return
-    ///     A reference to the file specification object.
-    //------------------------------------------------------------------
-    Error
-    GetFileSpec (FileSpec &file_spec) const;
-    
-    //------------------------------------------------------------------
-    /// Open a file for read/writing with the specified options.
-    ///
-    /// Takes a path to a file which can be just a filename, or a full
-    /// path.
-    ///
-    /// @param[in] path
-    ///     The full or partial path to a file.
-    ///
-    /// @param[in] options
-    ///     Options to use when opening (see File::OpenOptions)
-    ///
-    /// @param[in] permissions
-    ///     Options to use when opening (see File::Permissions)
-    //------------------------------------------------------------------
-    Error
-    Open (const char *path,
-          uint32_t options,
-          uint32_t permissions = lldb::eFilePermissionsFileDefault);
-
-    Error
-    Close() override;
-    
-    void
-    Clear ();
-    
-    int
-    GetDescriptor() const;
-
-    WaitableHandle
-    GetWaitableHandle() override;
-
-    void
-    SetDescriptor(int fd, bool transfer_ownership);
-
-    FILE *
-    GetStream ();
-
-    void
-    SetStream (FILE *fh, bool transfer_ownership);
-
-    //------------------------------------------------------------------
-    /// Read bytes from a file from the current file position.
-    ///
-    /// NOTE: This function is NOT thread safe. Use the read function
-    /// that takes an "off_t &offset" to ensure correct operation in
-    /// multi-threaded environments.
-    ///
-    /// @param[in] buf
-    ///     A buffer where to put the bytes that are read.
-    ///
-    /// @param[in,out] num_bytes
-    ///     The number of bytes to read form the current file position
-    ///     which gets modified with the number of bytes that were read.
-    ///
-    /// @return
-    ///     An error object that indicates success or the reason for 
-    ///     failure.
-    //------------------------------------------------------------------
-    Error
-    Read(void *buf, size_t &num_bytes) override;
-          
-    //------------------------------------------------------------------
-    /// Write bytes to a file at the current file position.
-    ///
-    /// NOTE: This function is NOT thread safe. Use the write function
-    /// that takes an "off_t &offset" to ensure correct operation in
-    /// multi-threaded environments.
-    ///
-    /// @param[in] buf
-    ///     A buffer where to put the bytes that are read.
-    ///
-    /// @param[in,out] num_bytes
-    ///     The number of bytes to write to the current file position
-    ///     which gets modified with the number of bytes that were 
-    ///     written.
-    ///
-    /// @return
-    ///     An error object that indicates success or the reason for 
-    ///     failure.
-    //------------------------------------------------------------------
-    Error
-    Write(const void *buf, size_t &num_bytes) override;
-
-    //------------------------------------------------------------------
-    /// Seek to an offset relative to the beginning of the file.
-    ///
-    /// NOTE: This function is NOT thread safe, other threads that 
-    /// access this object might also change the current file position.
-    /// For thread safe reads and writes see the following functions:
-    /// @see File::Read (void *, size_t, off_t &)
-    /// @see File::Write (const void *, size_t, off_t &)
-    ///
-    /// @param[in] offset
-    ///     The offset to seek to within the file relative to the 
-    ///     beginning of the file.
-    ///
-    /// @param[in] error_ptr
-    ///     A pointer to a lldb_private::Error object that will be
-    ///     filled in if non-nullptr.
-    ///
-    /// @return
-    ///     The resulting seek offset, or -1 on error.
-    //------------------------------------------------------------------
-    off_t
-    SeekFromStart(off_t offset, Error *error_ptr = nullptr);
-    
-    //------------------------------------------------------------------
-    /// Seek to an offset relative to the current file position.
-    ///
-    /// NOTE: This function is NOT thread safe, other threads that 
-    /// access this object might also change the current file position.
-    /// For thread safe reads and writes see the following functions:
-    /// @see File::Read (void *, size_t, off_t &)
-    /// @see File::Write (const void *, size_t, off_t &)
-    ///
-    /// @param[in] offset
-    ///     The offset to seek to within the file relative to the 
-    ///     current file position.
-    ///
-    /// @param[in] error_ptr
-    ///     A pointer to a lldb_private::Error object that will be
-    ///     filled in if non-nullptr.
-    ///
-    /// @return
-    ///     The resulting seek offset, or -1 on error.
-    //------------------------------------------------------------------
-    off_t
-    SeekFromCurrent(off_t offset, Error *error_ptr = nullptr);
-    
-    //------------------------------------------------------------------
-    /// Seek to an offset relative to the end of the file.
-    ///
-    /// NOTE: This function is NOT thread safe, other threads that 
-    /// access this object might also change the current file position.
-    /// For thread safe reads and writes see the following functions:
-    /// @see File::Read (void *, size_t, off_t &)
-    /// @see File::Write (const void *, size_t, off_t &)
-    ///
-    /// @param[in,out] offset
-    ///     The offset to seek to within the file relative to the 
-    ///     end of the file which gets filled in with the resulting
-    ///     absolute file offset.
-    ///
-    /// @param[in] error_ptr
-    ///     A pointer to a lldb_private::Error object that will be
-    ///     filled in if non-nullptr.
-    ///
-    /// @return
-    ///     The resulting seek offset, or -1 on error.
-    //------------------------------------------------------------------
-    off_t
-    SeekFromEnd(off_t offset, Error *error_ptr = nullptr);
-
-    //------------------------------------------------------------------
-    /// Read bytes from a file from the specified file offset.
-    ///
-    /// NOTE: This function is thread safe in that clients manager their
-    /// own file position markers and reads on other threads won't mess
-    /// up the current read.
-    ///
-    /// @param[in] dst
-    ///     A buffer where to put the bytes that are read.
-    ///
-    /// @param[in,out] num_bytes
-    ///     The number of bytes to read form the current file position
-    ///     which gets modified with the number of bytes that were read.
-    ///
-    /// @param[in,out] offset
-    ///     The offset within the file from which to read \a num_bytes
-    ///     bytes. This offset gets incremented by the number of bytes
-    ///     that were read.
-    ///
-    /// @return
-    ///     An error object that indicates success or the reason for 
-    ///     failure.
-    //------------------------------------------------------------------
-    Error
-    Read (void *dst, size_t &num_bytes, off_t &offset);
-    
-    //------------------------------------------------------------------
-    /// Read bytes from a file from the specified file offset.
-    ///
-    /// NOTE: This function is thread safe in that clients manager their
-    /// own file position markers and reads on other threads won't mess
-    /// up the current read.
-    ///
-    /// @param[in,out] num_bytes
-    ///     The number of bytes to read form the current file position
-    ///     which gets modified with the number of bytes that were read.
-    ///
-    /// @param[in,out] offset
-    ///     The offset within the file from which to read \a num_bytes
-    ///     bytes. This offset gets incremented by the number of bytes
-    ///     that were read.
-    ///
-    /// @param[in] null_terminate
-    ///     Ensure that the data that is read is terminated with a NULL
-    ///     character so that the data can be used as a C string.
-    ///
-    /// @param[out] data_buffer_sp
-    ///     A data buffer to create and fill in that will contain any
-    ///     data that is read from the file. This buffer will be reset
-    ///     if an error occurs.
-    ///
-    /// @return
-    ///     An error object that indicates success or the reason for 
-    ///     failure.
-    //------------------------------------------------------------------
-    Error
-    Read (size_t &num_bytes,
-          off_t &offset,
-          bool null_terminate,
-          lldb::DataBufferSP &data_buffer_sp);
-
-    //------------------------------------------------------------------
-    /// Write bytes to a file at the specified file offset.
-    ///
-    /// NOTE: This function is thread safe in that clients manager their
-    /// own file position markers, though clients will need to implement
-    /// their own locking externally to avoid multiple people writing
-    /// to the file at the same time.
-    ///
-    /// @param[in] src
-    ///     A buffer containing the bytes to write.
-    ///
-    /// @param[in,out] num_bytes
-    ///     The number of bytes to write to the file at offset \a offset.
-    ///     \a num_bytes gets modified with the number of bytes that 
-    ///     were read.
-    ///
-    /// @param[in,out] offset
-    ///     The offset within the file at which to write \a num_bytes
-    ///     bytes. This offset gets incremented by the number of bytes
-    ///     that were written.
-    ///
-    /// @return
-    ///     An error object that indicates success or the reason for 
-    ///     failure.
-    //------------------------------------------------------------------
-    Error
-    Write (const void *src, size_t &num_bytes, off_t &offset);
-
-    //------------------------------------------------------------------
-    /// Flush the current stream
-    ///
-    /// @return
-    ///     An error object that indicates success or the reason for 
-    ///     failure.
-    //------------------------------------------------------------------
-    Error
-    Flush ();
-    
-    //------------------------------------------------------------------
-    /// Sync to disk.
-    ///
-    /// @return
-    ///     An error object that indicates success or the reason for 
-    ///     failure.
-    //------------------------------------------------------------------
-    Error
-    Sync ();
-    
-    //------------------------------------------------------------------
-    /// Get the permissions for a this file.
-    ///
-    /// @return
-    ///     Bits logical OR'ed together from the permission bits defined
-    ///     in lldb_private::File::Permissions.
-    //------------------------------------------------------------------
-    uint32_t
-    GetPermissions(Error &error) const;
-    
-    static uint32_t
-    GetPermissions(const FileSpec &file_spec, Error &error);
-
-    //------------------------------------------------------------------
-    /// Return true if this file is interactive.
-    ///
-    /// @return
-    ///     True if this file is a terminal (tty or pty), false
-    ///     otherwise.
-    //------------------------------------------------------------------
-    bool
-    GetIsInteractive ();
-    
-    //------------------------------------------------------------------
-    /// Return true if this file from a real terminal.
-    ///
-    /// Just knowing a file is a interactive isn't enough, we also need
-    /// to know if the terminal has a width and height so we can do
-    /// cursor movement and other terminal manipulations by sending
-    /// escape sequences.
-    ///
-    /// @return
-    ///     True if this file is a terminal (tty, not a pty) that has
-    ///     a non-zero width and height, false otherwise.
-    //------------------------------------------------------------------
-    bool
-    GetIsRealTerminal ();
-    
-    bool
-    GetIsTerminalWithColors ();
-
-    //------------------------------------------------------------------
-    /// Output printf formatted output to the stream.
-    ///
-    /// Print some formatted output to the stream.
-    ///
-    /// @param[in] format
-    ///     A printf style format string.
-    ///
-    /// @param[in] ...
-    ///     Variable arguments that are needed for the printf style
-    ///     format string \a format.
-    //------------------------------------------------------------------
-    size_t
-    Printf (const char *format, ...)  __attribute__ ((format (printf, 2, 3)));
-    
-    size_t
-    PrintfVarArg(const char *format, va_list args);
-
-    void
-    SetOptions (uint32_t options)
-    {
-        m_options = options;
-    }
+  void SetOptions(uint32_t options) { m_options = options; }
 
 protected:
-    bool
-    DescriptorIsValid () const
-    {
-        return m_descriptor >= 0;
-    }
-
-    bool
-    StreamIsValid () const
-    {
-        return m_stream != kInvalidStream;
-    }
-    
-    void
-    CalculateInteractiveAndTerminal ();
-    
-    //------------------------------------------------------------------
-    // Member variables
-    //------------------------------------------------------------------
-    int m_descriptor;
-    FILE *m_stream;
-    uint32_t m_options;
-    bool m_own_stream;
-    LazyBool m_is_interactive;
-    LazyBool m_is_real_terminal;
-    LazyBool m_supports_colors;
+  bool DescriptorIsValid() const { return m_descriptor >= 0; }
+
+  bool StreamIsValid() const { return m_stream != kInvalidStream; }
+
+  void CalculateInteractiveAndTerminal();
+
+  //------------------------------------------------------------------
+  // Member variables
+  //------------------------------------------------------------------
+  int m_descriptor;
+  FILE *m_stream;
+  uint32_t m_options;
+  bool m_own_stream;
+  LazyBool m_is_interactive;
+  LazyBool m_is_real_terminal;
+  LazyBool m_supports_colors;
 
 private:
-    DISALLOW_COPY_AND_ASSIGN(File);
+  DISALLOW_COPY_AND_ASSIGN(File);
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/FileCache.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileCache.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/FileCache.h (original)
+++ lldb/trunk/include/lldb/Host/FileCache.h Tue Sep  6 15:57:50 2016
@@ -17,28 +17,29 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Host/FileSpec.h"
 
-namespace lldb_private
-{
-class FileCache
-{
-  private:
-    FileCache() {}
+namespace lldb_private {
+class FileCache {
+private:
+  FileCache() {}
 
-    typedef std::map<lldb::user_id_t, lldb::FileSP> FDToFileMap;
+  typedef std::map<lldb::user_id_t, lldb::FileSP> FDToFileMap;
 
-  public:
-    static FileCache &GetInstance();
+public:
+  static FileCache &GetInstance();
 
-    lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, uint32_t mode, Error &error);
-    bool CloseFile(lldb::user_id_t fd, Error &error);
+  lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags,
+                           uint32_t mode, Error &error);
+  bool CloseFile(lldb::user_id_t fd, Error &error);
 
-    uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, uint64_t src_len, Error &error);
-    uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, uint64_t dst_len, Error &error);
+  uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
+                     uint64_t src_len, Error &error);
+  uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
+                    uint64_t dst_len, Error &error);
 
-  private:
-    static FileCache *m_instance;
+private:
+  static FileCache *m_instance;
 
-    FDToFileMap m_cache;
+  FDToFileMap m_cache;
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/FileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Tue Sep  6 15:57:50 2016
@@ -17,10 +17,10 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/STLUtils.h"
 #include "lldb/Host/TimeValue.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
 
@@ -32,825 +32,764 @@ namespace lldb_private {
 /// and basename. These string values of the paths are put into uniqued
 /// string pools for fast comparisons and efficient memory usage.
 ///
-/// Another reason the paths are split into the directory and basename 
-/// is to allow efficient debugger searching. Often in a debugger the 
-/// user types in the basename of the file, for example setting a 
+/// Another reason the paths are split into the directory and basename
+/// is to allow efficient debugger searching. Often in a debugger the
+/// user types in the basename of the file, for example setting a
 /// breakpoint by file and line, or specifying a module (shared library)
 /// to limit the scope in which to execute a command. The user rarely
 /// types in a full path. When the paths are already split up, it makes
-/// it easy for us to compare only the basenames of a lot of file 
+/// it easy for us to compare only the basenames of a lot of file
 /// specifications without having to split up the file path each time
 /// to get to the basename.
 //----------------------------------------------------------------------
-class FileSpec
-{
+class FileSpec {
 public:
-    typedef enum FileType
-    {
-        eFileTypeInvalid = -1,
-        eFileTypeUnknown = 0,
-        eFileTypeDirectory,
-        eFileTypePipe,
-        eFileTypeRegular,
-        eFileTypeSocket,
-        eFileTypeSymbolicLink,
-        eFileTypeOther
-    } FileType;
-
-    enum PathSyntax
-    {
-        ePathSyntaxPosix,
-        ePathSyntaxWindows,
-        ePathSyntaxHostNative
-    };
-
-    FileSpec();
-
-    //------------------------------------------------------------------
-    /// Constructor with path.
-    ///
-    /// Takes a path to a file which can be just a filename, or a full
-    /// path. If \a path is not nullptr or empty, this function will call
-    /// FileSpec::SetFile (const char *path, bool resolve).
-    ///
-    /// @param[in] path
-    ///     The full or partial path to a file.
-    ///
-    /// @param[in] resolve_path
-    ///     If \b true, then we resolve the path, removing stray ../.. and so forth,
-    ///     if \b false we trust the path is in canonical form already.
-    ///
-    /// @see FileSpec::SetFile (const char *path, bool resolve)
-    //------------------------------------------------------------------
-    explicit FileSpec (const char *path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative);
-
-    explicit FileSpec (const char *path, bool resolve_path, ArchSpec arch);
-
-    explicit FileSpec(const std::string &path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative);
-
-    explicit FileSpec(const std::string &path, bool resolve_path, ArchSpec arch);
-
-    //------------------------------------------------------------------
-    /// Copy constructor
-    ///
-    /// Makes a copy of the uniqued directory and filename strings from
-    /// \a rhs.
-    ///
-    /// @param[in] rhs
-    ///     A const FileSpec object reference to copy.
-    //------------------------------------------------------------------
-    FileSpec (const FileSpec& rhs);
-
-    //------------------------------------------------------------------
-    /// Copy constructor
-    ///
-    /// Makes a copy of the uniqued directory and filename strings from
-    /// \a rhs if it is not nullptr.
-    ///
-    /// @param[in] rhs
-    ///     A const FileSpec object pointer to copy if non-nullptr.
-    //------------------------------------------------------------------
-    FileSpec (const FileSpec* rhs);
-
-    //------------------------------------------------------------------
-    /// Destructor.
-    //------------------------------------------------------------------
-    ~FileSpec ();
-
-    bool
-    DirectoryEquals(const FileSpec &other) const;
-
-    bool
-    FileEquals(const FileSpec &other) const;
-
-    //------------------------------------------------------------------
-    /// Assignment operator.
-    ///
-    /// Makes a copy of the uniqued directory and filename strings from
-    /// \a rhs.
-    ///
-    /// @param[in] rhs
-    ///     A const FileSpec object reference to assign to this object.
-    ///
-    /// @return
-    ///     A const reference to this object.
-    //------------------------------------------------------------------
-    const FileSpec&
-    operator= (const FileSpec& rhs);
-
-    //------------------------------------------------------------------
-    /// Equal to operator
-    ///
-    /// Tests if this object is equal to \a rhs.
-    ///
-    /// @param[in] rhs
-    ///     A const FileSpec object reference to compare this object
-    ///     to.
-    ///
-    /// @return
-    ///     \b true if this object is equal to \a rhs, \b false
-    ///     otherwise.
-    //------------------------------------------------------------------
-    bool
-    operator== (const FileSpec& rhs) const;
-
-    //------------------------------------------------------------------
-    /// Not equal to operator
-    ///
-    /// Tests if this object is not equal to \a rhs.
-    ///
-    /// @param[in] rhs
-    ///     A const FileSpec object reference to compare this object
-    ///     to.
-    ///
-    /// @return
-    ///     \b true if this object is equal to \a rhs, \b false
-    ///     otherwise.
-    //------------------------------------------------------------------
-    bool
-    operator!= (const FileSpec& rhs) const;
-
-    //------------------------------------------------------------------
-    /// Less than to operator
-    ///
-    /// Tests if this object is less than \a rhs.
-    ///
-    /// @param[in] rhs
-    ///     A const FileSpec object reference to compare this object
-    ///     to.
-    ///
-    /// @return
-    ///     \b true if this object is less than \a rhs, \b false
-    ///     otherwise.
-    //------------------------------------------------------------------
-    bool
-    operator< (const FileSpec& rhs) const;
-
-    //------------------------------------------------------------------
-    /// Convert to pointer operator.
-    ///
-    /// This allows code to check a FileSpec object to see if it
-    /// contains anything valid using code such as:
-    ///
-    /// @code
-    /// FileSpec file_spec(...);
-    /// if (file_spec)
-    /// { ...
-    /// @endcode
-    ///
-    /// @return
-    ///     A pointer to this object if either the directory or filename
-    ///     is valid, nullptr otherwise.
-    //------------------------------------------------------------------
-    explicit operator bool() const;
-
-    //------------------------------------------------------------------
-    /// Logical NOT operator.
-    ///
-    /// This allows code to check a FileSpec object to see if it is
-    /// invalid using code such as:
-    ///
-    /// @code
-    /// FileSpec file_spec(...);
-    /// if (!file_spec)
-    /// { ...
-    /// @endcode
-    ///
-    /// @return
-    ///     Returns \b true if the object has an empty directory and
-    ///     filename, \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    operator! () const;
-
-    //------------------------------------------------------------------
-    /// Clears the object state.
-    ///
-    /// Clear this object by releasing both the directory and filename
-    /// string values and reverting them to empty strings.
-    //------------------------------------------------------------------
-    void
-    Clear ();
-
-    //------------------------------------------------------------------
-    /// Compare two FileSpec objects.
-    ///
-    /// If \a full is true, then both the directory and the filename
-    /// must match. If \a full is false, then the directory names for
-    /// \a lhs and \a rhs are only compared if they are both not empty.
-    /// This allows a FileSpec object to only contain a filename
-    /// and it can match FileSpec objects that have matching
-    /// filenames with different paths.
-    ///
-    /// @param[in] lhs
-    ///     A const reference to the Left Hand Side object to compare.
-    ///
-    /// @param[in] rhs
-    ///     A const reference to the Right Hand Side object to compare.
-    ///
-    /// @param[in] full
-    ///     If true, then both the directory and filenames will have to
-    ///     match for a compare to return zero (equal to). If false
-    ///     and either directory from \a lhs or \a rhs is empty, then
-    ///     only the filename will be compared, else a full comparison
-    ///     is done.
-    ///
-    /// @return
-    ///     @li -1 if \a lhs is less than \a rhs
-    ///     @li 0 if \a lhs is equal to \a rhs
-    ///     @li 1 if \a lhs is greater than \a rhs
-    //------------------------------------------------------------------
-    static int
-    Compare (const FileSpec& lhs, const FileSpec& rhs, bool full);
-
-    static bool
-    Equal (const FileSpec& a, const FileSpec& b, bool full, bool remove_backups = false);
-
-    //------------------------------------------------------------------
-    /// Case sensitivity of path.
-    ///
-    /// @return
-    ///     \b true if the file path is case sensitive (POSIX), false
-    ///		if case insensitive (Windows).
-    //------------------------------------------------------------------
-    bool
-    IsCaseSensitive() const
-    {
-        return m_syntax != ePathSyntaxWindows;
-    }
-
-    //------------------------------------------------------------------
-    /// Dump this object to a Stream.
-    ///
-    /// Dump the object to the supplied stream \a s. If the object
-    /// contains a valid directory name, it will be displayed followed
-    /// by a directory delimiter, and the filename.
-    ///
-    /// @param[in] s
-    ///     The stream to which to dump the object description.
-    //------------------------------------------------------------------
-    void
-    Dump(Stream *s) const;
-
-    //------------------------------------------------------------------
-    /// Existence test.
-    ///
-    /// @return
-    ///     \b true if the file exists on disk, \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    Exists () const;
-
-    //------------------------------------------------------------------
-    /// Check if a file is readable by the current user
-    ///
-    /// @return
-    ///     \b true if the file exists on disk and is readable, \b false
-    ///     otherwise.
-    //------------------------------------------------------------------
-    bool
-    Readable () const;
-     
-    //------------------------------------------------------------------
-    /// Expanded existence test.
-    ///
-    /// Call into the Host to see if it can help find the file (e.g. by
-    /// searching paths set in the environment, etc.).
-    ///
-    /// If found, sets the value of m_directory to the directory where 
-    /// the file was found.
-    ///
-    /// @return
-    ///     \b true if was able to find the file using expanded search 
-    ///     methods, \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    ResolveExecutableLocation ();
-    
-    //------------------------------------------------------------------
-    /// Canonicalize this file path (basically running the static 
-    /// FileSpec::Resolve method on it). Useful if you asked us not to 
-    /// resolve the file path when you set the file.
-    //------------------------------------------------------------------
-    bool
-    ResolvePath ();
-
-    uint64_t
-    GetByteSize() const;
-
-    PathSyntax
-    GetPathSyntax() const;
-
-    //------------------------------------------------------------------
-    /// Directory string get accessor.
-    ///
-    /// @return
-    ///     A reference to the directory string object.
-    //------------------------------------------------------------------
-    ConstString &
-    GetDirectory ();
-
-    //------------------------------------------------------------------
-    /// Directory string const get accessor.
-    ///
-    /// @return
-    ///     A const reference to the directory string object.
-    //------------------------------------------------------------------
-    const ConstString &
-    GetDirectory () const;
-
-    //------------------------------------------------------------------
-    /// Filename string get accessor.
-    ///
-    /// @return
-    ///     A reference to the filename string object.
-    //------------------------------------------------------------------
-    ConstString &
-    GetFilename ();
-
-    //------------------------------------------------------------------
-    /// Filename string const get accessor.
-    ///
-    /// @return
-    ///     A const reference to the filename string object.
-    //------------------------------------------------------------------
-    const ConstString &
-    GetFilename () const;
-
-    //------------------------------------------------------------------
-    /// Returns true if the filespec represents an implementation source
-    /// file (files with a ".c", ".cpp", ".m", ".mm" (many more)
-    /// extension).
-    ///
-    /// @return
-    ///     \b true if the filespec represents an implementation source
-    ///     file, \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    IsSourceImplementationFile () const;
-
-    //------------------------------------------------------------------
-    /// Returns true if the filespec represents a relative path.
-    ///
-    /// @return
-    ///     \b true if the filespec represents a relative path,
-    ///     \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    IsRelative() const;
-
-    //------------------------------------------------------------------
-    /// Returns true if the filespec represents an absolute path.
-    ///
-    /// @return
-    ///     \b true if the filespec represents an absolute path,
-    ///     \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    IsAbsolute() const;
-
-    TimeValue
-    GetModificationTime () const;
-
-    //------------------------------------------------------------------
-    /// Extract the full path to the file.
-    ///
-    /// Extract the directory and path into a fixed buffer. This is
-    /// needed as the directory and path are stored in separate string
-    /// values.
-    ///
-    /// @param[out] path
-    ///     The buffer in which to place the extracted full path.
-    ///
-    /// @param[in] max_path_length
-    ///     The maximum length of \a path.
-    ///
-    /// @return
-    ///     Returns the number of characters that would be needed to 
-    ///     properly copy the full path into \a path. If the returned
-    ///     number is less than \a max_path_length, then the path is
-    ///     properly copied and terminated. If the return value is 
-    ///     >= \a max_path_length, then the path was truncated (but is
-    ///     still NULL terminated).
-    //------------------------------------------------------------------
-    size_t
-    GetPath (char *path, size_t max_path_length, bool denormalize = true) const;
-
-    //------------------------------------------------------------------
-    /// Extract the full path to the file.
-    ///
-    /// Extract the directory and path into a std::string, which is returned.
-    ///
-    /// @return
-    ///     Returns a std::string with the directory and filename 
-    ///     concatenated.
-    //------------------------------------------------------------------
-    std::string
-    GetPath (bool denormalize = true) const;
-
-    const char *
-    GetCString(bool denormalize = true) const;
-
-    //------------------------------------------------------------------
-    /// Extract the full path to the file.
-    ///
-    /// Extract the directory and path into an llvm::SmallVectorImpl<>
-    ///
-    /// @return
-    ///     Returns a std::string with the directory and filename
-    ///     concatenated.
-    //------------------------------------------------------------------
-    void GetPath(llvm::SmallVectorImpl<char> &path, bool denormalize = true) const;
-
-    //------------------------------------------------------------------
-    /// Extract the extension of the file.
-    ///
-    /// Returns a ConstString that represents the extension of the filename
-    /// for this FileSpec object. If this object does not represent a file,
-    /// or the filename has no extension, ConstString(nullptr) is returned.
-    /// The dot ('.') character is not returned as part of the extension
-    ///
-    /// @return
-    ///     Returns the extension of the file as a ConstString object.
-    //------------------------------------------------------------------
-    ConstString
-    GetFileNameExtension () const;
-
-    //------------------------------------------------------------------
-    /// Return the filename without the extension part
-    ///
-    /// Returns a ConstString that represents the filename of this object
-    /// without the extension part (e.g. for a file named "foo.bar", "foo"
-    /// is returned)
-    ///
-    /// @return
-    ///     Returns the filename without extension
-    ///     as a ConstString object.
-    //------------------------------------------------------------------
-    ConstString
-    GetFileNameStrippingExtension () const;
-    
-    FileType
-    GetFileType () const;
-
-    //------------------------------------------------------------------
-    /// Return the current permissions of the path.
-    ///
-    /// Returns a bitmask for the current permissions of the file
-    /// ( zero or more of the permission bits defined in
-    /// File::Permissions).
-    ///
-    /// @return
-    ///     Zero if the file doesn't exist or we are unable to get
-    ///     information for the file, otherwise one or more permission
-    ///     bits from the File::Permissions enumeration.
-    //------------------------------------------------------------------
-    uint32_t
-    GetPermissions () const;
-    
-    bool
-    IsDirectory () const
-    {
-        return GetFileType() == FileSpec::eFileTypeDirectory;
-    }
-
-    bool
-    IsPipe () const
-    {
-        return GetFileType() == FileSpec::eFileTypePipe;
-    }
-
-    bool
-    IsRegularFile () const
-    {
-        return GetFileType() == FileSpec::eFileTypeRegular;
-    }
-
-    bool
-    IsSocket () const
-    {
-        return GetFileType() == FileSpec::eFileTypeSocket;
-    }
-
-    bool
-    IsSymbolicLink () const;
-
-    //------------------------------------------------------------------
-    /// Get the memory cost of this object.
-    ///
-    /// Return the size in bytes that this object takes in memory. This
-    /// returns the size in bytes of this object, not any shared string
-    /// values it may refer to.
-    ///
-    /// @return
-    ///     The number of bytes that this object occupies in memory.
-    ///
-    /// @see ConstString::StaticMemorySize ()
-    //------------------------------------------------------------------
-    size_t
-    MemorySize () const;
-
-    //------------------------------------------------------------------
-    /// Memory map part of, or the entire contents of, a file.
-    ///
-    /// Returns a shared pointer to a data buffer that contains all or
-    /// part of the contents of a file. The data is memory mapped and
-    /// will lazily page in data from the file as memory is accessed.
-    /// The data that is mapped will start \a offset bytes into the
-    /// file, and \a length bytes will be mapped. If \a length is
-    /// greater than the number of bytes available in the file starting
-    /// at \a offset, the number of bytes will be appropriately
-    /// truncated. The final number of bytes that get mapped can be
-    /// verified using the DataBuffer::GetByteSize() function on the return
-    /// shared data pointer object contents.
-    ///
-    /// @param[in] offset
-    ///     The offset in bytes from the beginning of the file where
-    ///     memory mapping should begin.
-    ///
-    /// @param[in] length
-    ///     The size in bytes that should be mapped starting \a offset
-    ///     bytes into the file. If \a length is \c SIZE_MAX, map
-    ///     as many bytes as possible.
-    ///
-    /// @return
-    ///     A shared pointer to the memory mapped data. This shared
-    ///     pointer can contain a nullptr DataBuffer pointer, so the contained
-    ///     pointer must be checked prior to using it.
-    //------------------------------------------------------------------
-    lldb::DataBufferSP
-    MemoryMapFileContents (off_t offset = 0, size_t length = SIZE_MAX) const;
-
-    //------------------------------------------------------------------
-    /// Memory map part of, or the entire contents of, a file only if
-    /// the file is local (not on a network mount).
-    ///
-    /// Returns a shared pointer to a data buffer that contains all or
-    /// part of the contents of a file. The data will be memory mapped
-    /// if the file is local and will lazily page in data from the file
-    /// as memory is accessed. If the data is memory mapped, the data
-    /// that is mapped will start \a offset bytes into the file, and
-    /// \a length bytes will be mapped. If \a length is
-    /// greater than the number of bytes available in the file starting
-    /// at \a offset, the number of bytes will be appropriately
-    /// truncated. The final number of bytes that get mapped can be
-    /// verified using the DataBuffer::GetByteSize() function on the return
-    /// shared data pointer object contents.
-    ///
-    /// If the file is on a network mount the data will be read into a
-    /// heap buffer immediately so that accesses to the data won't later
-    /// cause a crash if we touch a page that isn't paged in and the
-    /// network mount has been disconnected or gone away.
-    ///
-    /// @param[in] offset
-    ///     The offset in bytes from the beginning of the file where
-    ///     memory mapping should begin.
-    ///
-    /// @param[in] length
-    ///     The size in bytes that should be mapped starting \a offset
-    ///     bytes into the file. If \a length is \c SIZE_MAX, map
-    ///     as many bytes as possible.
-    ///
-    /// @return
-    ///     A shared pointer to the memory mapped data. This shared
-    ///     pointer can contain a nullptr DataBuffer pointer, so the contained
-    ///     pointer must be checked prior to using it.
-    //------------------------------------------------------------------
-    lldb::DataBufferSP
-    MemoryMapFileContentsIfLocal(off_t file_offset, size_t file_size) const;
-
-    //------------------------------------------------------------------
-    /// Read part of, or the entire contents of, a file into a heap based data buffer.
-    ///
-    /// Returns a shared pointer to a data buffer that contains all or
-    /// part of the contents of a file. The data copies into a heap based
-    /// buffer that lives in the DataBuffer shared pointer object returned.
-    /// The data that is cached will start \a offset bytes into the
-    /// file, and \a length bytes will be mapped. If \a length is
-    /// greater than the number of bytes available in the file starting
-    /// at \a offset, the number of bytes will be appropriately
-    /// truncated. The final number of bytes that get mapped can be
-    /// verified using the DataBuffer::GetByteSize() function.
-    ///
-    /// @param[in] offset
-    ///     The offset in bytes from the beginning of the file where
-    ///     memory mapping should begin.
-    ///
-    /// @param[in] length
-    ///     The size in bytes that should be mapped starting \a offset
-    ///     bytes into the file. If \a length is \c SIZE_MAX, map
-    ///     as many bytes as possible.
-    ///
-    /// @return
-    ///     A shared pointer to the memory mapped data. This shared
-    ///     pointer can contain a nullptr DataBuffer pointer, so the contained
-    ///     pointer must be checked prior to using it.
-    //------------------------------------------------------------------
-    lldb::DataBufferSP
-    ReadFileContents(off_t offset = 0, size_t length = SIZE_MAX, Error *error_ptr = nullptr) const;
-
-    size_t
-    ReadFileContents (off_t file_offset, void *dst, size_t dst_len, Error *error_ptr) const;
-
-    //------------------------------------------------------------------
-    /// Read the entire contents of a file as data that can be used
-    /// as a C string.
-    ///
-    /// Read the entire contents of a file and ensure that the data
-    /// is NULL terminated so it can be used as a C string.
-    ///
-    /// @return
-    ///     A shared pointer to the data. This shared pointer can
-    ///     contain a nullptr DataBuffer pointer, so the contained pointer
-    ///     must be checked prior to using it.
-    //------------------------------------------------------------------
-    lldb::DataBufferSP
-    ReadFileContentsAsCString(Error *error_ptr = nullptr);
-
-    //------------------------------------------------------------------
-    /// Normalize a pathname by collapsing redundant separators and
-    /// up-level references.
-    //------------------------------------------------------------------
-    void
-    NormalizePath ();
-
-    //------------------------------------------------------------------
-    /// Run through the input string, replaying the effect of any ".." and produce
-    /// the resultant path.  The input path is not required to be in the host file system
-    /// format, but it is required to be normalized to that system.
-    ///
-    /// @param[in] input
-    ///     The input path to analyze.
-    ///
-    /// @param[out] result
-    ///     The backup-resolved path will be written here.
-    //------------------------------------------------------------------
-    static void RemoveBackupDots (const ConstString &input_const_str, ConstString &result_const_str);
-
-    //------------------------------------------------------------------
-    /// Change the file specified with a new path.
-    ///
-    /// Update the contents of this object with a new path. The path will
-    /// be split up into a directory and filename and stored as uniqued
-    /// string values for quick comparison and efficient memory usage.
-    ///
-    /// @param[in] path
-    ///     A full, partial, or relative path to a file.
-    ///
-    /// @param[in] resolve_path
-    ///     If \b true, then we will try to resolve links the path using
-    ///     the static FileSpec::Resolve.
-    //------------------------------------------------------------------
-    void
-    SetFile (const char *path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative);
-
-    void
-    SetFile(const char *path, bool resolve_path, ArchSpec arch);
-
-    void
-    SetFile(const std::string &path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative);
-
-    void
-    SetFile(const std::string &path, bool resolve_path, ArchSpec arch);
-
-    bool
-    IsResolved () const
-    {
-        return m_is_resolved;
-    }
-
-    //------------------------------------------------------------------
-    /// Set if the file path has been resolved or not.
-    ///
-    /// If you know a file path is already resolved and avoided passing
-    /// a \b true parameter for any functions that take a "bool 
-    /// resolve_path" parameter, you can set the value manually using
-    /// this call to make sure we don't try and resolve it later, or try
-    /// and resolve a path that has already been resolved.
-    ///
-    /// @param[in] is_resolved
-    ///     A boolean value that will replace the current value that
-    ///     indicates if the paths in this object have been resolved.
-    //------------------------------------------------------------------
-    void
-    SetIsResolved (bool is_resolved)
-    {
-        m_is_resolved = is_resolved;
-    }
-
-    //------------------------------------------------------------------
-    /// Read the file into an array of strings, one per line.
-    ///
-    /// Opens and reads the file in this object into an array of strings,
-    /// one string per line of the file. Returns a boolean indicating
-    /// success or failure.
-    ///
-    /// @param[out] lines
-    ///     The string array into which to read the file.
-    ///
-    /// @result
-    ///     Returns the number of lines that were read from the file.
-    //------------------------------------------------------------------
-    size_t
-    ReadFileLines (STLStringArray &lines);
-
-    //------------------------------------------------------------------
-    /// Resolves user name and links in \a path, and overwrites the input
-    /// argument with the resolved path.
-    ///
-    /// @param[in] path
-    ///     Input path to be resolved, in the form of a llvm::SmallString or similar.
-    //------------------------------------------------------------------
-    static void
-    Resolve (llvm::SmallVectorImpl<char> &path);
-
-    FileSpec
-    CopyByAppendingPathComponent (const char *new_path) const;
-    
-    FileSpec
-    CopyByRemovingLastPathComponent () const;
-
-    void
-    PrependPathComponent(const char *new_path);
-
-    void
-    PrependPathComponent(const std::string &new_path);
-
-    void
-    PrependPathComponent(const FileSpec &new_path);
-
-    void
-    AppendPathComponent(const char *new_path);
-
-    void
-    AppendPathComponent(const std::string &new_path);
-
-    void
-    AppendPathComponent(const FileSpec &new_path);
-
-    void
-    RemoveLastPathComponent ();
-    
-    ConstString
-    GetLastPathComponent () const;
-    
-    //------------------------------------------------------------------
-    /// Resolves the user name at the beginning of \a src_path, and writes the output
-    /// to \a dst_path.  Note, \a src_path can contain other path components after the
-    /// user name, they will be copied over, and if the path doesn't start with "~" it
-    /// will also be copied over to \a dst_path.
-    ///
-    /// @param[in] src_path
-    ///     Input path to be resolved.
-    ///
-    /// @param[in] dst_path
-    ///     Buffer to store the resolved path.
-    //------------------------------------------------------------------
-    static void
-    ResolveUsername (llvm::SmallVectorImpl<char> &path);
-    
-    static size_t
-    ResolvePartialUsername (const char *partial_name, StringList &matches);
-
-    enum EnumerateDirectoryResult
-    {
-        eEnumerateDirectoryResultNext,  // Enumerate next entry in the current directory
-        eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is a directory or symlink, or next if not
-        eEnumerateDirectoryResultExit,  // Exit from the current directory at the current level.
-        eEnumerateDirectoryResultQuit   // Stop directory enumerations at any level
-    };
-
-    typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType) (void *baton,
-                                                                        FileType file_type,
-                                                                        const FileSpec &spec);
-
-    static EnumerateDirectoryResult
-    EnumerateDirectory (const char *dir_path,
-                        bool find_directories,
-                        bool find_files,
-                        bool find_other,
-                        EnumerateDirectoryCallbackType callback,
-                        void *callback_baton);
-
-    typedef std::function <EnumerateDirectoryResult(FileType file_type, const FileSpec &spec)> DirectoryCallback;
-
-    static EnumerateDirectoryResult
-    ForEachItemInDirectory (const char *dir_path, DirectoryCallback const &callback);
+  typedef enum FileType {
+    eFileTypeInvalid = -1,
+    eFileTypeUnknown = 0,
+    eFileTypeDirectory,
+    eFileTypePipe,
+    eFileTypeRegular,
+    eFileTypeSocket,
+    eFileTypeSymbolicLink,
+    eFileTypeOther
+  } FileType;
+
+  enum PathSyntax {
+    ePathSyntaxPosix,
+    ePathSyntaxWindows,
+    ePathSyntaxHostNative
+  };
+
+  FileSpec();
+
+  //------------------------------------------------------------------
+  /// Constructor with path.
+  ///
+  /// Takes a path to a file which can be just a filename, or a full
+  /// path. If \a path is not nullptr or empty, this function will call
+  /// FileSpec::SetFile (const char *path, bool resolve).
+  ///
+  /// @param[in] path
+  ///     The full or partial path to a file.
+  ///
+  /// @param[in] resolve_path
+  ///     If \b true, then we resolve the path, removing stray ../.. and so
+  ///     forth,
+  ///     if \b false we trust the path is in canonical form already.
+  ///
+  /// @see FileSpec::SetFile (const char *path, bool resolve)
+  //------------------------------------------------------------------
+  explicit FileSpec(const char *path, bool resolve_path,
+                    PathSyntax syntax = ePathSyntaxHostNative);
+
+  explicit FileSpec(const char *path, bool resolve_path, ArchSpec arch);
+
+  explicit FileSpec(const std::string &path, bool resolve_path,
+                    PathSyntax syntax = ePathSyntaxHostNative);
+
+  explicit FileSpec(const std::string &path, bool resolve_path, ArchSpec arch);
+
+  //------------------------------------------------------------------
+  /// Copy constructor
+  ///
+  /// Makes a copy of the uniqued directory and filename strings from
+  /// \a rhs.
+  ///
+  /// @param[in] rhs
+  ///     A const FileSpec object reference to copy.
+  //------------------------------------------------------------------
+  FileSpec(const FileSpec &rhs);
+
+  //------------------------------------------------------------------
+  /// Copy constructor
+  ///
+  /// Makes a copy of the uniqued directory and filename strings from
+  /// \a rhs if it is not nullptr.
+  ///
+  /// @param[in] rhs
+  ///     A const FileSpec object pointer to copy if non-nullptr.
+  //------------------------------------------------------------------
+  FileSpec(const FileSpec *rhs);
+
+  //------------------------------------------------------------------
+  /// Destructor.
+  //------------------------------------------------------------------
+  ~FileSpec();
+
+  bool DirectoryEquals(const FileSpec &other) const;
+
+  bool FileEquals(const FileSpec &other) const;
+
+  //------------------------------------------------------------------
+  /// Assignment operator.
+  ///
+  /// Makes a copy of the uniqued directory and filename strings from
+  /// \a rhs.
+  ///
+  /// @param[in] rhs
+  ///     A const FileSpec object reference to assign to this object.
+  ///
+  /// @return
+  ///     A const reference to this object.
+  //------------------------------------------------------------------
+  const FileSpec &operator=(const FileSpec &rhs);
+
+  //------------------------------------------------------------------
+  /// Equal to operator
+  ///
+  /// Tests if this object is equal to \a rhs.
+  ///
+  /// @param[in] rhs
+  ///     A const FileSpec object reference to compare this object
+  ///     to.
+  ///
+  /// @return
+  ///     \b true if this object is equal to \a rhs, \b false
+  ///     otherwise.
+  //------------------------------------------------------------------
+  bool operator==(const FileSpec &rhs) const;
+
+  //------------------------------------------------------------------
+  /// Not equal to operator
+  ///
+  /// Tests if this object is not equal to \a rhs.
+  ///
+  /// @param[in] rhs
+  ///     A const FileSpec object reference to compare this object
+  ///     to.
+  ///
+  /// @return
+  ///     \b true if this object is equal to \a rhs, \b false
+  ///     otherwise.
+  //------------------------------------------------------------------
+  bool operator!=(const FileSpec &rhs) const;
+
+  //------------------------------------------------------------------
+  /// Less than to operator
+  ///
+  /// Tests if this object is less than \a rhs.
+  ///
+  /// @param[in] rhs
+  ///     A const FileSpec object reference to compare this object
+  ///     to.
+  ///
+  /// @return
+  ///     \b true if this object is less than \a rhs, \b false
+  ///     otherwise.
+  //------------------------------------------------------------------
+  bool operator<(const FileSpec &rhs) const;
+
+  //------------------------------------------------------------------
+  /// Convert to pointer operator.
+  ///
+  /// This allows code to check a FileSpec object to see if it
+  /// contains anything valid using code such as:
+  ///
+  /// @code
+  /// FileSpec file_spec(...);
+  /// if (file_spec)
+  /// { ...
+  /// @endcode
+  ///
+  /// @return
+  ///     A pointer to this object if either the directory or filename
+  ///     is valid, nullptr otherwise.
+  //------------------------------------------------------------------
+  explicit operator bool() const;
+
+  //------------------------------------------------------------------
+  /// Logical NOT operator.
+  ///
+  /// This allows code to check a FileSpec object to see if it is
+  /// invalid using code such as:
+  ///
+  /// @code
+  /// FileSpec file_spec(...);
+  /// if (!file_spec)
+  /// { ...
+  /// @endcode
+  ///
+  /// @return
+  ///     Returns \b true if the object has an empty directory and
+  ///     filename, \b false otherwise.
+  //------------------------------------------------------------------
+  bool operator!() const;
+
+  //------------------------------------------------------------------
+  /// Clears the object state.
+  ///
+  /// Clear this object by releasing both the directory and filename
+  /// string values and reverting them to empty strings.
+  //------------------------------------------------------------------
+  void Clear();
+
+  //------------------------------------------------------------------
+  /// Compare two FileSpec objects.
+  ///
+  /// If \a full is true, then both the directory and the filename
+  /// must match. If \a full is false, then the directory names for
+  /// \a lhs and \a rhs are only compared if they are both not empty.
+  /// This allows a FileSpec object to only contain a filename
+  /// and it can match FileSpec objects that have matching
+  /// filenames with different paths.
+  ///
+  /// @param[in] lhs
+  ///     A const reference to the Left Hand Side object to compare.
+  ///
+  /// @param[in] rhs
+  ///     A const reference to the Right Hand Side object to compare.
+  ///
+  /// @param[in] full
+  ///     If true, then both the directory and filenames will have to
+  ///     match for a compare to return zero (equal to). If false
+  ///     and either directory from \a lhs or \a rhs is empty, then
+  ///     only the filename will be compared, else a full comparison
+  ///     is done.
+  ///
+  /// @return
+  ///     @li -1 if \a lhs is less than \a rhs
+  ///     @li 0 if \a lhs is equal to \a rhs
+  ///     @li 1 if \a lhs is greater than \a rhs
+  //------------------------------------------------------------------
+  static int Compare(const FileSpec &lhs, const FileSpec &rhs, bool full);
+
+  static bool Equal(const FileSpec &a, const FileSpec &b, bool full,
+                    bool remove_backups = false);
+
+  //------------------------------------------------------------------
+  /// Case sensitivity of path.
+  ///
+  /// @return
+  ///     \b true if the file path is case sensitive (POSIX), false
+  ///		if case insensitive (Windows).
+  //------------------------------------------------------------------
+  bool IsCaseSensitive() const { return m_syntax != ePathSyntaxWindows; }
+
+  //------------------------------------------------------------------
+  /// Dump this object to a Stream.
+  ///
+  /// Dump the object to the supplied stream \a s. If the object
+  /// contains a valid directory name, it will be displayed followed
+  /// by a directory delimiter, and the filename.
+  ///
+  /// @param[in] s
+  ///     The stream to which to dump the object description.
+  //------------------------------------------------------------------
+  void Dump(Stream *s) const;
+
+  //------------------------------------------------------------------
+  /// Existence test.
+  ///
+  /// @return
+  ///     \b true if the file exists on disk, \b false otherwise.
+  //------------------------------------------------------------------
+  bool Exists() const;
+
+  //------------------------------------------------------------------
+  /// Check if a file is readable by the current user
+  ///
+  /// @return
+  ///     \b true if the file exists on disk and is readable, \b false
+  ///     otherwise.
+  //------------------------------------------------------------------
+  bool Readable() const;
+
+  //------------------------------------------------------------------
+  /// Expanded existence test.
+  ///
+  /// Call into the Host to see if it can help find the file (e.g. by
+  /// searching paths set in the environment, etc.).
+  ///
+  /// If found, sets the value of m_directory to the directory where
+  /// the file was found.
+  ///
+  /// @return
+  ///     \b true if was able to find the file using expanded search
+  ///     methods, \b false otherwise.
+  //------------------------------------------------------------------
+  bool ResolveExecutableLocation();
+
+  //------------------------------------------------------------------
+  /// Canonicalize this file path (basically running the static
+  /// FileSpec::Resolve method on it). Useful if you asked us not to
+  /// resolve the file path when you set the file.
+  //------------------------------------------------------------------
+  bool ResolvePath();
+
+  uint64_t GetByteSize() const;
+
+  PathSyntax GetPathSyntax() const;
+
+  //------------------------------------------------------------------
+  /// Directory string get accessor.
+  ///
+  /// @return
+  ///     A reference to the directory string object.
+  //------------------------------------------------------------------
+  ConstString &GetDirectory();
+
+  //------------------------------------------------------------------
+  /// Directory string const get accessor.
+  ///
+  /// @return
+  ///     A const reference to the directory string object.
+  //------------------------------------------------------------------
+  const ConstString &GetDirectory() const;
+
+  //------------------------------------------------------------------
+  /// Filename string get accessor.
+  ///
+  /// @return
+  ///     A reference to the filename string object.
+  //------------------------------------------------------------------
+  ConstString &GetFilename();
+
+  //------------------------------------------------------------------
+  /// Filename string const get accessor.
+  ///
+  /// @return
+  ///     A const reference to the filename string object.
+  //------------------------------------------------------------------
+  const ConstString &GetFilename() const;
+
+  //------------------------------------------------------------------
+  /// Returns true if the filespec represents an implementation source
+  /// file (files with a ".c", ".cpp", ".m", ".mm" (many more)
+  /// extension).
+  ///
+  /// @return
+  ///     \b true if the filespec represents an implementation source
+  ///     file, \b false otherwise.
+  //------------------------------------------------------------------
+  bool IsSourceImplementationFile() const;
+
+  //------------------------------------------------------------------
+  /// Returns true if the filespec represents a relative path.
+  ///
+  /// @return
+  ///     \b true if the filespec represents a relative path,
+  ///     \b false otherwise.
+  //------------------------------------------------------------------
+  bool IsRelative() const;
+
+  //------------------------------------------------------------------
+  /// Returns true if the filespec represents an absolute path.
+  ///
+  /// @return
+  ///     \b true if the filespec represents an absolute path,
+  ///     \b false otherwise.
+  //------------------------------------------------------------------
+  bool IsAbsolute() const;
+
+  TimeValue GetModificationTime() const;
+
+  //------------------------------------------------------------------
+  /// Extract the full path to the file.
+  ///
+  /// Extract the directory and path into a fixed buffer. This is
+  /// needed as the directory and path are stored in separate string
+  /// values.
+  ///
+  /// @param[out] path
+  ///     The buffer in which to place the extracted full path.
+  ///
+  /// @param[in] max_path_length
+  ///     The maximum length of \a path.
+  ///
+  /// @return
+  ///     Returns the number of characters that would be needed to
+  ///     properly copy the full path into \a path. If the returned
+  ///     number is less than \a max_path_length, then the path is
+  ///     properly copied and terminated. If the return value is
+  ///     >= \a max_path_length, then the path was truncated (but is
+  ///     still NULL terminated).
+  //------------------------------------------------------------------
+  size_t GetPath(char *path, size_t max_path_length,
+                 bool denormalize = true) const;
+
+  //------------------------------------------------------------------
+  /// Extract the full path to the file.
+  ///
+  /// Extract the directory and path into a std::string, which is returned.
+  ///
+  /// @return
+  ///     Returns a std::string with the directory and filename
+  ///     concatenated.
+  //------------------------------------------------------------------
+  std::string GetPath(bool denormalize = true) const;
+
+  const char *GetCString(bool denormalize = true) const;
+
+  //------------------------------------------------------------------
+  /// Extract the full path to the file.
+  ///
+  /// Extract the directory and path into an llvm::SmallVectorImpl<>
+  ///
+  /// @return
+  ///     Returns a std::string with the directory and filename
+  ///     concatenated.
+  //------------------------------------------------------------------
+  void GetPath(llvm::SmallVectorImpl<char> &path,
+               bool denormalize = true) const;
+
+  //------------------------------------------------------------------
+  /// Extract the extension of the file.
+  ///
+  /// Returns a ConstString that represents the extension of the filename
+  /// for this FileSpec object. If this object does not represent a file,
+  /// or the filename has no extension, ConstString(nullptr) is returned.
+  /// The dot ('.') character is not returned as part of the extension
+  ///
+  /// @return
+  ///     Returns the extension of the file as a ConstString object.
+  //------------------------------------------------------------------
+  ConstString GetFileNameExtension() const;
+
+  //------------------------------------------------------------------
+  /// Return the filename without the extension part
+  ///
+  /// Returns a ConstString that represents the filename of this object
+  /// without the extension part (e.g. for a file named "foo.bar", "foo"
+  /// is returned)
+  ///
+  /// @return
+  ///     Returns the filename without extension
+  ///     as a ConstString object.
+  //------------------------------------------------------------------
+  ConstString GetFileNameStrippingExtension() const;
+
+  FileType GetFileType() const;
+
+  //------------------------------------------------------------------
+  /// Return the current permissions of the path.
+  ///
+  /// Returns a bitmask for the current permissions of the file
+  /// ( zero or more of the permission bits defined in
+  /// File::Permissions).
+  ///
+  /// @return
+  ///     Zero if the file doesn't exist or we are unable to get
+  ///     information for the file, otherwise one or more permission
+  ///     bits from the File::Permissions enumeration.
+  //------------------------------------------------------------------
+  uint32_t GetPermissions() const;
+
+  bool IsDirectory() const {
+    return GetFileType() == FileSpec::eFileTypeDirectory;
+  }
+
+  bool IsPipe() const { return GetFileType() == FileSpec::eFileTypePipe; }
+
+  bool IsRegularFile() const {
+    return GetFileType() == FileSpec::eFileTypeRegular;
+  }
+
+  bool IsSocket() const { return GetFileType() == FileSpec::eFileTypeSocket; }
+
+  bool IsSymbolicLink() const;
+
+  //------------------------------------------------------------------
+  /// Get the memory cost of this object.
+  ///
+  /// Return the size in bytes that this object takes in memory. This
+  /// returns the size in bytes of this object, not any shared string
+  /// values it may refer to.
+  ///
+  /// @return
+  ///     The number of bytes that this object occupies in memory.
+  ///
+  /// @see ConstString::StaticMemorySize ()
+  //------------------------------------------------------------------
+  size_t MemorySize() const;
+
+  //------------------------------------------------------------------
+  /// Memory map part of, or the entire contents of, a file.
+  ///
+  /// Returns a shared pointer to a data buffer that contains all or
+  /// part of the contents of a file. The data is memory mapped and
+  /// will lazily page in data from the file as memory is accessed.
+  /// The data that is mapped will start \a offset bytes into the
+  /// file, and \a length bytes will be mapped. If \a length is
+  /// greater than the number of bytes available in the file starting
+  /// at \a offset, the number of bytes will be appropriately
+  /// truncated. The final number of bytes that get mapped can be
+  /// verified using the DataBuffer::GetByteSize() function on the return
+  /// shared data pointer object contents.
+  ///
+  /// @param[in] offset
+  ///     The offset in bytes from the beginning of the file where
+  ///     memory mapping should begin.
+  ///
+  /// @param[in] length
+  ///     The size in bytes that should be mapped starting \a offset
+  ///     bytes into the file. If \a length is \c SIZE_MAX, map
+  ///     as many bytes as possible.
+  ///
+  /// @return
+  ///     A shared pointer to the memory mapped data. This shared
+  ///     pointer can contain a nullptr DataBuffer pointer, so the contained
+  ///     pointer must be checked prior to using it.
+  //------------------------------------------------------------------
+  lldb::DataBufferSP MemoryMapFileContents(off_t offset = 0,
+                                           size_t length = SIZE_MAX) const;
+
+  //------------------------------------------------------------------
+  /// Memory map part of, or the entire contents of, a file only if
+  /// the file is local (not on a network mount).
+  ///
+  /// Returns a shared pointer to a data buffer that contains all or
+  /// part of the contents of a file. The data will be memory mapped
+  /// if the file is local and will lazily page in data from the file
+  /// as memory is accessed. If the data is memory mapped, the data
+  /// that is mapped will start \a offset bytes into the file, and
+  /// \a length bytes will be mapped. If \a length is
+  /// greater than the number of bytes available in the file starting
+  /// at \a offset, the number of bytes will be appropriately
+  /// truncated. The final number of bytes that get mapped can be
+  /// verified using the DataBuffer::GetByteSize() function on the return
+  /// shared data pointer object contents.
+  ///
+  /// If the file is on a network mount the data will be read into a
+  /// heap buffer immediately so that accesses to the data won't later
+  /// cause a crash if we touch a page that isn't paged in and the
+  /// network mount has been disconnected or gone away.
+  ///
+  /// @param[in] offset
+  ///     The offset in bytes from the beginning of the file where
+  ///     memory mapping should begin.
+  ///
+  /// @param[in] length
+  ///     The size in bytes that should be mapped starting \a offset
+  ///     bytes into the file. If \a length is \c SIZE_MAX, map
+  ///     as many bytes as possible.
+  ///
+  /// @return
+  ///     A shared pointer to the memory mapped data. This shared
+  ///     pointer can contain a nullptr DataBuffer pointer, so the contained
+  ///     pointer must be checked prior to using it.
+  //------------------------------------------------------------------
+  lldb::DataBufferSP MemoryMapFileContentsIfLocal(off_t file_offset,
+                                                  size_t file_size) const;
+
+  //------------------------------------------------------------------
+  /// Read part of, or the entire contents of, a file into a heap based data
+  /// buffer.
+  ///
+  /// Returns a shared pointer to a data buffer that contains all or
+  /// part of the contents of a file. The data copies into a heap based
+  /// buffer that lives in the DataBuffer shared pointer object returned.
+  /// The data that is cached will start \a offset bytes into the
+  /// file, and \a length bytes will be mapped. If \a length is
+  /// greater than the number of bytes available in the file starting
+  /// at \a offset, the number of bytes will be appropriately
+  /// truncated. The final number of bytes that get mapped can be
+  /// verified using the DataBuffer::GetByteSize() function.
+  ///
+  /// @param[in] offset
+  ///     The offset in bytes from the beginning of the file where
+  ///     memory mapping should begin.
+  ///
+  /// @param[in] length
+  ///     The size in bytes that should be mapped starting \a offset
+  ///     bytes into the file. If \a length is \c SIZE_MAX, map
+  ///     as many bytes as possible.
+  ///
+  /// @return
+  ///     A shared pointer to the memory mapped data. This shared
+  ///     pointer can contain a nullptr DataBuffer pointer, so the contained
+  ///     pointer must be checked prior to using it.
+  //------------------------------------------------------------------
+  lldb::DataBufferSP ReadFileContents(off_t offset = 0,
+                                      size_t length = SIZE_MAX,
+                                      Error *error_ptr = nullptr) const;
+
+  size_t ReadFileContents(off_t file_offset, void *dst, size_t dst_len,
+                          Error *error_ptr) const;
+
+  //------------------------------------------------------------------
+  /// Read the entire contents of a file as data that can be used
+  /// as a C string.
+  ///
+  /// Read the entire contents of a file and ensure that the data
+  /// is NULL terminated so it can be used as a C string.
+  ///
+  /// @return
+  ///     A shared pointer to the data. This shared pointer can
+  ///     contain a nullptr DataBuffer pointer, so the contained pointer
+  ///     must be checked prior to using it.
+  //------------------------------------------------------------------
+  lldb::DataBufferSP ReadFileContentsAsCString(Error *error_ptr = nullptr);
+
+  //------------------------------------------------------------------
+  /// Normalize a pathname by collapsing redundant separators and
+  /// up-level references.
+  //------------------------------------------------------------------
+  void NormalizePath();
+
+  //------------------------------------------------------------------
+  /// Run through the input string, replaying the effect of any ".." and produce
+  /// the resultant path.  The input path is not required to be in the host file
+  /// system
+  /// format, but it is required to be normalized to that system.
+  ///
+  /// @param[in] input
+  ///     The input path to analyze.
+  ///
+  /// @param[out] result
+  ///     The backup-resolved path will be written here.
+  //------------------------------------------------------------------
+  static void RemoveBackupDots(const ConstString &input_const_str,
+                               ConstString &result_const_str);
+
+  //------------------------------------------------------------------
+  /// Change the file specified with a new path.
+  ///
+  /// Update the contents of this object with a new path. The path will
+  /// be split up into a directory and filename and stored as uniqued
+  /// string values for quick comparison and efficient memory usage.
+  ///
+  /// @param[in] path
+  ///     A full, partial, or relative path to a file.
+  ///
+  /// @param[in] resolve_path
+  ///     If \b true, then we will try to resolve links the path using
+  ///     the static FileSpec::Resolve.
+  //------------------------------------------------------------------
+  void SetFile(const char *path, bool resolve_path,
+               PathSyntax syntax = ePathSyntaxHostNative);
+
+  void SetFile(const char *path, bool resolve_path, ArchSpec arch);
+
+  void SetFile(const std::string &path, bool resolve_path,
+               PathSyntax syntax = ePathSyntaxHostNative);
+
+  void SetFile(const std::string &path, bool resolve_path, ArchSpec arch);
+
+  bool IsResolved() const { return m_is_resolved; }
+
+  //------------------------------------------------------------------
+  /// Set if the file path has been resolved or not.
+  ///
+  /// If you know a file path is already resolved and avoided passing
+  /// a \b true parameter for any functions that take a "bool
+  /// resolve_path" parameter, you can set the value manually using
+  /// this call to make sure we don't try and resolve it later, or try
+  /// and resolve a path that has already been resolved.
+  ///
+  /// @param[in] is_resolved
+  ///     A boolean value that will replace the current value that
+  ///     indicates if the paths in this object have been resolved.
+  //------------------------------------------------------------------
+  void SetIsResolved(bool is_resolved) { m_is_resolved = is_resolved; }
+
+  //------------------------------------------------------------------
+  /// Read the file into an array of strings, one per line.
+  ///
+  /// Opens and reads the file in this object into an array of strings,
+  /// one string per line of the file. Returns a boolean indicating
+  /// success or failure.
+  ///
+  /// @param[out] lines
+  ///     The string array into which to read the file.
+  ///
+  /// @result
+  ///     Returns the number of lines that were read from the file.
+  //------------------------------------------------------------------
+  size_t ReadFileLines(STLStringArray &lines);
+
+  //------------------------------------------------------------------
+  /// Resolves user name and links in \a path, and overwrites the input
+  /// argument with the resolved path.
+  ///
+  /// @param[in] path
+  ///     Input path to be resolved, in the form of a llvm::SmallString or
+  ///     similar.
+  //------------------------------------------------------------------
+  static void Resolve(llvm::SmallVectorImpl<char> &path);
+
+  FileSpec CopyByAppendingPathComponent(const char *new_path) const;
+
+  FileSpec CopyByRemovingLastPathComponent() const;
+
+  void PrependPathComponent(const char *new_path);
+
+  void PrependPathComponent(const std::string &new_path);
+
+  void PrependPathComponent(const FileSpec &new_path);
+
+  void AppendPathComponent(const char *new_path);
+
+  void AppendPathComponent(const std::string &new_path);
+
+  void AppendPathComponent(const FileSpec &new_path);
+
+  void RemoveLastPathComponent();
+
+  ConstString GetLastPathComponent() const;
+
+  //------------------------------------------------------------------
+  /// Resolves the user name at the beginning of \a src_path, and writes the
+  /// output
+  /// to \a dst_path.  Note, \a src_path can contain other path components after
+  /// the
+  /// user name, they will be copied over, and if the path doesn't start with
+  /// "~" it
+  /// will also be copied over to \a dst_path.
+  ///
+  /// @param[in] src_path
+  ///     Input path to be resolved.
+  ///
+  /// @param[in] dst_path
+  ///     Buffer to store the resolved path.
+  //------------------------------------------------------------------
+  static void ResolveUsername(llvm::SmallVectorImpl<char> &path);
+
+  static size_t ResolvePartialUsername(const char *partial_name,
+                                       StringList &matches);
+
+  enum EnumerateDirectoryResult {
+    eEnumerateDirectoryResultNext,  // Enumerate next entry in the current
+                                    // directory
+    eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is a
+                                    // directory or symlink, or next if not
+    eEnumerateDirectoryResultExit,  // Exit from the current directory at the
+                                    // current level.
+    eEnumerateDirectoryResultQuit   // Stop directory enumerations at any level
+  };
+
+  typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)(
+      void *baton, FileType file_type, const FileSpec &spec);
+
+  static EnumerateDirectoryResult
+  EnumerateDirectory(const char *dir_path, bool find_directories,
+                     bool find_files, bool find_other,
+                     EnumerateDirectoryCallbackType callback,
+                     void *callback_baton);
+
+  typedef std::function<EnumerateDirectoryResult(FileType file_type,
+                                                 const FileSpec &spec)>
+      DirectoryCallback;
+
+  static EnumerateDirectoryResult
+  ForEachItemInDirectory(const char *dir_path,
+                         DirectoryCallback const &callback);
 
 protected:
-    //------------------------------------------------------------------
-    // Member variables
-    //------------------------------------------------------------------
-    ConstString m_directory;    ///< The uniqued directory path
-    ConstString m_filename;     ///< The uniqued filename path
-    mutable bool m_is_resolved; ///< True if this path has been resolved.
-    PathSyntax m_syntax;        ///< The syntax that this path uses (e.g. Windows / Posix)
+  //------------------------------------------------------------------
+  // Member variables
+  //------------------------------------------------------------------
+  ConstString m_directory;    ///< The uniqued directory path
+  ConstString m_filename;     ///< The uniqued filename path
+  mutable bool m_is_resolved; ///< True if this path has been resolved.
+  PathSyntax
+      m_syntax; ///< The syntax that this path uses (e.g. Windows / Posix)
 };
 
 //----------------------------------------------------------------------
 /// Dump a FileSpec object to a stream
 //----------------------------------------------------------------------
-Stream& operator << (Stream& s, const FileSpec& f);
+Stream &operator<<(Stream &s, const FileSpec &f);
 
 } // namespace lldb_private
 

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Tue Sep  6 15:57:50 2016
@@ -19,58 +19,52 @@
 #include "lldb/Core/Error.h"
 #include "lldb/Host/FileSpec.h"
 
-namespace lldb_private
-{
-class FileSystem
-{
-  public:
-    static const char *DEV_NULL;
-    static const char *PATH_CONVERSION_ERROR;
-
-    static FileSpec::PathSyntax GetNativePathSyntax();
-
-    static Error MakeDirectory(const FileSpec &file_spec, uint32_t mode);
-    static Error DeleteDirectory(const FileSpec &file_spec, bool recurse);
-
-    static Error GetFilePermissions(const FileSpec &file_spec,
-                                    uint32_t &file_permissions);
-    static Error SetFilePermissions(const FileSpec &file_spec,
-                                    uint32_t file_permissions);
-    static lldb::user_id_t GetFileSize(const FileSpec &file_spec);
-    static bool GetFileExists(const FileSpec &file_spec);
-
-    static Error Hardlink(const FileSpec &src, const FileSpec &dst);
-    static int GetHardlinkCount(const FileSpec &file_spec);
-    static Error Symlink(const FileSpec &src, const FileSpec &dst);
-    static Error Readlink(const FileSpec &src, FileSpec &dst);
-    static Error Unlink(const FileSpec &file_spec);
-    
-    static Error ResolveSymbolicLink(const FileSpec &src, FileSpec &dst);
-
-    static bool CalculateMD5(const FileSpec &file_spec, uint64_t &low, uint64_t &high);
-    static bool CalculateMD5(const FileSpec &file_spec,
-                             uint64_t offset,
-                             uint64_t length,
-                             uint64_t &low,
-                             uint64_t &high);
-
-    static bool CalculateMD5AsString(const FileSpec &file_spec, std::string& digest_str);
-    static bool CalculateMD5AsString(const FileSpec &file_spec,
-                                     uint64_t offset,
-                                     uint64_t length,
-                                     std::string& digest_str);
-
-    /// Return \b true if \a spec is on a locally mounted file system, \b false otherwise.
-    static bool IsLocal(const FileSpec &spec);
-
-    /// Wraps ::fopen in a platform-independent way. Once opened, FILEs can be
-    /// manipulated and closed with the normal ::fread, ::fclose, etc. functions.
-    static FILE *
-    Fopen(const char *path, const char *mode);
-
-    /// Wraps ::stat in a platform-independent way.
-    static int
-    Stat(const char *path, struct stat *stats);
+namespace lldb_private {
+class FileSystem {
+public:
+  static const char *DEV_NULL;
+  static const char *PATH_CONVERSION_ERROR;
+
+  static FileSpec::PathSyntax GetNativePathSyntax();
+
+  static Error MakeDirectory(const FileSpec &file_spec, uint32_t mode);
+  static Error DeleteDirectory(const FileSpec &file_spec, bool recurse);
+
+  static Error GetFilePermissions(const FileSpec &file_spec,
+                                  uint32_t &file_permissions);
+  static Error SetFilePermissions(const FileSpec &file_spec,
+                                  uint32_t file_permissions);
+  static lldb::user_id_t GetFileSize(const FileSpec &file_spec);
+  static bool GetFileExists(const FileSpec &file_spec);
+
+  static Error Hardlink(const FileSpec &src, const FileSpec &dst);
+  static int GetHardlinkCount(const FileSpec &file_spec);
+  static Error Symlink(const FileSpec &src, const FileSpec &dst);
+  static Error Readlink(const FileSpec &src, FileSpec &dst);
+  static Error Unlink(const FileSpec &file_spec);
+
+  static Error ResolveSymbolicLink(const FileSpec &src, FileSpec &dst);
+
+  static bool CalculateMD5(const FileSpec &file_spec, uint64_t &low,
+                           uint64_t &high);
+  static bool CalculateMD5(const FileSpec &file_spec, uint64_t offset,
+                           uint64_t length, uint64_t &low, uint64_t &high);
+
+  static bool CalculateMD5AsString(const FileSpec &file_spec,
+                                   std::string &digest_str);
+  static bool CalculateMD5AsString(const FileSpec &file_spec, uint64_t offset,
+                                   uint64_t length, std::string &digest_str);
+
+  /// Return \b true if \a spec is on a locally mounted file system, \b false
+  /// otherwise.
+  static bool IsLocal(const FileSpec &spec);
+
+  /// Wraps ::fopen in a platform-independent way. Once opened, FILEs can be
+  /// manipulated and closed with the normal ::fread, ::fclose, etc. functions.
+  static FILE *Fopen(const char *path, const char *mode);
+
+  /// Wraps ::stat in a platform-independent way.
+  static int Stat(const char *path, struct stat *stats);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/Host.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Host.h (original)
+++ lldb/trunk/include/lldb/Host/Host.h Tue Sep  6 15:57:50 2016
@@ -16,12 +16,12 @@
 #include <map>
 #include <string>
 
-#include "lldb/lldb-private.h"
-#include "lldb/lldb-private-forward.h"
 #include "lldb/Core/StringList.h"
 #include "lldb/Host/File.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/HostThread.h"
+#include "lldb/lldb-private-forward.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
 
@@ -35,258 +35,246 @@ class ProcessLaunchInfo;
 /// Host is a class that answers information about the host operating
 /// system.
 //----------------------------------------------------------------------
-class Host
-{
+class Host {
 public:
-    typedef std::function<bool(lldb::pid_t pid, bool exited,
-                               int signal,  // Zero for no signal
-                               int status)> // Exit value of process if signal is zero
-        MonitorChildProcessCallback;
-
-    //------------------------------------------------------------------
-    /// Start monitoring a child process.
-    ///
-    /// Allows easy monitoring of child processes. \a callback will be
-    /// called when the child process exits or if it gets a signal. The
-    /// callback will only be called with signals if \a monitor_signals
-    /// is \b true. \a callback will usually be called from another
-    /// thread so the callback function must be thread safe.
-    ///
-    /// When the callback gets called, the return value indicates if
-    /// monitoring should stop. If \b true is returned from \a callback
-    /// the information will be removed. If \b false is returned then
-    /// monitoring will continue. If the child process exits, the
-    /// monitoring will automatically stop after the callback returned
-    /// regardless of the callback return value.
-    ///
-    /// @param[in] callback
-    ///     A function callback to call when a child receives a signal
-    ///     (if \a monitor_signals is true) or a child exits.
-    ///
-    /// @param[in] pid
-    ///     The process ID of a child process to monitor, -1 for all
-    ///     processes.
-    ///
-    /// @param[in] monitor_signals
-    ///     If \b true the callback will get called when the child
-    ///     process gets a signal. If \b false, the callback will only
-    ///     get called if the child process exits.
-    ///
-    /// @return
-    ///     A thread handle that can be used to cancel the thread that
-    ///     was spawned to monitor \a pid.
-    ///
-    /// @see static void Host::StopMonitoringChildProcess (uint32_t)
-    //------------------------------------------------------------------
-    static HostThread
-    StartMonitoringChildProcess(const MonitorChildProcessCallback &callback, lldb::pid_t pid, bool monitor_signals);
-
-    enum SystemLogType
-    {
-        eSystemLogWarning,
-        eSystemLogError
-    };
-
-    static void
-    SystemLog (SystemLogType type, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
-
-    static void
-    SystemLog (SystemLogType type, const char *format, va_list args);
-
-    //------------------------------------------------------------------
-    /// Get the process ID for the calling process.
-    ///
-    /// @return
-    ///     The process ID for the current process.
-    //------------------------------------------------------------------
-    static lldb::pid_t
-    GetCurrentProcessID ();
-
-    static void
-    Kill(lldb::pid_t pid, int signo);
-
-    //------------------------------------------------------------------
-    /// Get the thread ID for the calling thread in the current process.
-    ///
-    /// @return
-    ///     The thread ID for the calling thread in the current process.
-    //------------------------------------------------------------------
-    static lldb::tid_t
-    GetCurrentThreadID ();
-
-    //------------------------------------------------------------------
-    /// Get the thread token (the one returned by ThreadCreate when the thread was created) for the
-    /// calling thread in the current process.
-    ///
-    /// @return
-    ///     The thread token for the calling thread in the current process.
-    //------------------------------------------------------------------
-    static lldb::thread_t
-    GetCurrentThread ();
-
-    static const char *
-    GetSignalAsCString (int signo);
-
-    typedef void (*ThreadLocalStorageCleanupCallback) (void *p);
-
-    static lldb::thread_key_t
-    ThreadLocalStorageCreate(ThreadLocalStorageCleanupCallback callback);
-
-    static void*
-    ThreadLocalStorageGet(lldb::thread_key_t key);
-
-    static void
-    ThreadLocalStorageSet(lldb::thread_key_t key, void *value);
-
-
-    //------------------------------------------------------------------
-    /// Given an address in the current process (the process that
-    /// is running the LLDB code), return the name of the module that
-    /// it comes from. This can be useful when you need to know the
-    /// path to the shared library that your code is running in for
-    /// loading resources that are relative to your binary.
-    ///
-    /// @param[in] host_addr
-    ///     The pointer to some code in the current process.
-    ///
-    /// @return
-    ///     \b A file spec with the module that contains \a host_addr,
-    ///     which may be invalid if \a host_addr doesn't fall into
-    ///     any valid module address range.
-    //------------------------------------------------------------------
-    static FileSpec
-    GetModuleFileSpecForHostAddress (const void *host_addr);
-    
-    //------------------------------------------------------------------
-    /// If you have an executable that is in a bundle and want to get
-    /// back to the bundle directory from the path itself, this 
-    /// function will change a path to a file within a bundle to the
-    /// bundle directory itself.
-    ///
-    /// @param[in] file
-    ///     A file spec that might point to a file in a bundle. 
-    ///
-    /// @param[out] bundle_directory
-    ///     An object will be filled in with the bundle directory for
-    ///     the bundle when \b true is returned. Otherwise \a file is 
-    ///     left untouched and \b false is returned.
-    ///
-    /// @return
-    ///     \b true if \a file was resolved in \a bundle_directory,
-    ///     \b false otherwise.
-    //------------------------------------------------------------------
-    static bool
-    GetBundleDirectory (const FileSpec &file, FileSpec &bundle_directory);
-
-    //------------------------------------------------------------------
-    /// When executable files may live within a directory, where the 
-    /// directory represents an executable bundle (like the MacOSX 
-    /// app bundles), then locate the executable within the containing
-    /// bundle.
-    ///
-    /// @param[in,out] file
-    ///     A file spec that currently points to the bundle that will
-    ///     be filled in with the executable path within the bundle
-    ///     if \b true is returned. Otherwise \a file is left untouched.
-    ///
-    /// @return
-    ///     \b true if \a file was resolved, \b false if this function
-    ///     was not able to resolve the path.
-    //------------------------------------------------------------------
-    static bool
-    ResolveExecutableInBundle (FileSpec &file);
-
-    //------------------------------------------------------------------
-    /// Set a string that can be displayed if host application crashes.
-    ///
-    /// Some operating systems have the ability to print a description
-    /// for shared libraries when a program crashes. If the host OS
-    /// supports such a mechanism, it should be implemented to help
-    /// with crash triage.
-    ///
-    /// @param[in] format
-    ///     A printf format that will be used to form a new crash
-    ///     description string.
-    //------------------------------------------------------------------
-    static void
-    SetCrashDescriptionWithFormat (const char *format, ...)  __attribute__ ((format (printf, 1, 2)));
-
-    static void
-    SetCrashDescription (const char *description);
-
-    static uint32_t
-    FindProcesses (const ProcessInstanceInfoMatch &match_info,
-                   ProcessInstanceInfoList &proc_infos);
-
-    typedef std::map<lldb::pid_t, bool> TidMap;
-    typedef std::pair<lldb::pid_t, bool> TidPair;
-    static bool
-    FindProcessThreads (const lldb::pid_t pid, TidMap &tids_to_attach);
+  typedef std::function<bool(
+      lldb::pid_t pid, bool exited,
+      int signal,  // Zero for no signal
+      int status)> // Exit value of process if signal is zero
+      MonitorChildProcessCallback;
+
+  //------------------------------------------------------------------
+  /// Start monitoring a child process.
+  ///
+  /// Allows easy monitoring of child processes. \a callback will be
+  /// called when the child process exits or if it gets a signal. The
+  /// callback will only be called with signals if \a monitor_signals
+  /// is \b true. \a callback will usually be called from another
+  /// thread so the callback function must be thread safe.
+  ///
+  /// When the callback gets called, the return value indicates if
+  /// monitoring should stop. If \b true is returned from \a callback
+  /// the information will be removed. If \b false is returned then
+  /// monitoring will continue. If the child process exits, the
+  /// monitoring will automatically stop after the callback returned
+  /// regardless of the callback return value.
+  ///
+  /// @param[in] callback
+  ///     A function callback to call when a child receives a signal
+  ///     (if \a monitor_signals is true) or a child exits.
+  ///
+  /// @param[in] pid
+  ///     The process ID of a child process to monitor, -1 for all
+  ///     processes.
+  ///
+  /// @param[in] monitor_signals
+  ///     If \b true the callback will get called when the child
+  ///     process gets a signal. If \b false, the callback will only
+  ///     get called if the child process exits.
+  ///
+  /// @return
+  ///     A thread handle that can be used to cancel the thread that
+  ///     was spawned to monitor \a pid.
+  ///
+  /// @see static void Host::StopMonitoringChildProcess (uint32_t)
+  //------------------------------------------------------------------
+  static HostThread
+  StartMonitoringChildProcess(const MonitorChildProcessCallback &callback,
+                              lldb::pid_t pid, bool monitor_signals);
+
+  enum SystemLogType { eSystemLogWarning, eSystemLogError };
+
+  static void SystemLog(SystemLogType type, const char *format, ...)
+      __attribute__((format(printf, 2, 3)));
+
+  static void SystemLog(SystemLogType type, const char *format, va_list args);
+
+  //------------------------------------------------------------------
+  /// Get the process ID for the calling process.
+  ///
+  /// @return
+  ///     The process ID for the current process.
+  //------------------------------------------------------------------
+  static lldb::pid_t GetCurrentProcessID();
+
+  static void Kill(lldb::pid_t pid, int signo);
+
+  //------------------------------------------------------------------
+  /// Get the thread ID for the calling thread in the current process.
+  ///
+  /// @return
+  ///     The thread ID for the calling thread in the current process.
+  //------------------------------------------------------------------
+  static lldb::tid_t GetCurrentThreadID();
+
+  //------------------------------------------------------------------
+  /// Get the thread token (the one returned by ThreadCreate when the thread was
+  /// created) for the
+  /// calling thread in the current process.
+  ///
+  /// @return
+  ///     The thread token for the calling thread in the current process.
+  //------------------------------------------------------------------
+  static lldb::thread_t GetCurrentThread();
+
+  static const char *GetSignalAsCString(int signo);
+
+  typedef void (*ThreadLocalStorageCleanupCallback)(void *p);
+
+  static lldb::thread_key_t
+  ThreadLocalStorageCreate(ThreadLocalStorageCleanupCallback callback);
+
+  static void *ThreadLocalStorageGet(lldb::thread_key_t key);
+
+  static void ThreadLocalStorageSet(lldb::thread_key_t key, void *value);
+
+  //------------------------------------------------------------------
+  /// Given an address in the current process (the process that
+  /// is running the LLDB code), return the name of the module that
+  /// it comes from. This can be useful when you need to know the
+  /// path to the shared library that your code is running in for
+  /// loading resources that are relative to your binary.
+  ///
+  /// @param[in] host_addr
+  ///     The pointer to some code in the current process.
+  ///
+  /// @return
+  ///     \b A file spec with the module that contains \a host_addr,
+  ///     which may be invalid if \a host_addr doesn't fall into
+  ///     any valid module address range.
+  //------------------------------------------------------------------
+  static FileSpec GetModuleFileSpecForHostAddress(const void *host_addr);
+
+  //------------------------------------------------------------------
+  /// If you have an executable that is in a bundle and want to get
+  /// back to the bundle directory from the path itself, this
+  /// function will change a path to a file within a bundle to the
+  /// bundle directory itself.
+  ///
+  /// @param[in] file
+  ///     A file spec that might point to a file in a bundle.
+  ///
+  /// @param[out] bundle_directory
+  ///     An object will be filled in with the bundle directory for
+  ///     the bundle when \b true is returned. Otherwise \a file is
+  ///     left untouched and \b false is returned.
+  ///
+  /// @return
+  ///     \b true if \a file was resolved in \a bundle_directory,
+  ///     \b false otherwise.
+  //------------------------------------------------------------------
+  static bool GetBundleDirectory(const FileSpec &file,
+                                 FileSpec &bundle_directory);
+
+  //------------------------------------------------------------------
+  /// When executable files may live within a directory, where the
+  /// directory represents an executable bundle (like the MacOSX
+  /// app bundles), then locate the executable within the containing
+  /// bundle.
+  ///
+  /// @param[in,out] file
+  ///     A file spec that currently points to the bundle that will
+  ///     be filled in with the executable path within the bundle
+  ///     if \b true is returned. Otherwise \a file is left untouched.
+  ///
+  /// @return
+  ///     \b true if \a file was resolved, \b false if this function
+  ///     was not able to resolve the path.
+  //------------------------------------------------------------------
+  static bool ResolveExecutableInBundle(FileSpec &file);
+
+  //------------------------------------------------------------------
+  /// Set a string that can be displayed if host application crashes.
+  ///
+  /// Some operating systems have the ability to print a description
+  /// for shared libraries when a program crashes. If the host OS
+  /// supports such a mechanism, it should be implemented to help
+  /// with crash triage.
+  ///
+  /// @param[in] format
+  ///     A printf format that will be used to form a new crash
+  ///     description string.
+  //------------------------------------------------------------------
+  static void SetCrashDescriptionWithFormat(const char *format, ...)
+      __attribute__((format(printf, 1, 2)));
+
+  static void SetCrashDescription(const char *description);
+
+  static uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
+                                ProcessInstanceInfoList &proc_infos);
+
+  typedef std::map<lldb::pid_t, bool> TidMap;
+  typedef std::pair<lldb::pid_t, bool> TidPair;
+  static bool FindProcessThreads(const lldb::pid_t pid, TidMap &tids_to_attach);
 
-    static bool
-    GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &proc_info);
+  static bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info);
 
-#if defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || defined (__GLIBC__) || defined (__NetBSD__)
+#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) ||        \
+    defined(__GLIBC__) || defined(__NetBSD__)
 #if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
 
-    static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info);
+  static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info);
 
-    static Error LaunchProcessPosixSpawn(const char *exe_path, const ProcessLaunchInfo &launch_info, lldb::pid_t &pid);
-
-    static bool AddPosixSpawnFileAction(void *file_actions, const FileAction *info, Log *log, Error &error);
+  static Error LaunchProcessPosixSpawn(const char *exe_path,
+                                       const ProcessLaunchInfo &launch_info,
+                                       lldb::pid_t &pid);
+
+  static bool AddPosixSpawnFileAction(void *file_actions,
+                                      const FileAction *info, Log *log,
+                                      Error &error);
 
 #endif // !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
-#endif // defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || defined (__GLIBC__) || defined(__NetBSD__)
+#endif // defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) ||
+       // defined (__GLIBC__) || defined(__NetBSD__)
+
+  static const lldb::UnixSignalsSP &GetUnixSignals();
+
+  static Error LaunchProcess(ProcessLaunchInfo &launch_info);
+
+  //------------------------------------------------------------------
+  /// Perform expansion of the command-line for this launch info
+  /// This can potentially involve wildcard expansion
+  //  environment variable replacement, and whatever other
+  //  argument magic the platform defines as part of its typical
+  //  user experience
+  //------------------------------------------------------------------
+  static Error ShellExpandArguments(ProcessLaunchInfo &launch_info);
+
+  static Error RunShellCommand(
+      const char *command,         // Shouldn't be NULL
+      const FileSpec &working_dir, // Pass empty FileSpec to use the current
+                                   // working directory
+      int *status_ptr, // Pass NULL if you don't want the process exit status
+      int *signo_ptr,  // Pass NULL if you don't want the signal that caused the
+                       // process to exit
+      std::string
+          *command_output, // Pass NULL if you don't want the command output
+      uint32_t timeout_sec,
+      bool run_in_default_shell = true);
+
+  static Error RunShellCommand(
+      const Args &args,
+      const FileSpec &working_dir, // Pass empty FileSpec to use the current
+                                   // working directory
+      int *status_ptr, // Pass NULL if you don't want the process exit status
+      int *signo_ptr,  // Pass NULL if you don't want the signal that caused the
+                       // process to exit
+      std::string
+          *command_output, // Pass NULL if you don't want the command output
+      uint32_t timeout_sec,
+      bool run_in_default_shell = true);
 
-    static const lldb::UnixSignalsSP &
-    GetUnixSignals();
+  static lldb::DataBufferSP GetAuxvData(lldb_private::Process *process);
 
-    static Error
-    LaunchProcess (ProcessLaunchInfo &launch_info);
+  static lldb::DataBufferSP GetAuxvData(lldb::pid_t pid);
 
-    //------------------------------------------------------------------
-    /// Perform expansion of the command-line for this launch info
-    /// This can potentially involve wildcard expansion
-    //  environment variable replacement, and whatever other
-    //  argument magic the platform defines as part of its typical
-    //  user experience
-    //------------------------------------------------------------------
-    static Error
-    ShellExpandArguments (ProcessLaunchInfo &launch_info);
-    
-    static Error
-    RunShellCommand(const char *command,           // Shouldn't be NULL
-                    const FileSpec &working_dir,   // Pass empty FileSpec to use the current working directory
-                    int *status_ptr,               // Pass NULL if you don't want the process exit status
-                    int *signo_ptr,                // Pass NULL if you don't want the signal that caused the process to exit
-                    std::string *command_output,   // Pass NULL if you don't want the command output
-                    uint32_t timeout_sec,
-                    bool run_in_default_shell = true);
-
-    static Error
-    RunShellCommand(const Args& args,
-                    const FileSpec &working_dir,   // Pass empty FileSpec to use the current working directory
-                    int *status_ptr,               // Pass NULL if you don't want the process exit status
-                    int *signo_ptr,                // Pass NULL if you don't want the signal that caused the process to exit
-                    std::string *command_output,   // Pass NULL if you don't want the command output
-                    uint32_t timeout_sec,
-                    bool run_in_default_shell = true);
-    
-    static lldb::DataBufferSP
-    GetAuxvData (lldb_private::Process *process);
-
-    static lldb::DataBufferSP
-    GetAuxvData (lldb::pid_t pid);
-
-    static bool
-    OpenFileInExternalEditor (const FileSpec &file_spec, 
-                              uint32_t line_no);
+  static bool OpenFileInExternalEditor(const FileSpec &file_spec,
+                                       uint32_t line_no);
 
-    static size_t
-    GetEnvironment (StringList &env);
+  static size_t GetEnvironment(StringList &env);
 };
 
 } // namespace lldb_private
 
-#endif  // #if defined(__cplusplus)
-#endif  // liblldb_Host_h_
+#endif // #if defined(__cplusplus)
+#endif // liblldb_Host_h_

Modified: lldb/trunk/include/lldb/Host/HostGetOpt.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostGetOpt.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostGetOpt.h (original)
+++ lldb/trunk/include/lldb/Host/HostGetOpt.h Tue Sep  6 15:57:50 2016
@@ -14,8 +14,8 @@
 #define _BSD_SOURCE // Required so that getopt.h defines optreset
 #endif
 
-#include <unistd.h>
 #include <getopt.h>
+#include <unistd.h>
 
 #else
 

Modified: lldb/trunk/include/lldb/Host/HostInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostInfo.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostInfo.h (original)
+++ lldb/trunk/include/lldb/Host/HostInfo.h Tue Sep  6 15:57:50 2016
@@ -59,8 +59,7 @@
 #define HOST_INFO_TYPE HostInfoPosix
 #endif
 
-namespace lldb_private
-{
+namespace lldb_private {
 typedef HOST_INFO_TYPE HostInfo;
 }
 

Modified: lldb/trunk/include/lldb/Host/HostInfoBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostInfoBase.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostInfoBase.h (original)
+++ lldb/trunk/include/lldb/Host/HostInfoBase.h Tue Sep  6 15:57:50 2016
@@ -20,112 +20,113 @@
 
 #include <string>
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class FileSpec;
 
-class HostInfoBase
-{
-  private:
-    // Static class, unconstructable.
-    HostInfoBase() {}
-    ~HostInfoBase() {}
-
-  public:
-    static void Initialize();
-    static void
-    Terminate();
-
-    //------------------------------------------------------------------
-    /// Returns the number of CPUs on this current host.
-    ///
-    /// @return
-    ///     Number of CPUs on this current host, or zero if the number
-    ///     of CPUs can't be determined on this host.
-    //------------------------------------------------------------------
-    static uint32_t GetNumberCPUS();
-
-    //------------------------------------------------------------------
-    /// Returns the maximum length of a thread name on this platform.
-    ///
-    /// @return
-    ///     Maximum length of a thread name on this platform.
-    //------------------------------------------------------------------
-    static uint32_t GetMaxThreadNameLength();
-
-    //------------------------------------------------------------------
-    /// Gets the host vendor string.
-    ///
-    /// @return
-    ///     A const string object containing the host vendor name.
-    //------------------------------------------------------------------
-    static llvm::StringRef GetVendorString();
-
-    //------------------------------------------------------------------
-    /// Gets the host Operating System (OS) string.
-    ///
-    /// @return
-    ///     A const string object containing the host OS name.
-    //------------------------------------------------------------------
-    static llvm::StringRef GetOSString();
-
-    //------------------------------------------------------------------
-    /// Gets the host target triple as a const string.
-    ///
-    /// @return
-    ///     A const string object containing the host target triple.
-    //------------------------------------------------------------------
-    static llvm::StringRef GetTargetTriple();
-
-    //------------------------------------------------------------------
-    /// Gets the host architecture.
-    ///
-    /// @return
-    ///     A const architecture object that represents the host
-    ///     architecture.
-    //------------------------------------------------------------------
-    enum ArchitectureKind
-    {
-        eArchKindDefault, // The overall default architecture that applications will run on this host
-        eArchKind32,      // If this host supports 32 bit programs, return the default 32 bit arch
-        eArchKind64       // If this host supports 64 bit programs, return the default 64 bit arch
-    };
-
-    static const ArchSpec &GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
-
-    //------------------------------------------------------------------
-    /// Find a resource files that are related to LLDB.
-    ///
-    /// Operating systems have different ways of storing shared
-    /// libraries and related resources. This function abstracts the
-    /// access to these paths.
-    ///
-    /// @param[in] path_type
-    ///     The type of LLDB resource path you are looking for. If the
-    ///     enumeration ends with "Dir", then only the \a file_spec's
-    ///     directory member gets filled in.
-    ///
-    /// @param[in] file_spec
-    ///     A file spec that gets filled in with the appropriate path.
-    ///
-    /// @return
-    ///     \b true if \a resource_path was resolved, \a false otherwise.
-    //------------------------------------------------------------------
-    static bool GetLLDBPath(lldb::PathType type, FileSpec &file_spec);
-
-  protected:
-    static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
-    static bool ComputeSupportExeDirectory(FileSpec &file_spec);
-    static bool ComputeProcessTempFileDirectory(FileSpec &file_spec);
-    static bool ComputeGlobalTempFileDirectory(FileSpec &file_spec);
-    static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
-    static bool ComputeHeaderDirectory(FileSpec &file_spec);
-    static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
-    static bool ComputeClangDirectory(FileSpec &file_spec);
-    static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
+class HostInfoBase {
+private:
+  // Static class, unconstructable.
+  HostInfoBase() {}
+  ~HostInfoBase() {}
+
+public:
+  static void Initialize();
+  static void Terminate();
+
+  //------------------------------------------------------------------
+  /// Returns the number of CPUs on this current host.
+  ///
+  /// @return
+  ///     Number of CPUs on this current host, or zero if the number
+  ///     of CPUs can't be determined on this host.
+  //------------------------------------------------------------------
+  static uint32_t GetNumberCPUS();
+
+  //------------------------------------------------------------------
+  /// Returns the maximum length of a thread name on this platform.
+  ///
+  /// @return
+  ///     Maximum length of a thread name on this platform.
+  //------------------------------------------------------------------
+  static uint32_t GetMaxThreadNameLength();
+
+  //------------------------------------------------------------------
+  /// Gets the host vendor string.
+  ///
+  /// @return
+  ///     A const string object containing the host vendor name.
+  //------------------------------------------------------------------
+  static llvm::StringRef GetVendorString();
+
+  //------------------------------------------------------------------
+  /// Gets the host Operating System (OS) string.
+  ///
+  /// @return
+  ///     A const string object containing the host OS name.
+  //------------------------------------------------------------------
+  static llvm::StringRef GetOSString();
+
+  //------------------------------------------------------------------
+  /// Gets the host target triple as a const string.
+  ///
+  /// @return
+  ///     A const string object containing the host target triple.
+  //------------------------------------------------------------------
+  static llvm::StringRef GetTargetTriple();
+
+  //------------------------------------------------------------------
+  /// Gets the host architecture.
+  ///
+  /// @return
+  ///     A const architecture object that represents the host
+  ///     architecture.
+  //------------------------------------------------------------------
+  enum ArchitectureKind {
+    eArchKindDefault, // The overall default architecture that applications will
+                      // run on this host
+    eArchKind32, // If this host supports 32 bit programs, return the default 32
+                 // bit arch
+    eArchKind64  // If this host supports 64 bit programs, return the default 64
+                 // bit arch
+  };
+
+  static const ArchSpec &
+  GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
+
+  //------------------------------------------------------------------
+  /// Find a resource files that are related to LLDB.
+  ///
+  /// Operating systems have different ways of storing shared
+  /// libraries and related resources. This function abstracts the
+  /// access to these paths.
+  ///
+  /// @param[in] path_type
+  ///     The type of LLDB resource path you are looking for. If the
+  ///     enumeration ends with "Dir", then only the \a file_spec's
+  ///     directory member gets filled in.
+  ///
+  /// @param[in] file_spec
+  ///     A file spec that gets filled in with the appropriate path.
+  ///
+  /// @return
+  ///     \b true if \a resource_path was resolved, \a false otherwise.
+  //------------------------------------------------------------------
+  static bool GetLLDBPath(lldb::PathType type, FileSpec &file_spec);
+
+protected:
+  static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
+  static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+  static bool ComputeProcessTempFileDirectory(FileSpec &file_spec);
+  static bool ComputeGlobalTempFileDirectory(FileSpec &file_spec);
+  static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
+  static bool ComputeHeaderDirectory(FileSpec &file_spec);
+  static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
+  static bool ComputeClangDirectory(FileSpec &file_spec);
+  static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
 
-    static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);
+  static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
+                                             ArchSpec &arch_64);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/HostNativeProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostNativeProcess.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostNativeProcess.h (original)
+++ lldb/trunk/include/lldb/Host/HostNativeProcess.h Tue Sep  6 15:57:50 2016
@@ -12,14 +12,12 @@
 
 #if defined(_WIN32)
 #include "lldb/Host/windows/HostProcessWindows.h"
-namespace lldb_private
-{
+namespace lldb_private {
 typedef HostProcessWindows HostNativeProcess;
 }
 #else
 #include "lldb/Host/posix/HostProcessPosix.h"
-namespace lldb_private
-{
+namespace lldb_private {
 typedef HostProcessPosix HostNativeProcess;
 }
 #endif

Modified: lldb/trunk/include/lldb/Host/HostNativeProcessBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostNativeProcessBase.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostNativeProcessBase.h (original)
+++ lldb/trunk/include/lldb/Host/HostNativeProcessBase.h Tue Sep  6 15:57:50 2016
@@ -15,44 +15,34 @@
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-types.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class HostThread;
 
-class HostNativeProcessBase
-{
-    DISALLOW_COPY_AND_ASSIGN(HostNativeProcessBase);
-
-  public:
-    HostNativeProcessBase()
-        : m_process(LLDB_INVALID_PROCESS)
-    {
-    }
-    explicit HostNativeProcessBase(lldb::process_t process)
-        : m_process(process)
-    {}
-    virtual ~HostNativeProcessBase() {}
-
-    virtual Error Terminate() = 0;
-    virtual Error GetMainModule(FileSpec &file_spec) const = 0;
-
-    virtual lldb::pid_t GetProcessId() const = 0;
-    virtual bool IsRunning() const = 0;
-
-    lldb::process_t
-    GetSystemHandle() const
-    {
-        return m_process;
-    }
+class HostNativeProcessBase {
+  DISALLOW_COPY_AND_ASSIGN(HostNativeProcessBase);
 
-    virtual HostThread
-    StartMonitoring(const Host::MonitorChildProcessCallback &callback, bool monitor_signals) = 0;
+public:
+  HostNativeProcessBase() : m_process(LLDB_INVALID_PROCESS) {}
+  explicit HostNativeProcessBase(lldb::process_t process)
+      : m_process(process) {}
+  virtual ~HostNativeProcessBase() {}
+
+  virtual Error Terminate() = 0;
+  virtual Error GetMainModule(FileSpec &file_spec) const = 0;
+
+  virtual lldb::pid_t GetProcessId() const = 0;
+  virtual bool IsRunning() const = 0;
+
+  lldb::process_t GetSystemHandle() const { return m_process; }
+
+  virtual HostThread
+  StartMonitoring(const Host::MonitorChildProcessCallback &callback,
+                  bool monitor_signals) = 0;
 
 protected:
-    lldb::process_t m_process;
+  lldb::process_t m_process;
 };
-
 }
 
 #endif

Modified: lldb/trunk/include/lldb/Host/HostNativeThreadBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostNativeThreadBase.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostNativeThreadBase.h (original)
+++ lldb/trunk/include/lldb/Host/HostNativeThreadBase.h Tue Sep  6 15:57:50 2016
@@ -14,8 +14,7 @@
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-types.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 #if defined(_WIN32)
 #define THREAD_ROUTINE __stdcall
@@ -23,30 +22,30 @@ namespace lldb_private
 #define THREAD_ROUTINE
 #endif
 
-class HostNativeThreadBase
-{
-    friend class ThreadLauncher;
-    DISALLOW_COPY_AND_ASSIGN(HostNativeThreadBase);
-
-  public:
-    HostNativeThreadBase();
-    explicit HostNativeThreadBase(lldb::thread_t thread);
-    virtual ~HostNativeThreadBase() {}
-
-    virtual Error Join(lldb::thread_result_t *result) = 0;
-    virtual Error Cancel() = 0;
-    virtual bool IsJoinable() const;
-    virtual void Reset();
-    lldb::thread_t Release();
+class HostNativeThreadBase {
+  friend class ThreadLauncher;
+  DISALLOW_COPY_AND_ASSIGN(HostNativeThreadBase);
+
+public:
+  HostNativeThreadBase();
+  explicit HostNativeThreadBase(lldb::thread_t thread);
+  virtual ~HostNativeThreadBase() {}
+
+  virtual Error Join(lldb::thread_result_t *result) = 0;
+  virtual Error Cancel() = 0;
+  virtual bool IsJoinable() const;
+  virtual void Reset();
+  lldb::thread_t Release();
+
+  lldb::thread_t GetSystemHandle() const;
+  lldb::thread_result_t GetResult() const;
+
+protected:
+  static lldb::thread_result_t THREAD_ROUTINE
+  ThreadCreateTrampoline(lldb::thread_arg_t arg);
 
-    lldb::thread_t GetSystemHandle() const;
-    lldb::thread_result_t GetResult() const;
-
-  protected:
-    static lldb::thread_result_t THREAD_ROUTINE ThreadCreateTrampoline(lldb::thread_arg_t arg);
-
-    lldb::thread_t m_thread;
-    lldb::thread_result_t m_result;
+  lldb::thread_t m_thread;
+  lldb::thread_result_t m_result;
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/HostNativeThreadForward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostNativeThreadForward.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostNativeThreadForward.h (original)
+++ lldb/trunk/include/lldb/Host/HostNativeThreadForward.h Tue Sep  6 15:57:50 2016
@@ -10,8 +10,7 @@
 #ifndef lldb_Host_HostNativeThreadForward_h_
 #define lldb_Host_HostNativeThreadForward_h_
 
-namespace lldb_private
-{
+namespace lldb_private {
 #if defined(_WIN32)
 class HostThreadWindows;
 typedef HostThreadWindows HostNativeThread;

Modified: lldb/trunk/include/lldb/Host/HostProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostProcess.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostProcess.h (original)
+++ lldb/trunk/include/lldb/Host/HostProcess.h Tue Sep  6 15:57:50 2016
@@ -29,35 +29,32 @@
 ///
 //----------------------------------------------------------------------
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class HostNativeProcessBase;
 class HostThread;
 
-class HostProcess
-{
+class HostProcess {
 public:
-    HostProcess();
-    HostProcess(lldb::process_t process);
-    ~HostProcess();
+  HostProcess();
+  HostProcess(lldb::process_t process);
+  ~HostProcess();
 
-    Error Terminate();
-    Error GetMainModule(FileSpec &file_spec) const;
+  Error Terminate();
+  Error GetMainModule(FileSpec &file_spec) const;
 
-    lldb::pid_t GetProcessId() const;
-    bool IsRunning() const;
+  lldb::pid_t GetProcessId() const;
+  bool IsRunning() const;
 
-    HostThread
-    StartMonitoring(const Host::MonitorChildProcessCallback &callback, bool monitor_signals);
+  HostThread StartMonitoring(const Host::MonitorChildProcessCallback &callback,
+                             bool monitor_signals);
 
-    HostNativeProcessBase &GetNativeProcess();
-    const HostNativeProcessBase &GetNativeProcess() const;
+  HostNativeProcessBase &GetNativeProcess();
+  const HostNativeProcessBase &GetNativeProcess() const;
 
-  private:
-    std::shared_ptr<HostNativeProcessBase> m_native_process;
+private:
+  std::shared_ptr<HostNativeProcessBase> m_native_process;
 };
-
 }
 
 #endif

Modified: lldb/trunk/include/lldb/Host/HostThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostThread.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/HostThread.h (original)
+++ lldb/trunk/include/lldb/Host/HostThread.h Tue Sep  6 15:57:50 2016
@@ -16,8 +16,7 @@
 
 #include <memory>
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class HostNativeThreadBase;
 
@@ -30,26 +29,25 @@ class HostNativeThreadBase;
 /// machine.
 ///
 //----------------------------------------------------------------------
-class HostThread
-{
-  public:
-    HostThread();
-    HostThread(lldb::thread_t thread);
-
-    Error Join(lldb::thread_result_t *result);
-    Error Cancel();
-    void Reset();
-    lldb::thread_t Release();
-
-    bool IsJoinable() const;
-    HostNativeThread &GetNativeThread();
-    const HostNativeThread &GetNativeThread() const;
-    lldb::thread_result_t GetResult() const;
+class HostThread {
+public:
+  HostThread();
+  HostThread(lldb::thread_t thread);
+
+  Error Join(lldb::thread_result_t *result);
+  Error Cancel();
+  void Reset();
+  lldb::thread_t Release();
+
+  bool IsJoinable() const;
+  HostNativeThread &GetNativeThread();
+  const HostNativeThread &GetNativeThread() const;
+  lldb::thread_result_t GetResult() const;
 
-    bool EqualsThread(lldb::thread_t thread) const;
+  bool EqualsThread(lldb::thread_t thread) const;
 
-  private:
-    std::shared_ptr<HostNativeThreadBase> m_native_thread;
+private:
+  std::shared_ptr<HostNativeThreadBase> m_native_thread;
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/IOObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/IOObject.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/IOObject.h (original)
+++ lldb/trunk/include/lldb/Host/IOObject.h Tue Sep  6 15:57:50 2016
@@ -18,44 +18,39 @@
 
 namespace lldb_private {
 
-class IOObject
-{
+class IOObject {
 public:
-    typedef enum
-    {
-        eFDTypeFile,        // Other FD requiring read/write
-        eFDTypeSocket,      // Socket requiring send/recv
-    } FDType;
-
-    // TODO: On Windows this should be a HANDLE, and wait should use
-    // WaitForMultipleObjects
-    typedef int WaitableHandle;
-    static const WaitableHandle kInvalidHandleValue;
-
-    IOObject(FDType type, bool should_close)
-        : m_fd_type(type)
-        , m_should_close_fd(should_close)
-    {
-    }
-    virtual ~IOObject() {}
-
-    virtual Error Read (void *buf, size_t &num_bytes) = 0;
-    virtual Error Write (const void *buf, size_t &num_bytes) = 0;
-    virtual bool IsValid() const = 0;
-    virtual Error Close() = 0;
+  typedef enum {
+    eFDTypeFile,   // Other FD requiring read/write
+    eFDTypeSocket, // Socket requiring send/recv
+  } FDType;
+
+  // TODO: On Windows this should be a HANDLE, and wait should use
+  // WaitForMultipleObjects
+  typedef int WaitableHandle;
+  static const WaitableHandle kInvalidHandleValue;
+
+  IOObject(FDType type, bool should_close)
+      : m_fd_type(type), m_should_close_fd(should_close) {}
+  virtual ~IOObject() {}
+
+  virtual Error Read(void *buf, size_t &num_bytes) = 0;
+  virtual Error Write(const void *buf, size_t &num_bytes) = 0;
+  virtual bool IsValid() const = 0;
+  virtual Error Close() = 0;
 
-    FDType GetFdType() const { return m_fd_type; }
+  FDType GetFdType() const { return m_fd_type; }
 
-    virtual WaitableHandle GetWaitableHandle() = 0;
+  virtual WaitableHandle GetWaitableHandle() = 0;
 
 protected:
-    FDType m_fd_type;
-    bool m_should_close_fd; // True if this class should close the file descriptor when it goes away.
+  FDType m_fd_type;
+  bool m_should_close_fd; // True if this class should close the file descriptor
+                          // when it goes away.
 
 private:
-    DISALLOW_COPY_AND_ASSIGN (IOObject);
+  DISALLOW_COPY_AND_ASSIGN(IOObject);
 };
-
 }
 
 #endif

Modified: lldb/trunk/include/lldb/Host/LockFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/LockFile.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/LockFile.h (original)
+++ lldb/trunk/include/lldb/Host/LockFile.h Tue Sep  6 15:57:50 2016
@@ -12,14 +12,12 @@
 
 #if defined(_WIN32)
 #include "lldb/Host/windows/LockFileWindows.h"
-namespace lldb_private
-{
+namespace lldb_private {
 typedef LockFileWindows LockFile;
 }
 #else
 #include "lldb/Host/posix/LockFilePosix.h"
-namespace lldb_private
-{
+namespace lldb_private {
 typedef LockFilePosix LockFile;
 }
 #endif

Modified: lldb/trunk/include/lldb/Host/LockFileBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/LockFileBase.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/LockFileBase.h (original)
+++ lldb/trunk/include/lldb/Host/LockFileBase.h Tue Sep  6 15:57:50 2016
@@ -14,60 +14,44 @@
 
 #include <functional>
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class LockFileBase
-{
+class LockFileBase {
 public:
-    virtual ~LockFileBase () = default;
+  virtual ~LockFileBase() = default;
 
-    bool
-    IsLocked () const;
+  bool IsLocked() const;
 
-    Error
-    WriteLock (const uint64_t start, const uint64_t len);
-    Error
-    TryWriteLock (const uint64_t start, const uint64_t len);
-
-    Error
-    ReadLock (const uint64_t start, const uint64_t len);
-    Error
-    TryReadLock (const uint64_t start, const uint64_t len);
+  Error WriteLock(const uint64_t start, const uint64_t len);
+  Error TryWriteLock(const uint64_t start, const uint64_t len);
 
-    Error
-    Unlock ();
+  Error ReadLock(const uint64_t start, const uint64_t len);
+  Error TryReadLock(const uint64_t start, const uint64_t len);
+
+  Error Unlock();
 
 protected:
-    using Locker = std::function<Error (const uint64_t, const uint64_t)>;
+  using Locker = std::function<Error(const uint64_t, const uint64_t)>;
 
-    LockFileBase (int fd);
+  LockFileBase(int fd);
 
-    virtual bool
-    IsValidFile () const;
+  virtual bool IsValidFile() const;
 
-    virtual Error
-    DoWriteLock (const uint64_t start, const uint64_t len) = 0;
-    virtual Error
-    DoTryWriteLock (const uint64_t start, const uint64_t len) = 0;
+  virtual Error DoWriteLock(const uint64_t start, const uint64_t len) = 0;
+  virtual Error DoTryWriteLock(const uint64_t start, const uint64_t len) = 0;
 
-    virtual Error
-    DoReadLock (const uint64_t start, const uint64_t len) = 0;
-    virtual Error
-    DoTryReadLock (const uint64_t start, const uint64_t len) = 0;
+  virtual Error DoReadLock(const uint64_t start, const uint64_t len) = 0;
+  virtual Error DoTryReadLock(const uint64_t start, const uint64_t len) = 0;
 
-    virtual Error
-    DoUnlock () = 0;
+  virtual Error DoUnlock() = 0;
 
-    Error
-    DoLock (const Locker &locker, const uint64_t start, const uint64_t len);
+  Error DoLock(const Locker &locker, const uint64_t start, const uint64_t len);
 
-    int m_fd;  // not owned.
-    bool m_locked;
-    uint64_t m_start;
-    uint64_t m_len;
+  int m_fd; // not owned.
+  bool m_locked;
+  uint64_t m_start;
+  uint64_t m_len;
 };
-
 }
 
 #endif

Modified: lldb/trunk/include/lldb/Host/MainLoop.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/MainLoop.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/MainLoop.h (original)
+++ lldb/trunk/include/lldb/Host/MainLoop.h Tue Sep  6 15:57:50 2016
@@ -12,14 +12,12 @@
 
 #ifdef _WIN32
 #include "lldb/Host/MainLoopBase.h"
-namespace lldb_private
-{
+namespace lldb_private {
 typedef MainLoopBase MainLoop;
 }
 #else
 #include "lldb/Host/posix/MainLoopPosix.h"
-namespace lldb_private
-{
+namespace lldb_private {
 typedef MainLoopPosix MainLoop;
 }
 #endif

Modified: lldb/trunk/include/lldb/Host/MainLoopBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/MainLoopBase.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/MainLoopBase.h (original)
+++ lldb/trunk/include/lldb/Host/MainLoopBase.h Tue Sep  6 15:57:50 2016
@@ -19,76 +19,77 @@
 
 namespace lldb_private {
 
-// The purpose of this class is to enable multiplexed processing of data from different sources
-// without resorting to multi-threading. Clients can register IOObjects, which will be monitored
-// for readability, and when they become ready, the specified callback will be invoked.
-// Monitoring for writability is not supported, but can be easily added if needed.
+// The purpose of this class is to enable multiplexed processing of data from
+// different sources
+// without resorting to multi-threading. Clients can register IOObjects, which
+// will be monitored
+// for readability, and when they become ready, the specified callback will be
+// invoked.
+// Monitoring for writability is not supported, but can be easily added if
+// needed.
 //
-// The RegisterReadObject function return a handle, which controls the duration of the monitoring. When
+// The RegisterReadObject function return a handle, which controls the duration
+// of the monitoring. When
 // this handle is destroyed, the callback is deregistered.
 //
-// This class simply defines the interface common for all platforms, actual implementations are
+// This class simply defines the interface common for all platforms, actual
+// implementations are
 // platform-specific.
-class MainLoopBase
-{
+class MainLoopBase {
 private:
-    class ReadHandle;
+  class ReadHandle;
 
 public:
-    MainLoopBase() { }
-    virtual ~MainLoopBase() { }
+  MainLoopBase() {}
+  virtual ~MainLoopBase() {}
 
-    typedef std::unique_ptr<ReadHandle> ReadHandleUP;
+  typedef std::unique_ptr<ReadHandle> ReadHandleUP;
 
-    typedef std::function<void(MainLoopBase &)> Callback;
+  typedef std::function<void(MainLoopBase &)> Callback;
 
-    virtual ReadHandleUP
-    RegisterReadObject(const lldb::IOObjectSP &object_sp, const Callback &callback, Error &error)
-    { llvm_unreachable("Not implemented"); }
-
-    // Waits for registered events and invoke the proper callbacks. Returns when all callbacks
-    // deregister themselves or when someone requests termination.
-    virtual Error
-    Run()
-    { llvm_unreachable("Not implemented"); }
-
-    // Requests the exit of the Run() function.
-    virtual void
-    RequestTermination()
-    { llvm_unreachable("Not implemented"); }
+  virtual ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp,
+                                          const Callback &callback,
+                                          Error &error) {
+    llvm_unreachable("Not implemented");
+  }
+
+  // Waits for registered events and invoke the proper callbacks. Returns when
+  // all callbacks
+  // deregister themselves or when someone requests termination.
+  virtual Error Run() { llvm_unreachable("Not implemented"); }
+
+  // Requests the exit of the Run() function.
+  virtual void RequestTermination() { llvm_unreachable("Not implemented"); }
 
 protected:
-    ReadHandleUP
-    CreateReadHandle(const lldb::IOObjectSP &object_sp)
-    { return ReadHandleUP(new ReadHandle(*this, object_sp->GetWaitableHandle())); }
-
-    virtual void
-    UnregisterReadObject(IOObject::WaitableHandle handle)
-    { llvm_unreachable("Not implemented"); }
+  ReadHandleUP CreateReadHandle(const lldb::IOObjectSP &object_sp) {
+    return ReadHandleUP(new ReadHandle(*this, object_sp->GetWaitableHandle()));
+  }
+
+  virtual void UnregisterReadObject(IOObject::WaitableHandle handle) {
+    llvm_unreachable("Not implemented");
+  }
 
 private:
-    class ReadHandle
-    {
-    public:
-        ~ReadHandle() { m_mainloop.UnregisterReadObject(m_handle); }
-
-    private:
-        ReadHandle(MainLoopBase &mainloop, IOObject::WaitableHandle handle)
-            : m_mainloop(mainloop), m_handle(handle)
-        { }
-
-        MainLoopBase &m_mainloop;
-        IOObject::WaitableHandle m_handle;
-
-        friend class MainLoopBase;
-        DISALLOW_COPY_AND_ASSIGN(ReadHandle);
-    };
+  class ReadHandle {
+  public:
+    ~ReadHandle() { m_mainloop.UnregisterReadObject(m_handle); }
+
+  private:
+    ReadHandle(MainLoopBase &mainloop, IOObject::WaitableHandle handle)
+        : m_mainloop(mainloop), m_handle(handle) {}
+
+    MainLoopBase &m_mainloop;
+    IOObject::WaitableHandle m_handle;
+
+    friend class MainLoopBase;
+    DISALLOW_COPY_AND_ASSIGN(ReadHandle);
+  };
 
 private:
-    DISALLOW_COPY_AND_ASSIGN(MainLoopBase);
+  DISALLOW_COPY_AND_ASSIGN(MainLoopBase);
 };
 
 } // namespace lldb_private
 
-
 #endif // lldb_Host_posix_MainLoopBase_h_

Modified: lldb/trunk/include/lldb/Host/MonitoringProcessLauncher.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/MonitoringProcessLauncher.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/MonitoringProcessLauncher.h (original)
+++ lldb/trunk/include/lldb/Host/MonitoringProcessLauncher.h Tue Sep  6 15:57:50 2016
@@ -17,18 +17,18 @@
 // Project includes
 #include "lldb/Host/ProcessLauncher.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class MonitoringProcessLauncher : public ProcessLauncher
-{
-  public:
-    explicit MonitoringProcessLauncher(std::unique_ptr<ProcessLauncher> delegate_launcher);
+class MonitoringProcessLauncher : public ProcessLauncher {
+public:
+  explicit MonitoringProcessLauncher(
+      std::unique_ptr<ProcessLauncher> delegate_launcher);
 
-    HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error) override;
+  HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+                            Error &error) override;
 
-  private:
-    std::unique_ptr<ProcessLauncher> m_delegate_launcher;
+private:
+  std::unique_ptr<ProcessLauncher> m_delegate_launcher;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/OptionParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/OptionParser.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/OptionParser.h (original)
+++ lldb/trunk/include/lldb/Host/OptionParser.h Tue Sep  6 15:57:50 2016
@@ -19,41 +19,31 @@ namespace lldb_private {
 
 struct OptionDefinition;
 
-struct Option
-{
-    // The definition of the option that this refers to.
-    const OptionDefinition *definition;
-    // if not NULL, set *flag to val when option found
-    int *flag;
-    // if flag not NULL, value to set *flag to; else return value
-    int val;
+struct Option {
+  // The definition of the option that this refers to.
+  const OptionDefinition *definition;
+  // if not NULL, set *flag to val when option found
+  int *flag;
+  // if flag not NULL, value to set *flag to; else return value
+  int val;
 };
 
-class OptionParser
-{
+class OptionParser {
 public:
-    enum OptionArgument
-    {
-        eNoArgument = 0,
-        eRequiredArgument,
-        eOptionalArgument
-    };
-
-    static void
-    Prepare(std::unique_lock<std::mutex> &lock);
-
-    static void EnableError(bool error);
-
-    static int Parse(int argc, char * const argv [],
-        const char *optstring,
-        const Option *longopts, int *longindex);
-
-    static char* GetOptionArgument();
-    static int GetOptionIndex();
-    static int GetOptionErrorCause();
-    static std::string GetShortOptionString(struct option *long_options);
-};
+  enum OptionArgument { eNoArgument = 0, eRequiredArgument, eOptionalArgument };
+
+  static void Prepare(std::unique_lock<std::mutex> &lock);
+
+  static void EnableError(bool error);
 
+  static int Parse(int argc, char *const argv[], const char *optstring,
+                   const Option *longopts, int *longindex);
+
+  static char *GetOptionArgument();
+  static int GetOptionIndex();
+  static int GetOptionErrorCause();
+  static std::string GetShortOptionString(struct option *long_options);
+};
 }
 
-#endif  // liblldb_OptionParser_h_
+#endif // liblldb_OptionParser_h_

Modified: lldb/trunk/include/lldb/Host/Pipe.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Pipe.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Pipe.h (original)
+++ lldb/trunk/include/lldb/Host/Pipe.h Tue Sep  6 15:57:50 2016
@@ -12,14 +12,12 @@
 
 #if defined(_WIN32)
 #include "lldb/Host/windows/PipeWindows.h"
-namespace lldb_private
-{
+namespace lldb_private {
 typedef PipeWindows Pipe;
 }
 #else
 #include "lldb/Host/posix/PipePosix.h"
-namespace lldb_private
-{
+namespace lldb_private {
 typedef PipePosix Pipe;
 }
 #endif

Modified: lldb/trunk/include/lldb/Host/PipeBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/PipeBase.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/PipeBase.h (original)
+++ lldb/trunk/include/lldb/Host/PipeBase.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- PipeBase.h -----------------------------------------------*- C++ -*-===//
+//===-- PipeBase.h -----------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -17,41 +18,46 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 
-namespace lldb_private
-{
-class PipeBase
-{
-  public:
-    virtual ~PipeBase();
-
-    virtual Error CreateNew(bool child_process_inherit) = 0;
-    virtual Error CreateNew(llvm::StringRef name, bool child_process_inherit) = 0;
-    virtual Error CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl<char>& name) = 0;
-
-    virtual Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) = 0;
-
-    Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit);
-    virtual Error OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) = 0;
-
-    virtual bool CanRead() const = 0;
-    virtual bool CanWrite() const = 0;
-
-    virtual int GetReadFileDescriptor() const = 0;
-    virtual int GetWriteFileDescriptor() const = 0;
-    virtual int ReleaseReadFileDescriptor() = 0;
-    virtual int ReleaseWriteFileDescriptor() = 0;
-    virtual void CloseReadFileDescriptor() = 0;
-    virtual void CloseWriteFileDescriptor() = 0;
-
-    // Close both descriptors
-    virtual void Close() = 0;
-
-    // Delete named pipe.
-    virtual Error Delete(llvm::StringRef name) = 0;
-
-    virtual Error Write(const void *buf, size_t size, size_t &bytes_written) = 0;
-    virtual Error ReadWithTimeout(void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_read) = 0;
-    Error Read(void *buf, size_t size, size_t &bytes_read);
+namespace lldb_private {
+class PipeBase {
+public:
+  virtual ~PipeBase();
+
+  virtual Error CreateNew(bool child_process_inherit) = 0;
+  virtual Error CreateNew(llvm::StringRef name, bool child_process_inherit) = 0;
+  virtual Error CreateWithUniqueName(llvm::StringRef prefix,
+                                     bool child_process_inherit,
+                                     llvm::SmallVectorImpl<char> &name) = 0;
+
+  virtual Error OpenAsReader(llvm::StringRef name,
+                             bool child_process_inherit) = 0;
+
+  Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit);
+  virtual Error
+  OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit,
+                          const std::chrono::microseconds &timeout) = 0;
+
+  virtual bool CanRead() const = 0;
+  virtual bool CanWrite() const = 0;
+
+  virtual int GetReadFileDescriptor() const = 0;
+  virtual int GetWriteFileDescriptor() const = 0;
+  virtual int ReleaseReadFileDescriptor() = 0;
+  virtual int ReleaseWriteFileDescriptor() = 0;
+  virtual void CloseReadFileDescriptor() = 0;
+  virtual void CloseWriteFileDescriptor() = 0;
+
+  // Close both descriptors
+  virtual void Close() = 0;
+
+  // Delete named pipe.
+  virtual Error Delete(llvm::StringRef name) = 0;
+
+  virtual Error Write(const void *buf, size_t size, size_t &bytes_written) = 0;
+  virtual Error ReadWithTimeout(void *buf, size_t size,
+                                const std::chrono::microseconds &timeout,
+                                size_t &bytes_read) = 0;
+  Error Read(void *buf, size_t size, size_t &bytes_read);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/Predicate.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Predicate.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Predicate.h (original)
+++ lldb/trunk/include/lldb/Host/Predicate.h Tue Sep  6 15:57:50 2016
@@ -29,11 +29,11 @@
 //----------------------------------------------------------------------
 namespace lldb_private {
 
-typedef enum
-{
-    eBroadcastNever,    ///< No broadcast will be sent when the value is modified.
-    eBroadcastAlways,   ///< Always send a broadcast when the value is modified.
-    eBroadcastOnChange  ///< Only broadcast if the value changes when the value is modified.
+typedef enum {
+  eBroadcastNever,   ///< No broadcast will be sent when the value is modified.
+  eBroadcastAlways,  ///< Always send a broadcast when the value is modified.
+  eBroadcastOnChange ///< Only broadcast if the value changes when the value is
+                     ///modified.
 } PredicateBroadcastType;
 
 //----------------------------------------------------------------------
@@ -46,516 +46,477 @@ typedef enum
 /// or reset, or wait for T to be set to be equal/not equal to a
 /// specified values.
 //----------------------------------------------------------------------
-template <class T>
-class Predicate
-{
+template <class T> class Predicate {
 public:
-    //------------------------------------------------------------------
-    /// Default constructor.
-    ///
-    /// Initializes the mutex, condition and value with their default
-    /// constructors.
-    //------------------------------------------------------------------
-    Predicate () :
-        m_value(),
-        m_mutex(),
-        m_condition()
-    {
-    }
-
-    //------------------------------------------------------------------
-    /// Construct with initial T value \a initial_value.
-    ///
-    /// Initializes the mutex and condition with their default
-    /// constructors, and initializes the value with \a initial_value.
-    ///
-    /// @param[in] initial_value
-    ///     The initial value for our T object.
-    //------------------------------------------------------------------
-    Predicate (T initial_value)  :
-        m_value(initial_value),
-        m_mutex(),
-        m_condition()
-    {
-    }
-
-    //------------------------------------------------------------------
-    /// Destructor.
-    ///
-    /// Destroy the condition, mutex, and T objects.
-    //------------------------------------------------------------------
-    ~Predicate() = default;
-
-    //------------------------------------------------------------------
-    /// Value get accessor.
-    ///
-    /// Copies the current \a m_value in a thread safe manor and returns
-    /// the copied value.
-    ///
-    /// @return
-    ///     A copy of the current value.
-    //------------------------------------------------------------------
-    T
-    GetValue () const
-    {
-        std::lock_guard<std::mutex> guard(m_mutex);
-        T value = m_value;
-        return value;
-    }
-
-    //------------------------------------------------------------------
-    /// Value set accessor.
-    ///
-    /// Set the contained \a m_value to \a new_value in a thread safe
-    /// way and broadcast if needed.
-    ///
-    /// @param[in] value
-    ///     The new value to set.
-    ///
-    /// @param[in] broadcast_type
-    ///     A value indicating when and if to broadcast. See the
-    ///     PredicateBroadcastType enumeration for details.
-    ///
-    /// @see Predicate::Broadcast()
-    //------------------------------------------------------------------
-    void
-    SetValue (T value, PredicateBroadcastType broadcast_type)
-    {
-        std::lock_guard<std::mutex> guard(m_mutex);
-#ifdef DB_PTHREAD_LOG_EVENTS
-        printf("%s (value = 0x%8.8x, broadcast_type = %i)\n", __FUNCTION__, value, broadcast_type);
-#endif
-        const T old_value = m_value;
-        m_value = value;
-
-        Broadcast(old_value, broadcast_type);
-    }
-
-    //------------------------------------------------------------------
-    /// Set some bits in \a m_value.
-    ///
-    /// Logically set the bits \a bits in the contained \a m_value in a
-    /// thread safe way and broadcast if needed.
-    ///
-    /// @param[in] bits
-    ///     The bits to set in \a m_value.
-    ///
-    /// @param[in] broadcast_type
-    ///     A value indicating when and if to broadcast. See the
-    ///     PredicateBroadcastType enumeration for details.
-    ///
-    /// @see Predicate::Broadcast()
-    //------------------------------------------------------------------
-    void
-    SetValueBits (T bits, PredicateBroadcastType broadcast_type)
-    {
-        std::lock_guard<std::mutex> guard(m_mutex);
-#ifdef DB_PTHREAD_LOG_EVENTS
-        printf("%s (bits = 0x%8.8x, broadcast_type = %i)\n", __FUNCTION__, bits, broadcast_type);
-#endif
-        const T old_value = m_value;
-        m_value |= bits;
-
-        Broadcast(old_value, broadcast_type);
-    }
-
-    //------------------------------------------------------------------
-    /// Reset some bits in \a m_value.
-    ///
-    /// Logically reset (clear) the bits \a bits in the contained
-    /// \a m_value in a thread safe way and broadcast if needed.
-    ///
-    /// @param[in] bits
-    ///     The bits to clear in \a m_value.
-    ///
-    /// @param[in] broadcast_type
-    ///     A value indicating when and if to broadcast. See the
-    ///     PredicateBroadcastType enumeration for details.
-    ///
-    /// @see Predicate::Broadcast()
-    //------------------------------------------------------------------
-    void
-    ResetValueBits (T bits, PredicateBroadcastType broadcast_type)
-    {
-        std::lock_guard<std::mutex> guard(m_mutex);
-#ifdef DB_PTHREAD_LOG_EVENTS
-        printf("%s (bits = 0x%8.8x, broadcast_type = %i)\n", __FUNCTION__, bits, broadcast_type);
-#endif
-        const T old_value = m_value;
-        m_value &= ~bits;
-
-        Broadcast(old_value, broadcast_type);
-    }
-
-    //------------------------------------------------------------------
-    /// Wait for bits to be set in \a m_value.
-    ///
-    /// Waits in a thread safe way for any bits in \a bits to get
-    /// logically set in \a m_value. If any bits are already set in
-    /// \a m_value, this function will return without waiting.
-    ///
-    /// It is possible for the value to be changed between the time
-    /// the bits are set and the time the waiting thread wakes up.
-    /// If the bits are no longer set when the waiting thread wakes
-    /// up, it will go back into a wait state.  It may be necessary
-    /// for the calling code to use additional thread synchronization
-    /// methods to detect transitory states.
-    ///
-    /// @param[in] bits
-    ///     The bits we are waiting to be set in \a m_value.
-    ///
-    /// @param[in] abstime
-    ///     If non-nullptr, the absolute time at which we should stop
-    ///     waiting, else wait an infinite amount of time.
-    ///
-    /// @return
-    ///     Any bits of the requested bits that actually were set within
-    ///     the time specified. Zero if a timeout or unrecoverable error
-    ///     occurred.
-    //------------------------------------------------------------------
-    T
-    WaitForSetValueBits(T bits, const std::chrono::microseconds &timeout = std::chrono::microseconds(0))
-    {
-        // pthread_cond_timedwait() or pthread_cond_wait() will atomically
-        // unlock the mutex and wait for the condition to be set. When either
-        // function returns, they will re-lock the mutex. We use an auto lock/unlock
-        // class (std::lock_guard) to allow us to return at any point in this
-        // function and not have to worry about unlocking the mutex.
-        std::unique_lock<std::mutex> lock(m_mutex);
-#ifdef DB_PTHREAD_LOG_EVENTS
-        printf("%s (bits = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", __FUNCTION__, bits, timeout.count(),
-               m_value);
-#endif
-        while ((m_value & bits) == 0)
-        {
-            if (timeout == std::chrono::microseconds(0))
-            {
-                m_condition.wait(lock);
-            }
-            else
-            {
-                std::cv_status result = m_condition.wait_for(lock, timeout);
-                if (result == std::cv_status::timeout)
-                    break;
-            }
+  //------------------------------------------------------------------
+  /// Default constructor.
+  ///
+  /// Initializes the mutex, condition and value with their default
+  /// constructors.
+  //------------------------------------------------------------------
+  Predicate() : m_value(), m_mutex(), m_condition() {}
+
+  //------------------------------------------------------------------
+  /// Construct with initial T value \a initial_value.
+  ///
+  /// Initializes the mutex and condition with their default
+  /// constructors, and initializes the value with \a initial_value.
+  ///
+  /// @param[in] initial_value
+  ///     The initial value for our T object.
+  //------------------------------------------------------------------
+  Predicate(T initial_value)
+      : m_value(initial_value), m_mutex(), m_condition() {}
+
+  //------------------------------------------------------------------
+  /// Destructor.
+  ///
+  /// Destroy the condition, mutex, and T objects.
+  //------------------------------------------------------------------
+  ~Predicate() = default;
+
+  //------------------------------------------------------------------
+  /// Value get accessor.
+  ///
+  /// Copies the current \a m_value in a thread safe manor and returns
+  /// the copied value.
+  ///
+  /// @return
+  ///     A copy of the current value.
+  //------------------------------------------------------------------
+  T GetValue() const {
+    std::lock_guard<std::mutex> guard(m_mutex);
+    T value = m_value;
+    return value;
+  }
+
+  //------------------------------------------------------------------
+  /// Value set accessor.
+  ///
+  /// Set the contained \a m_value to \a new_value in a thread safe
+  /// way and broadcast if needed.
+  ///
+  /// @param[in] value
+  ///     The new value to set.
+  ///
+  /// @param[in] broadcast_type
+  ///     A value indicating when and if to broadcast. See the
+  ///     PredicateBroadcastType enumeration for details.
+  ///
+  /// @see Predicate::Broadcast()
+  //------------------------------------------------------------------
+  void SetValue(T value, PredicateBroadcastType broadcast_type) {
+    std::lock_guard<std::mutex> guard(m_mutex);
+#ifdef DB_PTHREAD_LOG_EVENTS
+    printf("%s (value = 0x%8.8x, broadcast_type = %i)\n", __FUNCTION__, value,
+           broadcast_type);
+#endif
+    const T old_value = m_value;
+    m_value = value;
+
+    Broadcast(old_value, broadcast_type);
+  }
+
+  //------------------------------------------------------------------
+  /// Set some bits in \a m_value.
+  ///
+  /// Logically set the bits \a bits in the contained \a m_value in a
+  /// thread safe way and broadcast if needed.
+  ///
+  /// @param[in] bits
+  ///     The bits to set in \a m_value.
+  ///
+  /// @param[in] broadcast_type
+  ///     A value indicating when and if to broadcast. See the
+  ///     PredicateBroadcastType enumeration for details.
+  ///
+  /// @see Predicate::Broadcast()
+  //------------------------------------------------------------------
+  void SetValueBits(T bits, PredicateBroadcastType broadcast_type) {
+    std::lock_guard<std::mutex> guard(m_mutex);
+#ifdef DB_PTHREAD_LOG_EVENTS
+    printf("%s (bits = 0x%8.8x, broadcast_type = %i)\n", __FUNCTION__, bits,
+           broadcast_type);
+#endif
+    const T old_value = m_value;
+    m_value |= bits;
+
+    Broadcast(old_value, broadcast_type);
+  }
+
+  //------------------------------------------------------------------
+  /// Reset some bits in \a m_value.
+  ///
+  /// Logically reset (clear) the bits \a bits in the contained
+  /// \a m_value in a thread safe way and broadcast if needed.
+  ///
+  /// @param[in] bits
+  ///     The bits to clear in \a m_value.
+  ///
+  /// @param[in] broadcast_type
+  ///     A value indicating when and if to broadcast. See the
+  ///     PredicateBroadcastType enumeration for details.
+  ///
+  /// @see Predicate::Broadcast()
+  //------------------------------------------------------------------
+  void ResetValueBits(T bits, PredicateBroadcastType broadcast_type) {
+    std::lock_guard<std::mutex> guard(m_mutex);
+#ifdef DB_PTHREAD_LOG_EVENTS
+    printf("%s (bits = 0x%8.8x, broadcast_type = %i)\n", __FUNCTION__, bits,
+           broadcast_type);
+#endif
+    const T old_value = m_value;
+    m_value &= ~bits;
+
+    Broadcast(old_value, broadcast_type);
+  }
+
+  //------------------------------------------------------------------
+  /// Wait for bits to be set in \a m_value.
+  ///
+  /// Waits in a thread safe way for any bits in \a bits to get
+  /// logically set in \a m_value. If any bits are already set in
+  /// \a m_value, this function will return without waiting.
+  ///
+  /// It is possible for the value to be changed between the time
+  /// the bits are set and the time the waiting thread wakes up.
+  /// If the bits are no longer set when the waiting thread wakes
+  /// up, it will go back into a wait state.  It may be necessary
+  /// for the calling code to use additional thread synchronization
+  /// methods to detect transitory states.
+  ///
+  /// @param[in] bits
+  ///     The bits we are waiting to be set in \a m_value.
+  ///
+  /// @param[in] abstime
+  ///     If non-nullptr, the absolute time at which we should stop
+  ///     waiting, else wait an infinite amount of time.
+  ///
+  /// @return
+  ///     Any bits of the requested bits that actually were set within
+  ///     the time specified. Zero if a timeout or unrecoverable error
+  ///     occurred.
+  //------------------------------------------------------------------
+  T WaitForSetValueBits(T bits, const std::chrono::microseconds &timeout =
+                                    std::chrono::microseconds(0)) {
+    // pthread_cond_timedwait() or pthread_cond_wait() will atomically
+    // unlock the mutex and wait for the condition to be set. When either
+    // function returns, they will re-lock the mutex. We use an auto lock/unlock
+    // class (std::lock_guard) to allow us to return at any point in this
+    // function and not have to worry about unlocking the mutex.
+    std::unique_lock<std::mutex> lock(m_mutex);
+#ifdef DB_PTHREAD_LOG_EVENTS
+    printf("%s (bits = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n",
+           __FUNCTION__, bits, timeout.count(), m_value);
+#endif
+    while ((m_value & bits) == 0) {
+      if (timeout == std::chrono::microseconds(0)) {
+        m_condition.wait(lock);
+      } else {
+        std::cv_status result = m_condition.wait_for(lock, timeout);
+        if (result == std::cv_status::timeout)
+          break;
+      }
+    }
+#ifdef DB_PTHREAD_LOG_EVENTS
+    printf("%s (bits = 0x%8.8x), m_value = 0x%8.8x, returning 0x%8.8x\n",
+           __FUNCTION__, bits, m_value, m_value & bits);
+#endif
+
+    return m_value & bits;
+  }
+
+  //------------------------------------------------------------------
+  /// Wait for bits to be reset in \a m_value.
+  ///
+  /// Waits in a thread safe way for any bits in \a bits to get
+  /// logically reset in \a m_value. If all bits are already reset in
+  /// \a m_value, this function will return without waiting.
+  ///
+  /// It is possible for the value to be changed between the time
+  /// the bits are reset and the time the waiting thread wakes up.
+  /// If the bits are no set when the waiting thread wakes up, it will
+  /// go back into a wait state.  It may be necessary for the calling
+  /// code to use additional thread synchronization methods to detect
+  /// transitory states.
+  ///
+  /// @param[in] bits
+  ///     The bits we are waiting to be reset in \a m_value.
+  ///
+  /// @param[in] abstime
+  ///     If non-nullptr, the absolute time at which we should stop
+  ///     waiting, else wait an infinite amount of time.
+  ///
+  /// @return
+  ///     Zero on successful waits, or non-zero if a timeout or
+  ///     unrecoverable error occurs.
+  //------------------------------------------------------------------
+  T WaitForResetValueBits(T bits, const std::chrono::microseconds &timeout =
+                                      std::chrono::microseconds(0)) {
+    // pthread_cond_timedwait() or pthread_cond_wait() will atomically
+    // unlock the mutex and wait for the condition to be set. When either
+    // function returns, they will re-lock the mutex. We use an auto lock/unlock
+    // class (std::lock_guard) to allow us to return at any point in this
+    // function and not have to worry about unlocking the mutex.
+    std::unique_lock<std::mutex> lock(m_mutex);
+
+#ifdef DB_PTHREAD_LOG_EVENTS
+    printf("%s (bits = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n",
+           __FUNCTION__, bits, timeout.count(), m_value);
+#endif
+    while ((m_value & bits) != 0) {
+      if (timeout == std::chrono::microseconds(0)) {
+        m_condition.wait(lock);
+      } else {
+        std::cv_status result = m_condition.wait_for(lock, timeout);
+        if (result == std::cv_status::timeout)
+          break;
+      }
+    }
+
+#ifdef DB_PTHREAD_LOG_EVENTS
+    printf("%s (bits = 0x%8.8x), m_value = 0x%8.8x, returning 0x%8.8x\n",
+           __FUNCTION__, bits, m_value, m_value & bits);
+#endif
+    return m_value & bits;
+  }
+
+  //------------------------------------------------------------------
+  /// Wait for \a m_value to be equal to \a value.
+  ///
+  /// Waits in a thread safe way for \a m_value to be equal to \a
+  /// value. If \a m_value is already equal to \a value, this
+  /// function will return without waiting.
+  ///
+  /// It is possible for the value to be changed between the time
+  /// the value is set and the time the waiting thread wakes up.
+  /// If the value no longer matches the requested value when the
+  /// waiting thread wakes up, it will go back into a wait state.  It
+  /// may be necessary for the calling code to use additional thread
+  /// synchronization methods to detect transitory states.
+  ///
+  /// @param[in] value
+  ///     The value we want \a m_value to be equal to.
+  ///
+  /// @param[in] abstime
+  ///     If non-nullptr, the absolute time at which we should stop
+  ///     waiting, else wait an infinite amount of time.
+  ///
+  /// @param[out] timed_out
+  ///     If not null, set to true if we return because of a time out,
+  ///     and false if the value was set.
+  ///
+  /// @return
+  ///     @li \b true if the \a m_value is equal to \a value
+  ///     @li \b false otherwise
+  //------------------------------------------------------------------
+  bool WaitForValueEqualTo(T value, const std::chrono::microseconds &timeout =
+                                        std::chrono::microseconds(0),
+                           bool *timed_out = nullptr) {
+    // pthread_cond_timedwait() or pthread_cond_wait() will atomically
+    // unlock the mutex and wait for the condition to be set. When either
+    // function returns, they will re-lock the mutex. We use an auto lock/unlock
+    // class (std::lock_guard) to allow us to return at any point in this
+    // function and not have to worry about unlocking the mutex.
+    std::unique_lock<std::mutex> lock(m_mutex);
+
+#ifdef DB_PTHREAD_LOG_EVENTS
+    printf("%s (value = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n",
+           __FUNCTION__, value, timeout.count(), m_value);
+#endif
+    if (timed_out)
+      *timed_out = false;
+
+    while (m_value != value) {
+      if (timeout == std::chrono::microseconds(0)) {
+        m_condition.wait(lock);
+      } else {
+        std::cv_status result = m_condition.wait_for(lock, timeout);
+        if (result == std::cv_status::timeout) {
+          if (timed_out)
+            *timed_out = true;
+          break;
         }
-#ifdef DB_PTHREAD_LOG_EVENTS
-        printf("%s (bits = 0x%8.8x), m_value = 0x%8.8x, returning 0x%8.8x\n", __FUNCTION__, bits, m_value, m_value & bits);
-#endif
-
-        return m_value & bits;
+      }
     }
 
-    //------------------------------------------------------------------
-    /// Wait for bits to be reset in \a m_value.
-    ///
-    /// Waits in a thread safe way for any bits in \a bits to get
-    /// logically reset in \a m_value. If all bits are already reset in
-    /// \a m_value, this function will return without waiting.
-    ///
-    /// It is possible for the value to be changed between the time
-    /// the bits are reset and the time the waiting thread wakes up.
-    /// If the bits are no set when the waiting thread wakes up, it will
-    /// go back into a wait state.  It may be necessary for the calling
-    /// code to use additional thread synchronization methods to detect
-    /// transitory states.
-    ///
-    /// @param[in] bits
-    ///     The bits we are waiting to be reset in \a m_value.
-    ///
-    /// @param[in] abstime
-    ///     If non-nullptr, the absolute time at which we should stop
-    ///     waiting, else wait an infinite amount of time.
-    ///
-    /// @return
-    ///     Zero on successful waits, or non-zero if a timeout or
-    ///     unrecoverable error occurs.
-    //------------------------------------------------------------------
-    T
-    WaitForResetValueBits(T bits, const std::chrono::microseconds &timeout = std::chrono::microseconds(0))
-    {
-        // pthread_cond_timedwait() or pthread_cond_wait() will atomically
-        // unlock the mutex and wait for the condition to be set. When either
-        // function returns, they will re-lock the mutex. We use an auto lock/unlock
-        // class (std::lock_guard) to allow us to return at any point in this
-        // function and not have to worry about unlocking the mutex.
-        std::unique_lock<std::mutex> lock(m_mutex);
-
-#ifdef DB_PTHREAD_LOG_EVENTS
-        printf("%s (bits = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", __FUNCTION__, bits, timeout.count(),
-               m_value);
-#endif
-        while ((m_value & bits) != 0)
-        {
-            if (timeout == std::chrono::microseconds(0))
-            {
-                m_condition.wait(lock);
-            }
-            else
-            {
-                std::cv_status result = m_condition.wait_for(lock, timeout);
-                if (result == std::cv_status::timeout)
-                    break;
-            }
-        }
+    return m_value == value;
+  }
 
-#ifdef DB_PTHREAD_LOG_EVENTS
-        printf("%s (bits = 0x%8.8x), m_value = 0x%8.8x, returning 0x%8.8x\n", __FUNCTION__, bits, m_value, m_value & bits);
-#endif
-        return m_value & bits;
-    }
-
-    //------------------------------------------------------------------
-    /// Wait for \a m_value to be equal to \a value.
-    ///
-    /// Waits in a thread safe way for \a m_value to be equal to \a
-    /// value. If \a m_value is already equal to \a value, this
-    /// function will return without waiting.
-    ///
-    /// It is possible for the value to be changed between the time
-    /// the value is set and the time the waiting thread wakes up.
-    /// If the value no longer matches the requested value when the
-    /// waiting thread wakes up, it will go back into a wait state.  It
-    /// may be necessary for the calling code to use additional thread
-    /// synchronization methods to detect transitory states.
-    ///
-    /// @param[in] value
-    ///     The value we want \a m_value to be equal to.
-    ///
-    /// @param[in] abstime
-    ///     If non-nullptr, the absolute time at which we should stop
-    ///     waiting, else wait an infinite amount of time.
-    ///
-    /// @param[out] timed_out
-    ///     If not null, set to true if we return because of a time out,
-    ///     and false if the value was set.
-    ///
-    /// @return
-    ///     @li \b true if the \a m_value is equal to \a value
-    ///     @li \b false otherwise
-    //------------------------------------------------------------------
-    bool
-    WaitForValueEqualTo(T value, const std::chrono::microseconds &timeout = std::chrono::microseconds(0),
-                        bool *timed_out = nullptr)
-    {
-        // pthread_cond_timedwait() or pthread_cond_wait() will atomically
-        // unlock the mutex and wait for the condition to be set. When either
-        // function returns, they will re-lock the mutex. We use an auto lock/unlock
-        // class (std::lock_guard) to allow us to return at any point in this
-        // function and not have to worry about unlocking the mutex.
-        std::unique_lock<std::mutex> lock(m_mutex);
-
-#ifdef DB_PTHREAD_LOG_EVENTS
-        printf("%s (value = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", __FUNCTION__, value, timeout.count(),
-               m_value);
-#endif
-        if (timed_out)
-            *timed_out = false;
-
-        while (m_value != value)
-        {
-            if (timeout == std::chrono::microseconds(0))
-            {
-                m_condition.wait(lock);
-            }
-            else
-            {
-                std::cv_status result = m_condition.wait_for(lock, timeout);
-                if (result == std::cv_status::timeout)
-                {
-                    if (timed_out)
-                        *timed_out = true;
-                    break;
-                }
-            }
+  //------------------------------------------------------------------
+  /// Wait for \a m_value to be equal to \a value and then set it to
+  /// a new value.
+  ///
+  /// Waits in a thread safe way for \a m_value to be equal to \a
+  /// value and then sets \a m_value to \a new_value. If \a m_value
+  /// is already equal to \a value, this function will immediately
+  /// set \a m_value to \a new_value and return without waiting.
+  ///
+  /// It is possible for the value to be changed between the time
+  /// the value is set and the time the waiting thread wakes up.
+  /// If the value no longer matches the requested value when the
+  /// waiting thread wakes up, it will go back into a wait state.  It
+  /// may be necessary for the calling code to use additional thread
+  /// synchronization methods to detect transitory states.
+  ///
+  /// @param[in] value
+  ///     The value we want \a m_value to be equal to.
+  ///
+  /// @param[in] new_value
+  ///     The value to which \a m_value will be set if \b true is
+  ///     returned.
+  ///
+  /// @param[in] abstime
+  ///     If non-nullptr, the absolute time at which we should stop
+  ///     waiting, else wait an infinite amount of time.
+  ///
+  /// @param[out] timed_out
+  ///     If not null, set to true if we return because of a time out,
+  ///     and false if the value was set.
+  ///
+  /// @return
+  ///     @li \b true if the \a m_value became equal to \a value
+  ///     @li \b false otherwise
+  //------------------------------------------------------------------
+  bool WaitForValueEqualToAndSetValueTo(
+      T wait_value, T new_value,
+      const std::chrono::microseconds &timeout = std::chrono::microseconds(0),
+      bool *timed_out = nullptr) {
+    // pthread_cond_timedwait() or pthread_cond_wait() will atomically
+    // unlock the mutex and wait for the condition to be set. When either
+    // function returns, they will re-lock the mutex. We use an auto lock/unlock
+    // class (std::lock_guard) to allow us to return at any point in this
+    // function and not have to worry about unlocking the mutex.
+    std::unique_lock<std::mutex> lock(m_mutex);
+
+#ifdef DB_PTHREAD_LOG_EVENTS
+    printf("%s (wait_value = 0x%8.8x, new_value = 0x%8.8x, timeout = %llu), "
+           "m_value = 0x%8.8x\n",
+           __FUNCTION__, wait_value, new_value, timeout.count(), m_value);
+#endif
+    if (timed_out)
+      *timed_out = false;
+
+    while (m_value != wait_value) {
+      if (timeout == std::chrono::microseconds(0)) {
+        m_condition.wait(lock);
+      } else {
+        std::cv_status result = m_condition.wait_for(lock, timeout);
+        if (result == std::cv_status::timeout) {
+          if (timed_out)
+            *timed_out = true;
+          break;
         }
-
-        return m_value == value;
+      }
     }
 
-    //------------------------------------------------------------------
-    /// Wait for \a m_value to be equal to \a value and then set it to
-    /// a new value.
-    ///
-    /// Waits in a thread safe way for \a m_value to be equal to \a
-    /// value and then sets \a m_value to \a new_value. If \a m_value
-    /// is already equal to \a value, this function will immediately
-    /// set \a m_value to \a new_value and return without waiting.
-    ///
-    /// It is possible for the value to be changed between the time
-    /// the value is set and the time the waiting thread wakes up.
-    /// If the value no longer matches the requested value when the
-    /// waiting thread wakes up, it will go back into a wait state.  It
-    /// may be necessary for the calling code to use additional thread
-    /// synchronization methods to detect transitory states.
-    ///
-    /// @param[in] value
-    ///     The value we want \a m_value to be equal to.
-    ///
-    /// @param[in] new_value
-    ///     The value to which \a m_value will be set if \b true is
-    ///     returned.
-    ///
-    /// @param[in] abstime
-    ///     If non-nullptr, the absolute time at which we should stop
-    ///     waiting, else wait an infinite amount of time.
-    ///
-    /// @param[out] timed_out
-    ///     If not null, set to true if we return because of a time out,
-    ///     and false if the value was set.
-    ///
-    /// @return
-    ///     @li \b true if the \a m_value became equal to \a value
-    ///     @li \b false otherwise
-    //------------------------------------------------------------------
-    bool
-    WaitForValueEqualToAndSetValueTo(T wait_value, T new_value,
-                                     const std::chrono::microseconds &timeout = std::chrono::microseconds(0),
-                                     bool *timed_out = nullptr)
-    {
-        // pthread_cond_timedwait() or pthread_cond_wait() will atomically
-        // unlock the mutex and wait for the condition to be set. When either
-        // function returns, they will re-lock the mutex. We use an auto lock/unlock
-        // class (std::lock_guard) to allow us to return at any point in this
-        // function and not have to worry about unlocking the mutex.
-        std::unique_lock<std::mutex> lock(m_mutex);
-
-#ifdef DB_PTHREAD_LOG_EVENTS
-        printf("%s (wait_value = 0x%8.8x, new_value = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", __FUNCTION__,
-               wait_value, new_value, timeout.count(), m_value);
-#endif
-        if (timed_out)
-            *timed_out = false;
-
-        while (m_value != wait_value)
-        {
-            if (timeout == std::chrono::microseconds(0))
-            {
-                m_condition.wait(lock);
-            }
-            else
-            {
-                std::cv_status result = m_condition.wait_for(lock, timeout);
-                if (result == std::cv_status::timeout)
-                {
-                    if (timed_out)
-                        *timed_out = true;
-                    break;
-                }
-            }
-        }
-
-        if (m_value == wait_value)
-        {
-            m_value = new_value;
-            return true;
-        }
-
-        return false;
-    }
-
-    //------------------------------------------------------------------
-    /// Wait for \a m_value to not be equal to \a value.
-    ///
-    /// Waits in a thread safe way for \a m_value to not be equal to \a
-    /// value. If \a m_value is already not equal to \a value, this
-    /// function will return without waiting.
-    ///
-    /// It is possible for the value to be changed between the time
-    /// the value is set and the time the waiting thread wakes up.
-    /// If the value is equal to the test value when the waiting thread
-    /// wakes up, it will go back into a wait state.  It may be
-    /// necessary for the calling code to use additional thread
-    /// synchronization methods to detect transitory states.
-    ///
-    /// @param[in] value
-    ///     The value we want \a m_value to not be equal to.
-    ///
-    /// @param[out] new_value
-    ///     The new value if \b true is returned.
-    ///
-    /// @param[in] abstime
-    ///     If non-nullptr, the absolute time at which we should stop
-    ///     waiting, else wait an infinite amount of time.
-    ///
-    /// @return
-    ///     @li \b true if the \a m_value is equal to \a value
-    ///     @li \b false otherwise
-    //------------------------------------------------------------------
-    bool
-    WaitForValueNotEqualTo(T value, T &new_value,
-                           const std::chrono::microseconds &timeout = std::chrono::microseconds(0))
-    {
-        // pthread_cond_timedwait() or pthread_cond_wait() will atomically
-        // unlock the mutex and wait for the condition to be set. When either
-        // function returns, they will re-lock the mutex. We use an auto lock/unlock
-        // class (std::lock_guard) to allow us to return at any point in this
-        // function and not have to worry about unlocking the mutex.
-        std::unique_lock<std::mutex> lock(m_mutex);
-#ifdef DB_PTHREAD_LOG_EVENTS
-        printf("%s (value = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", __FUNCTION__, value, timeout.count(),
-               m_value);
-#endif
-        while (m_value == value)
-        {
-            if (timeout == std::chrono::microseconds(0))
-            {
-                m_condition.wait(lock);
-            }
-            else
-            {
-                std::cv_status result = m_condition.wait_for(lock, timeout);
-                if (result == std::cv_status::timeout)
-                    break;
-            }
-        }
-
-        if (m_value != value)
-        {
-            new_value = m_value;
-            return true;
-        }
-        return false;
+    if (m_value == wait_value) {
+      m_value = new_value;
+      return true;
+    }
+
+    return false;
+  }
+
+  //------------------------------------------------------------------
+  /// Wait for \a m_value to not be equal to \a value.
+  ///
+  /// Waits in a thread safe way for \a m_value to not be equal to \a
+  /// value. If \a m_value is already not equal to \a value, this
+  /// function will return without waiting.
+  ///
+  /// It is possible for the value to be changed between the time
+  /// the value is set and the time the waiting thread wakes up.
+  /// If the value is equal to the test value when the waiting thread
+  /// wakes up, it will go back into a wait state.  It may be
+  /// necessary for the calling code to use additional thread
+  /// synchronization methods to detect transitory states.
+  ///
+  /// @param[in] value
+  ///     The value we want \a m_value to not be equal to.
+  ///
+  /// @param[out] new_value
+  ///     The new value if \b true is returned.
+  ///
+  /// @param[in] abstime
+  ///     If non-nullptr, the absolute time at which we should stop
+  ///     waiting, else wait an infinite amount of time.
+  ///
+  /// @return
+  ///     @li \b true if the \a m_value is equal to \a value
+  ///     @li \b false otherwise
+  //------------------------------------------------------------------
+  bool WaitForValueNotEqualTo(
+      T value, T &new_value,
+      const std::chrono::microseconds &timeout = std::chrono::microseconds(0)) {
+    // pthread_cond_timedwait() or pthread_cond_wait() will atomically
+    // unlock the mutex and wait for the condition to be set. When either
+    // function returns, they will re-lock the mutex. We use an auto lock/unlock
+    // class (std::lock_guard) to allow us to return at any point in this
+    // function and not have to worry about unlocking the mutex.
+    std::unique_lock<std::mutex> lock(m_mutex);
+#ifdef DB_PTHREAD_LOG_EVENTS
+    printf("%s (value = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n",
+           __FUNCTION__, value, timeout.count(), m_value);
+#endif
+    while (m_value == value) {
+      if (timeout == std::chrono::microseconds(0)) {
+        m_condition.wait(lock);
+      } else {
+        std::cv_status result = m_condition.wait_for(lock, timeout);
+        if (result == std::cv_status::timeout)
+          break;
+      }
+    }
+
+    if (m_value != value) {
+      new_value = m_value;
+      return true;
     }
+    return false;
+  }
 
 protected:
-    //----------------------------------------------------------------------
-    // pthread condition and mutex variable to control access and allow
-    // blocking between the main thread and the spotlight index thread.
-    //----------------------------------------------------------------------
-    T           m_value;        ///< The templatized value T that we are protecting access to
-    mutable std::mutex m_mutex; ///< The mutex to use when accessing the data
-    std::condition_variable
-        m_condition; ///< The pthread condition variable to use for signaling that data available or changed.
+  //----------------------------------------------------------------------
+  // pthread condition and mutex variable to control access and allow
+  // blocking between the main thread and the spotlight index thread.
+  //----------------------------------------------------------------------
+  T m_value; ///< The templatized value T that we are protecting access to
+  mutable std::mutex m_mutex; ///< The mutex to use when accessing the data
+  std::condition_variable m_condition; ///< The pthread condition variable to
+                                       ///use for signaling that data available
+                                       ///or changed.
 
 private:
-    //------------------------------------------------------------------
-    /// Broadcast if needed.
-    ///
-    /// Check to see if we need to broadcast to our condition variable
-    /// depending on the \a old_value and on the \a broadcast_type.
-    ///
-    /// If \a broadcast_type is eBroadcastNever, no broadcast will be
-    /// sent.
-    ///
-    /// If \a broadcast_type is eBroadcastAlways, the condition variable
-    /// will always be broadcast.
-    ///
-    /// If \a broadcast_type is eBroadcastOnChange, the condition
-    /// variable be broadcast if the owned value changes.
-    //------------------------------------------------------------------
-    void
-    Broadcast (T old_value, PredicateBroadcastType broadcast_type)
-    {
-        bool broadcast = (broadcast_type == eBroadcastAlways) || ((broadcast_type == eBroadcastOnChange) && old_value != m_value);
-#ifdef DB_PTHREAD_LOG_EVENTS
-        printf("%s (old_value = 0x%8.8x, broadcast_type = %i) m_value = 0x%8.8x, broadcast = %u\n", __FUNCTION__, old_value, broadcast_type, m_value, broadcast);
-#endif
-        if (broadcast)
-            m_condition.notify_all();
-    }
+  //------------------------------------------------------------------
+  /// Broadcast if needed.
+  ///
+  /// Check to see if we need to broadcast to our condition variable
+  /// depending on the \a old_value and on the \a broadcast_type.
+  ///
+  /// If \a broadcast_type is eBroadcastNever, no broadcast will be
+  /// sent.
+  ///
+  /// If \a broadcast_type is eBroadcastAlways, the condition variable
+  /// will always be broadcast.
+  ///
+  /// If \a broadcast_type is eBroadcastOnChange, the condition
+  /// variable be broadcast if the owned value changes.
+  //------------------------------------------------------------------
+  void Broadcast(T old_value, PredicateBroadcastType broadcast_type) {
+    bool broadcast =
+        (broadcast_type == eBroadcastAlways) ||
+        ((broadcast_type == eBroadcastOnChange) && old_value != m_value);
+#ifdef DB_PTHREAD_LOG_EVENTS
+    printf("%s (old_value = 0x%8.8x, broadcast_type = %i) m_value = 0x%8.8x, "
+           "broadcast = %u\n",
+           __FUNCTION__, old_value, broadcast_type, m_value, broadcast);
+#endif
+    if (broadcast)
+      m_condition.notify_all();
+  }
 
-    DISALLOW_COPY_AND_ASSIGN(Predicate);
+  DISALLOW_COPY_AND_ASSIGN(Predicate);
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/ProcessLauncher.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/ProcessLauncher.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/ProcessLauncher.h (original)
+++ lldb/trunk/include/lldb/Host/ProcessLauncher.h Tue Sep  6 15:57:50 2016
@@ -10,18 +10,17 @@
 #ifndef lldb_Host_ProcessLauncher_h_
 #define lldb_Host_ProcessLauncher_h_
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class ProcessLaunchInfo;
 class Error;
 class HostProcess;
 
-class ProcessLauncher
-{
-  public:
-    virtual ~ProcessLauncher() {}
-    virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error) = 0;
+class ProcessLauncher {
+public:
+  virtual ~ProcessLauncher() {}
+  virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+                                    Error &error) = 0;
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/ProcessRunLock.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/ProcessRunLock.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/ProcessRunLock.h (original)
+++ lldb/trunk/include/lldb/Host/ProcessRunLock.h Tue Sep  6 15:57:50 2016
@@ -30,77 +30,61 @@ namespace lldb_private {
 /// threads are accessing its data, and prevent access to its data while
 /// it is running.
 //----------------------------------------------------------------------
-    
-class ProcessRunLock
-{
-public:
-    ProcessRunLock();
-    ~ProcessRunLock();
-
-    bool ReadTryLock ();
-    bool ReadUnlock ();
-    bool SetRunning ();
-    bool TrySetRunning ();
-    bool SetStopped ();
-
-    class ProcessRunLocker
-    {
-    public:
-        ProcessRunLocker () :
-            m_lock (nullptr)
-        {
-        }
-
-        ~ProcessRunLocker()
-        {
-            Unlock();
-        }
 
-        // Try to lock the read lock, but only do so if there are no writers.
-        bool
-        TryLock (ProcessRunLock *lock)
-        {
-            if (m_lock)
-            {
-                if (m_lock == lock)
-                    return true; // We already have this lock locked
-                else
-                    Unlock();
-            }
-            if (lock)
-            {
-                if (lock->ReadTryLock())
-                {
-                    m_lock = lock;
-                    return true;
-                }
-            }
-            return false;
-        }
+class ProcessRunLock {
+public:
+  ProcessRunLock();
+  ~ProcessRunLock();
 
-    protected:
-        void
-        Unlock ()
-        {
-            if (m_lock)
-            {
-                m_lock->ReadUnlock();
-                m_lock = nullptr;
-            }
+  bool ReadTryLock();
+  bool ReadUnlock();
+  bool SetRunning();
+  bool TrySetRunning();
+  bool SetStopped();
+
+  class ProcessRunLocker {
+  public:
+    ProcessRunLocker() : m_lock(nullptr) {}
+
+    ~ProcessRunLocker() { Unlock(); }
+
+    // Try to lock the read lock, but only do so if there are no writers.
+    bool TryLock(ProcessRunLock *lock) {
+      if (m_lock) {
+        if (m_lock == lock)
+          return true; // We already have this lock locked
+        else
+          Unlock();
+      }
+      if (lock) {
+        if (lock->ReadTryLock()) {
+          m_lock = lock;
+          return true;
         }
-        
-        ProcessRunLock *m_lock;
-
-    private:
-        DISALLOW_COPY_AND_ASSIGN(ProcessRunLocker);
-    };
+      }
+      return false;
+    }
+
+  protected:
+    void Unlock() {
+      if (m_lock) {
+        m_lock->ReadUnlock();
+        m_lock = nullptr;
+      }
+    }
+
+    ProcessRunLock *m_lock;
+
+  private:
+    DISALLOW_COPY_AND_ASSIGN(ProcessRunLocker);
+  };
 
 protected:
-    lldb::rwlock_t m_rwlock;
-    bool m_running;
+  lldb::rwlock_t m_rwlock;
+  bool m_running;
 
 private:
-    DISALLOW_COPY_AND_ASSIGN(ProcessRunLock);
+  DISALLOW_COPY_AND_ASSIGN(ProcessRunLock);
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/Socket.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Socket.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Socket.h (original)
+++ lldb/trunk/include/lldb/Host/Socket.h Tue Sep  6 15:57:50 2016
@@ -26,91 +26,98 @@
 #include <ws2tcpip.h>
 #endif
 
-namespace llvm
-{
-    class StringRef;
+namespace llvm {
+class StringRef;
 }
 
 namespace lldb_private {
 
 #if defined(_MSC_VER)
-    typedef SOCKET NativeSocket;
+typedef SOCKET NativeSocket;
 #else
-    typedef int NativeSocket;
+typedef int NativeSocket;
 #endif
 
-class Socket : public IOObject
-{
+class Socket : public IOObject {
 public:
-    typedef enum
-    {
-        ProtocolTcp,
-        ProtocolUdp,
-        ProtocolUnixDomain,
-        ProtocolUnixAbstract
-    } SocketProtocol;
-
-    static const NativeSocket kInvalidSocketValue;
-
-    ~Socket() override;
-
-    static std::unique_ptr<Socket> Create(const SocketProtocol protocol, bool child_processes_inherit, Error &error);
-
-    virtual Error Connect(llvm::StringRef name) = 0;
-    virtual Error Listen(llvm::StringRef name, int backlog) = 0;
-    virtual Error Accept(llvm::StringRef name, bool child_processes_inherit, Socket *&socket) = 0;
-
-    // Initialize a Tcp Socket object in listening mode.  listen and accept are implemented
-    // separately because the caller may wish to manipulate or query the socket after it is
-    // initialized, but before entering a blocking accept.
-    static Error TcpListen(
-        llvm::StringRef host_and_port,
-        bool child_processes_inherit,
-        Socket *&socket,
-        Predicate<uint16_t>* predicate,
-        int backlog = 5);
-    static Error TcpConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
-    static Error UdpConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&send_socket, Socket *&recv_socket);
-    static Error UnixDomainConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
-    static Error UnixDomainAccept(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
-    static Error UnixAbstractConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
-    static Error UnixAbstractAccept(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket);
-
-    int GetOption (int level, int option_name, int &option_value);
-    int SetOption (int level, int option_name, int option_value);
-
-    NativeSocket GetNativeSocket () const { return m_socket; }
-    SocketProtocol GetSocketProtocol () const { return m_protocol; }
-
-    Error Read (void *buf, size_t &num_bytes) override;
-    Error Write (const void *buf, size_t &num_bytes) override;
-
-    virtual Error PreDisconnect ();
-    Error Close() override;
-
-    bool IsValid () const override { return m_socket != kInvalidSocketValue; }
-    WaitableHandle GetWaitableHandle () override;
-
-    static bool
-    DecodeHostAndPort (llvm::StringRef host_and_port, 
-                       std::string &host_str, 
-                       std::string &port_str, 
-                       int32_t& port,
-                       Error *error_ptr);
+  typedef enum {
+    ProtocolTcp,
+    ProtocolUdp,
+    ProtocolUnixDomain,
+    ProtocolUnixAbstract
+  } SocketProtocol;
+
+  static const NativeSocket kInvalidSocketValue;
+
+  ~Socket() override;
+
+  static std::unique_ptr<Socket> Create(const SocketProtocol protocol,
+                                        bool child_processes_inherit,
+                                        Error &error);
+
+  virtual Error Connect(llvm::StringRef name) = 0;
+  virtual Error Listen(llvm::StringRef name, int backlog) = 0;
+  virtual Error Accept(llvm::StringRef name, bool child_processes_inherit,
+                       Socket *&socket) = 0;
+
+  // Initialize a Tcp Socket object in listening mode.  listen and accept are
+  // implemented
+  // separately because the caller may wish to manipulate or query the socket
+  // after it is
+  // initialized, but before entering a blocking accept.
+  static Error TcpListen(llvm::StringRef host_and_port,
+                         bool child_processes_inherit, Socket *&socket,
+                         Predicate<uint16_t> *predicate, int backlog = 5);
+  static Error TcpConnect(llvm::StringRef host_and_port,
+                          bool child_processes_inherit, Socket *&socket);
+  static Error UdpConnect(llvm::StringRef host_and_port,
+                          bool child_processes_inherit, Socket *&send_socket,
+                          Socket *&recv_socket);
+  static Error UnixDomainConnect(llvm::StringRef host_and_port,
+                                 bool child_processes_inherit, Socket *&socket);
+  static Error UnixDomainAccept(llvm::StringRef host_and_port,
+                                bool child_processes_inherit, Socket *&socket);
+  static Error UnixAbstractConnect(llvm::StringRef host_and_port,
+                                   bool child_processes_inherit,
+                                   Socket *&socket);
+  static Error UnixAbstractAccept(llvm::StringRef host_and_port,
+                                  bool child_processes_inherit,
+                                  Socket *&socket);
+
+  int GetOption(int level, int option_name, int &option_value);
+  int SetOption(int level, int option_name, int option_value);
+
+  NativeSocket GetNativeSocket() const { return m_socket; }
+  SocketProtocol GetSocketProtocol() const { return m_protocol; }
+
+  Error Read(void *buf, size_t &num_bytes) override;
+  Error Write(const void *buf, size_t &num_bytes) override;
+
+  virtual Error PreDisconnect();
+  Error Close() override;
+
+  bool IsValid() const override { return m_socket != kInvalidSocketValue; }
+  WaitableHandle GetWaitableHandle() override;
+
+  static bool DecodeHostAndPort(llvm::StringRef host_and_port,
+                                std::string &host_str, std::string &port_str,
+                                int32_t &port, Error *error_ptr);
 
 protected:
-    Socket(NativeSocket socket, SocketProtocol protocol, bool should_close);
+  Socket(NativeSocket socket, SocketProtocol protocol, bool should_close);
 
-    virtual size_t Send(const void *buf, const size_t num_bytes);
+  virtual size_t Send(const void *buf, const size_t num_bytes);
 
-    static void SetLastError(Error &error);
-    static NativeSocket CreateSocket(
-        const int domain, const int type, const int protocol, bool child_processes_inherit, Error& error);
-    static NativeSocket AcceptSocket(
-        NativeSocket sockfd, struct sockaddr *addr, socklen_t *addrlen, bool child_processes_inherit, Error& error);
+  static void SetLastError(Error &error);
+  static NativeSocket CreateSocket(const int domain, const int type,
+                                   const int protocol,
+                                   bool child_processes_inherit, Error &error);
+  static NativeSocket AcceptSocket(NativeSocket sockfd, struct sockaddr *addr,
+                                   socklen_t *addrlen,
+                                   bool child_processes_inherit, Error &error);
 
-    SocketProtocol m_protocol;
-    NativeSocket m_socket;
+  SocketProtocol m_protocol;
+  NativeSocket m_socket;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/SocketAddress.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/SocketAddress.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/SocketAddress.h (original)
+++ lldb/trunk/include/lldb/Host/SocketAddress.h Tue Sep  6 15:57:50 2016
@@ -19,9 +19,9 @@
 #include <ws2tcpip.h>
 typedef ADDRESS_FAMILY sa_family_t;
 #else
-#include <sys/socket.h>
 #include <netdb.h>
 #include <netinet/in.h>
+#include <sys/socket.h>
 #endif
 
 #if defined(__FreeBSD__)
@@ -35,243 +35,180 @@ typedef ADDRESS_FAMILY sa_family_t;
 
 namespace lldb_private {
 
-class SocketAddress
-{
+class SocketAddress {
 public:
-    //------------------------------------------------------------------
-    // Constructors and Destructors
-    //------------------------------------------------------------------
-    SocketAddress ();
-    SocketAddress (const struct sockaddr &s);
-    SocketAddress (const struct sockaddr_in &s);
-    SocketAddress (const struct sockaddr_in6 &s);
-    SocketAddress (const struct sockaddr_storage &s);
-    SocketAddress (const SocketAddress& rhs);
-    ~SocketAddress ();
-
-    //------------------------------------------------------------------
-    // Operators
-    //------------------------------------------------------------------
-    const SocketAddress&
-    operator=(const SocketAddress& rhs);
-
-    const SocketAddress&
-    operator=(const struct addrinfo *addr_info);
-
-    const SocketAddress&
-    operator=(const struct sockaddr &s);
-
-    const SocketAddress&
-    operator=(const struct sockaddr_in &s);
-
-    const SocketAddress&
-    operator=(const struct sockaddr_in6 &s);
-
-    const SocketAddress&
-    operator=(const struct sockaddr_storage &s);
-    
-    //------------------------------------------------------------------
-    // Clear the contents of this socket address
-    //------------------------------------------------------------------
-    void
-    Clear ();
-
-    //------------------------------------------------------------------
-    // Get the length for the current socket address family
-    //------------------------------------------------------------------
-    socklen_t
-    GetLength () const;
-
-    //------------------------------------------------------------------
-    // Get the max length for the largest socket address supported.
-    //------------------------------------------------------------------
-    static socklen_t
-    GetMaxLength ();
-
-    //------------------------------------------------------------------
-    // Get the socket address family 
-    //------------------------------------------------------------------
-    sa_family_t
-    GetFamily () const;
-
-    //------------------------------------------------------------------
-    // Set the socket address family 
-    //------------------------------------------------------------------
-    void
-    SetFamily (sa_family_t family);
-
-    //------------------------------------------------------------------
-    // Get the address
-    //------------------------------------------------------------------
-    std::string
-    GetIPAddress () const;
-
-    //------------------------------------------------------------------
-    // Get the port if the socket address for the family has a port
-    //------------------------------------------------------------------
-    uint16_t
-    GetPort () const;
-
-    //------------------------------------------------------------------
-    // Set the port if the socket address for the family has a port. 
-    // The family must be set correctly prior to calling this function.
-    //------------------------------------------------------------------
-    bool
-    SetPort (uint16_t port);
-
-    //------------------------------------------------------------------
-    // Set the socket address according to the first match from a call
-    // to getaddrinfo() (or equivalent functions for systems that don't
-    // have getaddrinfo(). If "addr_info_ptr" is not NULL, it will get
-    // filled in with the match that was used to populate this socket
-    // address.
-    //------------------------------------------------------------------
-    bool
-    getaddrinfo (const char *host,          // Hostname ("foo.bar.com" or "foo" or IP address string ("123.234.12.1" or "2001:0db8:85a3:0000:0000:8a2e:0370:7334")
-                 const char *service,       // Protocol name ("tcp", "http", etc) or a raw port number string ("81")
-                 int ai_family = PF_UNSPEC,
-                 int ai_socktype = 0,
-                 int ai_protocol = 0,
-                 int ai_flags = 0);
-
-    //------------------------------------------------------------------
-    // Quick way to set the SocketAddress to localhost given the family.
-    // Returns true if successful, false if "family" doesn't support 
-    // localhost or if "family" is not supported by this class.
-    //------------------------------------------------------------------
-    bool
-    SetToLocalhost (sa_family_t family, 
-                    uint16_t port);
-
-    bool
-    SetToAnyAddress (sa_family_t family,
-                     uint16_t port);
-
-    //------------------------------------------------------------------
-    // Returns true if there is a valid socket address in this object.
-    //------------------------------------------------------------------
-    bool
-    IsValid () const;
-
-    //------------------------------------------------------------------
-    // Direct access to all of the sockaddr structures
-    //------------------------------------------------------------------
-    struct sockaddr &
-    sockaddr ()
-    {
-        return m_socket_addr.sa;
-    }
-
-    const struct sockaddr &
-    sockaddr () const
-    {
-        return m_socket_addr.sa;
-    }
-    
-    struct sockaddr_in &
-    sockaddr_in ()
-    {
-        return m_socket_addr.sa_ipv4;
-    }
-    
-    const struct sockaddr_in &
-    sockaddr_in () const
-    {
-        return m_socket_addr.sa_ipv4;
-    }
-    
-    struct sockaddr_in6 &
-    sockaddr_in6 ()
-    {
-        return m_socket_addr.sa_ipv6;
-    }
-    
-    const struct sockaddr_in6 &
-    sockaddr_in6 () const
-    {
-        return m_socket_addr.sa_ipv6;
-    }
-    
-    struct sockaddr_storage &
-    sockaddr_storage ()
-    {
-        return m_socket_addr.sa_storage;
-    }
-
-    
-    const struct sockaddr_storage &
-    sockaddr_storage () const
-    {
-        return m_socket_addr.sa_storage;
-    }
-    
-    
-    //------------------------------------------------------------------
-    // Conversion operators to allow getting the contents of this class
-    // as a pointer to the appropriate structure. This allows an instance
-    // of this class to be used in calls that take one of the sockaddr
-    // structure variants without having to manually use the correct
-    // accessor function.
-    //------------------------------------------------------------------
-    
-    operator struct sockaddr * ()
-    {
-        return &m_socket_addr.sa;
-    }
-    
-    operator const struct sockaddr * () const
-    {
-        return &m_socket_addr.sa;
-    }
-
-    operator struct sockaddr_in * ()
-    {
-        return &m_socket_addr.sa_ipv4;
-    }
-    
-    operator const struct sockaddr_in * () const
-    {
-        return &m_socket_addr.sa_ipv4;
-    }
-
-    operator struct sockaddr_in6 * ()
-    {
-        return &m_socket_addr.sa_ipv6;
-    }
-    
-    operator const struct sockaddr_in6 * () const
-    {
-        return &m_socket_addr.sa_ipv6;
-    }
-
-    operator const struct sockaddr_storage * () const
-    {
-        return &m_socket_addr.sa_storage;
-    }
-
-    operator struct sockaddr_storage * ()
-    {
-        return &m_socket_addr.sa_storage;
-    }
+  //------------------------------------------------------------------
+  // Constructors and Destructors
+  //------------------------------------------------------------------
+  SocketAddress();
+  SocketAddress(const struct sockaddr &s);
+  SocketAddress(const struct sockaddr_in &s);
+  SocketAddress(const struct sockaddr_in6 &s);
+  SocketAddress(const struct sockaddr_storage &s);
+  SocketAddress(const SocketAddress &rhs);
+  ~SocketAddress();
+
+  //------------------------------------------------------------------
+  // Operators
+  //------------------------------------------------------------------
+  const SocketAddress &operator=(const SocketAddress &rhs);
+
+  const SocketAddress &operator=(const struct addrinfo *addr_info);
+
+  const SocketAddress &operator=(const struct sockaddr &s);
+
+  const SocketAddress &operator=(const struct sockaddr_in &s);
+
+  const SocketAddress &operator=(const struct sockaddr_in6 &s);
+
+  const SocketAddress &operator=(const struct sockaddr_storage &s);
+
+  //------------------------------------------------------------------
+  // Clear the contents of this socket address
+  //------------------------------------------------------------------
+  void Clear();
+
+  //------------------------------------------------------------------
+  // Get the length for the current socket address family
+  //------------------------------------------------------------------
+  socklen_t GetLength() const;
+
+  //------------------------------------------------------------------
+  // Get the max length for the largest socket address supported.
+  //------------------------------------------------------------------
+  static socklen_t GetMaxLength();
+
+  //------------------------------------------------------------------
+  // Get the socket address family
+  //------------------------------------------------------------------
+  sa_family_t GetFamily() const;
+
+  //------------------------------------------------------------------
+  // Set the socket address family
+  //------------------------------------------------------------------
+  void SetFamily(sa_family_t family);
+
+  //------------------------------------------------------------------
+  // Get the address
+  //------------------------------------------------------------------
+  std::string GetIPAddress() const;
+
+  //------------------------------------------------------------------
+  // Get the port if the socket address for the family has a port
+  //------------------------------------------------------------------
+  uint16_t GetPort() const;
+
+  //------------------------------------------------------------------
+  // Set the port if the socket address for the family has a port.
+  // The family must be set correctly prior to calling this function.
+  //------------------------------------------------------------------
+  bool SetPort(uint16_t port);
+
+  //------------------------------------------------------------------
+  // Set the socket address according to the first match from a call
+  // to getaddrinfo() (or equivalent functions for systems that don't
+  // have getaddrinfo(). If "addr_info_ptr" is not NULL, it will get
+  // filled in with the match that was used to populate this socket
+  // address.
+  //------------------------------------------------------------------
+  bool
+  getaddrinfo(const char *host,    // Hostname ("foo.bar.com" or "foo" or IP
+                                   // address string ("123.234.12.1" or
+                                   // "2001:0db8:85a3:0000:0000:8a2e:0370:7334")
+              const char *service, // Protocol name ("tcp", "http", etc) or a
+                                   // raw port number string ("81")
+              int ai_family = PF_UNSPEC, int ai_socktype = 0,
+              int ai_protocol = 0, int ai_flags = 0);
+
+  //------------------------------------------------------------------
+  // Quick way to set the SocketAddress to localhost given the family.
+  // Returns true if successful, false if "family" doesn't support
+  // localhost or if "family" is not supported by this class.
+  //------------------------------------------------------------------
+  bool SetToLocalhost(sa_family_t family, uint16_t port);
+
+  bool SetToAnyAddress(sa_family_t family, uint16_t port);
+
+  //------------------------------------------------------------------
+  // Returns true if there is a valid socket address in this object.
+  //------------------------------------------------------------------
+  bool IsValid() const;
+
+  //------------------------------------------------------------------
+  // Direct access to all of the sockaddr structures
+  //------------------------------------------------------------------
+  struct sockaddr &sockaddr() {
+    return m_socket_addr.sa;
+  }
+
+  const struct sockaddr &sockaddr() const { return m_socket_addr.sa; }
+
+  struct sockaddr_in &sockaddr_in() {
+    return m_socket_addr.sa_ipv4;
+  }
+
+  const struct sockaddr_in &sockaddr_in() const {
+    return m_socket_addr.sa_ipv4;
+  }
+
+  struct sockaddr_in6 &sockaddr_in6() {
+    return m_socket_addr.sa_ipv6;
+  }
+
+  const struct sockaddr_in6 &sockaddr_in6() const {
+    return m_socket_addr.sa_ipv6;
+  }
+
+  struct sockaddr_storage &sockaddr_storage() {
+    return m_socket_addr.sa_storage;
+  }
+
+  const struct sockaddr_storage &sockaddr_storage() const {
+    return m_socket_addr.sa_storage;
+  }
+
+  //------------------------------------------------------------------
+  // Conversion operators to allow getting the contents of this class
+  // as a pointer to the appropriate structure. This allows an instance
+  // of this class to be used in calls that take one of the sockaddr
+  // structure variants without having to manually use the correct
+  // accessor function.
+  //------------------------------------------------------------------
+
+  operator struct sockaddr *() { return &m_socket_addr.sa; }
+
+  operator const struct sockaddr *() const { return &m_socket_addr.sa; }
+
+  operator struct sockaddr_in *() { return &m_socket_addr.sa_ipv4; }
+
+  operator const struct sockaddr_in *() const { return &m_socket_addr.sa_ipv4; }
+
+  operator struct sockaddr_in6 *() { return &m_socket_addr.sa_ipv6; }
+
+  operator const struct sockaddr_in6 *() const {
+    return &m_socket_addr.sa_ipv6;
+  }
+
+  operator const struct sockaddr_storage *() const {
+    return &m_socket_addr.sa_storage;
+  }
+
+  operator struct sockaddr_storage *() { return &m_socket_addr.sa_storage; }
 
-    
 protected:
-    typedef union sockaddr_tag
-    {
-        struct sockaddr         sa;
-        struct sockaddr_in      sa_ipv4;
-        struct sockaddr_in6     sa_ipv6;
-        struct sockaddr_storage sa_storage;
-    } sockaddr_t;
-
-    //------------------------------------------------------------------
-    // Classes that inherit from SocketAddress can see and modify these
-    //------------------------------------------------------------------
-    sockaddr_t m_socket_addr;
+  typedef union sockaddr_tag {
+    struct sockaddr sa;
+    struct sockaddr_in sa_ipv4;
+    struct sockaddr_in6 sa_ipv6;
+    struct sockaddr_storage sa_storage;
+  } sockaddr_t;
+
+  //------------------------------------------------------------------
+  // Classes that inherit from SocketAddress can see and modify these
+  //------------------------------------------------------------------
+  sockaddr_t m_socket_addr;
 };
 
-
 } // namespace lldb_private
 
-
-#endif  // liblldb_SocketAddress_h_
+#endif // liblldb_SocketAddress_h_

Modified: lldb/trunk/include/lldb/Host/StringConvert.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/StringConvert.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/StringConvert.h (original)
+++ lldb/trunk/include/lldb/Host/StringConvert.h Tue Sep  6 15:57:50 2016
@@ -19,7 +19,7 @@
 // Project includes
 
 namespace lldb_private {
-    
+
 namespace StringConvert {
 
 //----------------------------------------------------------------------
@@ -27,20 +27,20 @@ namespace StringConvert {
 /// @brief Utility classes for converting strings into Integers
 //----------------------------------------------------------------------
 
-int32_t
-ToSInt32 (const char *s, int32_t fail_value = 0, int base = 0, bool *success_ptr = nullptr);
+int32_t ToSInt32(const char *s, int32_t fail_value = 0, int base = 0,
+                 bool *success_ptr = nullptr);
 
-uint32_t
-ToUInt32 (const char *s, uint32_t fail_value = 0, int base = 0, bool *success_ptr = nullptr);
+uint32_t ToUInt32(const char *s, uint32_t fail_value = 0, int base = 0,
+                  bool *success_ptr = nullptr);
 
-int64_t
-ToSInt64 (const char *s, int64_t fail_value = 0, int base = 0, bool *success_ptr = nullptr);
+int64_t ToSInt64(const char *s, int64_t fail_value = 0, int base = 0,
+                 bool *success_ptr = nullptr);
 
-uint64_t
-ToUInt64 (const char *s, uint64_t fail_value = 0, int base = 0, bool *success_ptr = nullptr);
+uint64_t ToUInt64(const char *s, uint64_t fail_value = 0, int base = 0,
+                  bool *success_ptr = nullptr);
 
-double
-ToDouble (const char *s, double fail_value = 0.0, bool *success_ptr = nullptr);
+double ToDouble(const char *s, double fail_value = 0.0,
+                bool *success_ptr = nullptr);
 } // namespace StringConvert
 } // namespace lldb_private
 

Modified: lldb/trunk/include/lldb/Host/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Symbols.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Symbols.h (original)
+++ lldb/trunk/include/lldb/Host/Symbols.h Tue Sep  6 15:57:50 2016
@@ -20,49 +20,43 @@
 
 namespace lldb_private {
 
-class Symbols
-{
+class Symbols {
 public:
-    //----------------------------------------------------------------------
-    // Locate the executable file given a module specification.
-    //
-    // Locating the file should happen only on the local computer or using
-    // the current computers global settings.
-    //----------------------------------------------------------------------
-    static ModuleSpec
-    LocateExecutableObjectFile (const ModuleSpec &module_spec);
-
-    //----------------------------------------------------------------------
-    // Locate the symbol file given a module specification.
-    //
-    // Locating the file should happen only on the local computer or using
-    // the current computers global settings.
-    //----------------------------------------------------------------------
-    static FileSpec
-    LocateExecutableSymbolFile (const ModuleSpec &module_spec);
-        
-    static FileSpec
-    FindSymbolFileInBundle (const FileSpec& dsym_bundle_fspec,
-                            const lldb_private::UUID *uuid,
-                            const ArchSpec *arch);
-    
-    //----------------------------------------------------------------------
-    // Locate the object and symbol file given a module specification.
-    //
-    // Locating the file can try to download the file from a corporate build
-    // repository, or using any other means necessary to locate both the
-    // unstripped object file and the debug symbols.  
-    // The force_lookup argument controls whether the external program is called
-    // unconditionally to find the symbol file, or if the user's settings are
-    // checked to see if they've enabled the external program before calling.
-    // 
-    //----------------------------------------------------------------------
-    static bool
-    DownloadObjectAndSymbolFile (ModuleSpec &module_spec, bool force_lookup = true);
-                                 
+  //----------------------------------------------------------------------
+  // Locate the executable file given a module specification.
+  //
+  // Locating the file should happen only on the local computer or using
+  // the current computers global settings.
+  //----------------------------------------------------------------------
+  static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec);
+
+  //----------------------------------------------------------------------
+  // Locate the symbol file given a module specification.
+  //
+  // Locating the file should happen only on the local computer or using
+  // the current computers global settings.
+  //----------------------------------------------------------------------
+  static FileSpec LocateExecutableSymbolFile(const ModuleSpec &module_spec);
+
+  static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec,
+                                         const lldb_private::UUID *uuid,
+                                         const ArchSpec *arch);
+
+  //----------------------------------------------------------------------
+  // Locate the object and symbol file given a module specification.
+  //
+  // Locating the file can try to download the file from a corporate build
+  // repository, or using any other means necessary to locate both the
+  // unstripped object file and the debug symbols.
+  // The force_lookup argument controls whether the external program is called
+  // unconditionally to find the symbol file, or if the user's settings are
+  // checked to see if they've enabled the external program before calling.
+  //
+  //----------------------------------------------------------------------
+  static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
+                                          bool force_lookup = true);
 };
 
 } // namespace lldb_private
 
-
-#endif  // liblldb_Symbols_h_
+#endif // liblldb_Symbols_h_

Modified: lldb/trunk/include/lldb/Host/Terminal.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Terminal.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Terminal.h (original)
+++ lldb/trunk/include/lldb/Host/Terminal.h Tue Sep  6 15:57:50 2016
@@ -11,64 +11,37 @@
 #define liblldb_Terminal_h_
 #if defined(__cplusplus)
 
-#include "lldb/lldb-private.h"
 #include "lldb/Host/Config.h"
+#include "lldb/lldb-private.h"
 
 struct termios;
 
 namespace lldb_private {
 
-class Terminal
-{
+class Terminal {
 public:
+  Terminal(int fd = -1) : m_fd(fd) {}
+
+  ~Terminal() {}
+
+  bool IsATerminal() const;
+
+  int GetFileDescriptor() const { return m_fd; }
+
+  void SetFileDescriptor(int fd) { m_fd = fd; }
 
-    Terminal (int fd = -1) :
-        m_fd (fd)
-    {
-    }
-    
-    ~Terminal ()
-    {
-    }
-
-    bool
-    IsATerminal () const;
-
-    int
-    GetFileDescriptor () const
-    {
-        return m_fd;
-    }
-
-    void
-    SetFileDescriptor (int fd)
-    {
-        m_fd = fd;
-    }
-
-    bool
-    FileDescriptorIsValid () const
-    {
-        return m_fd != -1;
-    }
-
-    void
-    Clear ()
-    {
-        m_fd = -1;
-    }
+  bool FileDescriptorIsValid() const { return m_fd != -1; }
 
-    bool
-    SetEcho (bool enabled);
+  void Clear() { m_fd = -1; }
 
-    bool
-    SetCanonical (bool enabled);
+  bool SetEcho(bool enabled);
+
+  bool SetCanonical(bool enabled);
 
 protected:
-    int m_fd;   // This may or may not be a terminal file descriptor
+  int m_fd; // This may or may not be a terminal file descriptor
 };
 
-
 //----------------------------------------------------------------------
 /// @class State Terminal.h "lldb/Host/Terminal.h"
 /// @brief A terminal state saving/restoring class.
@@ -76,109 +49,100 @@ protected:
 /// This class can be used to remember the terminal state for a file
 /// descriptor and later restore that state as it originally was.
 //----------------------------------------------------------------------
-class TerminalState
-{
+class TerminalState {
 public:
-    //------------------------------------------------------------------
-    /// Default constructor
-    //------------------------------------------------------------------
-    TerminalState();
-
-    //------------------------------------------------------------------
-    /// Destructor
-    //------------------------------------------------------------------
-    ~TerminalState();
-
-    //------------------------------------------------------------------
-    /// Save the TTY state for \a fd.
-    ///
-    /// Save the current state of the TTY for the file descriptor "fd"
-    /// and if "save_process_group" is true, attempt to save the process
-    /// group info for the TTY.
-    ///
-    /// @param[in] fd
-    ///     The file descriptor to save the state of.
-    ///
-    /// @param[in] save_process_group
-    ///     If \b true, save the process group settings, else do not
-    ///     save the process group settings for a TTY.
-    ///
-    /// @return
-    ///     Returns \b true if \a fd describes a TTY and if the state
-    ///     was able to be saved, \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    Save (int fd, bool save_process_group);
-
-    //------------------------------------------------------------------
-    /// Restore the TTY state to the cached state.
-    ///
-    /// Restore the state of the TTY using the cached values from a
-    /// previous call to TerminalState::Save(int,bool).
-    ///
-    /// @return
-    ///     Returns \b true if the TTY state was successfully restored,
-    ///     \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    Restore () const;
-
-    //------------------------------------------------------------------
-    /// Test for valid cached TTY state information.
-    ///
-    /// @return
-    ///     Returns \b true if this object has valid saved TTY state
-    ///     settings that can be used to restore a previous state,
-    ///     \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    IsValid() const;
-    
-    void
-    Clear ();
+  //------------------------------------------------------------------
+  /// Default constructor
+  //------------------------------------------------------------------
+  TerminalState();
+
+  //------------------------------------------------------------------
+  /// Destructor
+  //------------------------------------------------------------------
+  ~TerminalState();
+
+  //------------------------------------------------------------------
+  /// Save the TTY state for \a fd.
+  ///
+  /// Save the current state of the TTY for the file descriptor "fd"
+  /// and if "save_process_group" is true, attempt to save the process
+  /// group info for the TTY.
+  ///
+  /// @param[in] fd
+  ///     The file descriptor to save the state of.
+  ///
+  /// @param[in] save_process_group
+  ///     If \b true, save the process group settings, else do not
+  ///     save the process group settings for a TTY.
+  ///
+  /// @return
+  ///     Returns \b true if \a fd describes a TTY and if the state
+  ///     was able to be saved, \b false otherwise.
+  //------------------------------------------------------------------
+  bool Save(int fd, bool save_process_group);
+
+  //------------------------------------------------------------------
+  /// Restore the TTY state to the cached state.
+  ///
+  /// Restore the state of the TTY using the cached values from a
+  /// previous call to TerminalState::Save(int,bool).
+  ///
+  /// @return
+  ///     Returns \b true if the TTY state was successfully restored,
+  ///     \b false otherwise.
+  //------------------------------------------------------------------
+  bool Restore() const;
+
+  //------------------------------------------------------------------
+  /// Test for valid cached TTY state information.
+  ///
+  /// @return
+  ///     Returns \b true if this object has valid saved TTY state
+  ///     settings that can be used to restore a previous state,
+  ///     \b false otherwise.
+  //------------------------------------------------------------------
+  bool IsValid() const;
 
-protected:
+  void Clear();
 
-    //------------------------------------------------------------------
-    /// Test if tflags is valid.
-    ///
-    /// @return
-    ///     Returns \b true if \a m_tflags is valid and can be restored,
-    ///     \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    TFlagsIsValid() const;
-
-    //------------------------------------------------------------------
-    /// Test if ttystate is valid.
-    ///
-    /// @return
-    ///     Returns \b true if \a m_ttystate is valid and can be
-    ///     restored, \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    TTYStateIsValid() const;
-
-    //------------------------------------------------------------------
-    /// Test if the process group information is valid.
-    ///
-    /// @return
-    ///     Returns \b true if \a m_process_group is valid and can be
-    ///     restored, \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    ProcessGroupIsValid() const;
-
-    //------------------------------------------------------------------
-    // Member variables
-    //------------------------------------------------------------------
-    Terminal        m_tty;          ///< A terminal
-    int             m_tflags;       ///< Cached tflags information.
+protected:
+  //------------------------------------------------------------------
+  /// Test if tflags is valid.
+  ///
+  /// @return
+  ///     Returns \b true if \a m_tflags is valid and can be restored,
+  ///     \b false otherwise.
+  //------------------------------------------------------------------
+  bool TFlagsIsValid() const;
+
+  //------------------------------------------------------------------
+  /// Test if ttystate is valid.
+  ///
+  /// @return
+  ///     Returns \b true if \a m_ttystate is valid and can be
+  ///     restored, \b false otherwise.
+  //------------------------------------------------------------------
+  bool TTYStateIsValid() const;
+
+  //------------------------------------------------------------------
+  /// Test if the process group information is valid.
+  ///
+  /// @return
+  ///     Returns \b true if \a m_process_group is valid and can be
+  ///     restored, \b false otherwise.
+  //------------------------------------------------------------------
+  bool ProcessGroupIsValid() const;
+
+  //------------------------------------------------------------------
+  // Member variables
+  //------------------------------------------------------------------
+  Terminal m_tty; ///< A terminal
+  int m_tflags;   ///< Cached tflags information.
 #ifdef LLDB_CONFIG_TERMIOS_SUPPORTED
-    std::unique_ptr<struct termios> m_termios_ap; ///< Cached terminal state information.
+  std::unique_ptr<struct termios>
+      m_termios_ap; ///< Cached terminal state information.
 #endif
-    lldb::pid_t     m_process_group;///< Cached process group information.
-
+  lldb::pid_t m_process_group; ///< Cached process group information.
 };
 
 //----------------------------------------------------------------------
@@ -188,70 +152,67 @@ protected:
 /// This class can be used to remember 2 TTY states for a given file
 /// descriptor and switch between the two states.
 //----------------------------------------------------------------------
-class TerminalStateSwitcher
-{
+class TerminalStateSwitcher {
 public:
-    //------------------------------------------------------------------
-    /// Constructor
-    //------------------------------------------------------------------
-    TerminalStateSwitcher();
-
-    //------------------------------------------------------------------
-    /// Destructor
-    //------------------------------------------------------------------
-    ~TerminalStateSwitcher();
-
-    //------------------------------------------------------------------
-    /// Get the number of possible states to save.
-    ///
-    /// @return
-    ///     The number of states that this TTY switcher object contains.
-    //------------------------------------------------------------------
-    uint32_t
-    GetNumberOfStates() const;
-
-    //------------------------------------------------------------------
-    /// Restore the TTY state for state at index \a idx.
-    ///
-    /// @return
-    ///     Returns \b true if the TTY state was successfully restored,
-    ///     \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    Restore (uint32_t idx) const;
-
-    //------------------------------------------------------------------
-    /// Save the TTY state information for the state at index \a idx.
-    /// The TTY state is saved for the file descriptor \a fd and
-    /// the process group information will also be saved if requested
-    /// by \a save_process_group.
-    ///
-    /// @param[in] idx
-    ///     The index into the state array where the state should be
-    ///     saved.
-    ///
-    /// @param[in] fd
-    ///     The file descriptor for which to save the settings.
-    ///
-    /// @param[in] save_process_group
-    ///     If \b true, save the process group information for the TTY.
-    ///
-    /// @return
-    ///     Returns \b true if the save was successful, \b false
-    ///     otherwise.
-    //------------------------------------------------------------------
-    bool
-    Save (uint32_t idx, int fd, bool save_process_group);
+  //------------------------------------------------------------------
+  /// Constructor
+  //------------------------------------------------------------------
+  TerminalStateSwitcher();
+
+  //------------------------------------------------------------------
+  /// Destructor
+  //------------------------------------------------------------------
+  ~TerminalStateSwitcher();
+
+  //------------------------------------------------------------------
+  /// Get the number of possible states to save.
+  ///
+  /// @return
+  ///     The number of states that this TTY switcher object contains.
+  //------------------------------------------------------------------
+  uint32_t GetNumberOfStates() const;
+
+  //------------------------------------------------------------------
+  /// Restore the TTY state for state at index \a idx.
+  ///
+  /// @return
+  ///     Returns \b true if the TTY state was successfully restored,
+  ///     \b false otherwise.
+  //------------------------------------------------------------------
+  bool Restore(uint32_t idx) const;
+
+  //------------------------------------------------------------------
+  /// Save the TTY state information for the state at index \a idx.
+  /// The TTY state is saved for the file descriptor \a fd and
+  /// the process group information will also be saved if requested
+  /// by \a save_process_group.
+  ///
+  /// @param[in] idx
+  ///     The index into the state array where the state should be
+  ///     saved.
+  ///
+  /// @param[in] fd
+  ///     The file descriptor for which to save the settings.
+  ///
+  /// @param[in] save_process_group
+  ///     If \b true, save the process group information for the TTY.
+  ///
+  /// @return
+  ///     Returns \b true if the save was successful, \b false
+  ///     otherwise.
+  //------------------------------------------------------------------
+  bool Save(uint32_t idx, int fd, bool save_process_group);
 
 protected:
-    //------------------------------------------------------------------
-    // Member variables
-    //------------------------------------------------------------------
-    mutable uint32_t m_currentState; ///< The currently active TTY state index.
-    TerminalState m_ttystates[2]; ///< The array of TTY states that holds saved TTY info.
+  //------------------------------------------------------------------
+  // Member variables
+  //------------------------------------------------------------------
+  mutable uint32_t m_currentState; ///< The currently active TTY state index.
+  TerminalState
+      m_ttystates[2]; ///< The array of TTY states that holds saved TTY info.
 };
 
 } // namespace lldb_private
 
-#endif  // #if defined(__cplusplus)
-#endif  // #ifndef liblldb_Terminal_h_
+#endif // #if defined(__cplusplus)
+#endif // #ifndef liblldb_Terminal_h_

Modified: lldb/trunk/include/lldb/Host/ThisThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/ThisThread.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/ThisThread.h (original)
+++ lldb/trunk/include/lldb/Host/ThisThread.h Tue Sep  6 15:57:50 2016
@@ -14,26 +14,23 @@
 
 #include <string>
 
-namespace llvm
-{
+namespace llvm {
 template <class T> class SmallVectorImpl;
 }
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class ThisThread
-{
-  private:
-    ThisThread();
-
-  public:
-    // ThisThread common functions.
-    static void SetName(llvm::StringRef name, int max_length);
-
-    // ThisThread platform-specific functions.
-    static void SetName(llvm::StringRef name);
-    static void GetName(llvm::SmallVectorImpl<char> &name);
+class ThisThread {
+private:
+  ThisThread();
+
+public:
+  // ThisThread common functions.
+  static void SetName(llvm::StringRef name, int max_length);
+
+  // ThisThread platform-specific functions.
+  static void SetName(llvm::StringRef name);
+  static void GetName(llvm::SmallVectorImpl<char> &name);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/ThreadLauncher.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/ThreadLauncher.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/ThreadLauncher.h (original)
+++ lldb/trunk/include/lldb/Host/ThreadLauncher.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- ThreadLauncher.h -----------------------------------------*- C++ -*-===//
+//===-- ThreadLauncher.h -----------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -16,31 +17,27 @@
 
 #include "llvm/ADT/StringRef.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class ThreadLauncher
-{
-  public:
-    static HostThread LaunchThread(llvm::StringRef name,
-                                   lldb::thread_func_t thread_function,
-                                   lldb::thread_arg_t thread_arg,
-                                   Error *error_ptr,
-                                   size_t min_stack_byte_size = 0); // Minimum stack size in bytes, set stack size to zero for default platform thread stack size
-
-    struct HostThreadCreateInfo
-    {
-        std::string thread_name;
-        lldb::thread_func_t thread_fptr;
-        lldb::thread_arg_t thread_arg;
-
-        HostThreadCreateInfo(const char *name, lldb::thread_func_t fptr, lldb::thread_arg_t arg)
-            : thread_name(name ? name : "")
-            , thread_fptr(fptr)
-            , thread_arg(arg)
-        {
-        }
-    };
+class ThreadLauncher {
+public:
+  static HostThread
+  LaunchThread(llvm::StringRef name, lldb::thread_func_t thread_function,
+               lldb::thread_arg_t thread_arg, Error *error_ptr,
+               size_t min_stack_byte_size = 0); // Minimum stack size in bytes,
+                                                // set stack size to zero for
+                                                // default platform thread stack
+                                                // size
+
+  struct HostThreadCreateInfo {
+    std::string thread_name;
+    lldb::thread_func_t thread_fptr;
+    lldb::thread_arg_t thread_arg;
+
+    HostThreadCreateInfo(const char *name, lldb::thread_func_t fptr,
+                         lldb::thread_arg_t arg)
+        : thread_name(name ? name : ""), thread_fptr(fptr), thread_arg(arg) {}
+  };
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/Time.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Time.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Time.h (original)
+++ lldb/trunk/include/lldb/Host/Time.h Tue Sep  6 15:57:50 2016
@@ -18,7 +18,7 @@
 
 #if defined(__ANDROID_API__) && __ANDROID_API__ < 21
 #include <time64.h>
-extern time_t timegm(struct tm* t);
+extern time_t timegm(struct tm *t);
 #else
 #include <time.h>
 #endif

Modified: lldb/trunk/include/lldb/Host/TimeValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/TimeValue.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/TimeValue.h (original)
+++ lldb/trunk/include/lldb/Host/TimeValue.h Tue Sep  6 15:57:50 2016
@@ -11,8 +11,8 @@
 #define liblldb_TimeValue_h_
 
 // C Includes
-#include <stdint.h>
 #include "lldb/Host/PosixApi.h"
+#include <stdint.h>
 
 // C++ Includes
 // Other libraries and framework includes
@@ -21,105 +21,87 @@
 
 namespace lldb_private {
 
-class TimeValue
-{
+class TimeValue {
 public:
-    static const uint64_t MicroSecPerSec = 1000000UL;
-    static const uint64_t NanoSecPerSec = 1000000000UL;
-    static const uint64_t NanoSecPerMicroSec = 1000U;
-    static const uint64_t NanoSecPerMilliSec = 1000000UL;
-
-    //------------------------------------------------------------------
-    // Constructors and Destructors
-    //------------------------------------------------------------------
-    TimeValue();
-    TimeValue(const TimeValue& rhs);
-    TimeValue(const struct timespec& ts);
-    explicit TimeValue(uint32_t seconds, uint64_t nanos = 0);
-    ~TimeValue();
-
-    //------------------------------------------------------------------
-    // Operators
-    //------------------------------------------------------------------
-    const TimeValue&
-    operator=(const TimeValue& rhs);
-
-    void
-    Clear ();
-
-    uint64_t
-    GetAsNanoSecondsSinceJan1_1970() const;
-
-    uint64_t
-    GetAsMicroSecondsSinceJan1_1970() const;
-
-    uint64_t
-    GetAsSecondsSinceJan1_1970() const;
-
-    struct timespec
-    GetAsTimeSpec () const;
-
-    bool
-    IsValid () const;
-
-    void
-    OffsetWithSeconds (uint64_t sec);
-
-    void
-    OffsetWithMicroSeconds (uint64_t usec);
-
-    void
-    OffsetWithNanoSeconds (uint64_t nsec);
-
-    static TimeValue
-    Now();
-    
-    void
-    Dump (Stream *s, uint32_t width = 0) const;
-
-    /// Returns only the seconds component of the TimeValue. The nanoseconds
-    /// portion is ignored. No rounding is performed.
-    /// @brief Retrieve the seconds component
-    uint32_t seconds() const { return m_nano_seconds / NanoSecPerSec; }
-
-    /// Returns only the nanoseconds component of the TimeValue. The seconds
-    /// portion is ignored.
-    /// @brief Retrieve the nanoseconds component.
-    uint32_t nanoseconds() const { return m_nano_seconds % NanoSecPerSec; }
-
-    /// Returns only the fractional portion of the TimeValue rounded down to the
-    /// nearest microsecond (divide by one thousand).
-    /// @brief Retrieve the fractional part as microseconds;
-    uint32_t microseconds() const {
-        return (m_nano_seconds % NanoSecPerSec) / NanoSecPerMicroSec;
-    }
-
-    /// Returns only the fractional portion of the TimeValue rounded down to the
-    /// nearest millisecond (divide by one million).
-    /// @brief Retrieve the milliseconds component;
-    uint32_t
-    milliseconds() const
-    {
-        return m_nano_seconds / NanoSecPerMilliSec;
-    }
+  static const uint64_t MicroSecPerSec = 1000000UL;
+  static const uint64_t NanoSecPerSec = 1000000000UL;
+  static const uint64_t NanoSecPerMicroSec = 1000U;
+  static const uint64_t NanoSecPerMilliSec = 1000000UL;
+
+  //------------------------------------------------------------------
+  // Constructors and Destructors
+  //------------------------------------------------------------------
+  TimeValue();
+  TimeValue(const TimeValue &rhs);
+  TimeValue(const struct timespec &ts);
+  explicit TimeValue(uint32_t seconds, uint64_t nanos = 0);
+  ~TimeValue();
+
+  //------------------------------------------------------------------
+  // Operators
+  //------------------------------------------------------------------
+  const TimeValue &operator=(const TimeValue &rhs);
+
+  void Clear();
+
+  uint64_t GetAsNanoSecondsSinceJan1_1970() const;
+
+  uint64_t GetAsMicroSecondsSinceJan1_1970() const;
+
+  uint64_t GetAsSecondsSinceJan1_1970() const;
+
+  struct timespec GetAsTimeSpec() const;
+
+  bool IsValid() const;
+
+  void OffsetWithSeconds(uint64_t sec);
+
+  void OffsetWithMicroSeconds(uint64_t usec);
+
+  void OffsetWithNanoSeconds(uint64_t nsec);
+
+  static TimeValue Now();
+
+  void Dump(Stream *s, uint32_t width = 0) const;
+
+  /// Returns only the seconds component of the TimeValue. The nanoseconds
+  /// portion is ignored. No rounding is performed.
+  /// @brief Retrieve the seconds component
+  uint32_t seconds() const { return m_nano_seconds / NanoSecPerSec; }
+
+  /// Returns only the nanoseconds component of the TimeValue. The seconds
+  /// portion is ignored.
+  /// @brief Retrieve the nanoseconds component.
+  uint32_t nanoseconds() const { return m_nano_seconds % NanoSecPerSec; }
+
+  /// Returns only the fractional portion of the TimeValue rounded down to the
+  /// nearest microsecond (divide by one thousand).
+  /// @brief Retrieve the fractional part as microseconds;
+  uint32_t microseconds() const {
+    return (m_nano_seconds % NanoSecPerSec) / NanoSecPerMicroSec;
+  }
+
+  /// Returns only the fractional portion of the TimeValue rounded down to the
+  /// nearest millisecond (divide by one million).
+  /// @brief Retrieve the milliseconds component;
+  uint32_t milliseconds() const { return m_nano_seconds / NanoSecPerMilliSec; }
 
 protected:
-    //------------------------------------------------------------------
-    // Classes that inherit from TimeValue can see and modify these
-    //------------------------------------------------------------------
-    uint64_t m_nano_seconds;
+  //------------------------------------------------------------------
+  // Classes that inherit from TimeValue can see and modify these
+  //------------------------------------------------------------------
+  uint64_t m_nano_seconds;
 };
 
-bool operator == (const TimeValue &lhs, const TimeValue &rhs);
-bool operator != (const TimeValue &lhs, const TimeValue &rhs);
-bool operator <  (const TimeValue &lhs, const TimeValue &rhs);
-bool operator <= (const TimeValue &lhs, const TimeValue &rhs);
-bool operator >  (const TimeValue &lhs, const TimeValue &rhs);
-bool operator >= (const TimeValue &lhs, const TimeValue &rhs);
+bool operator==(const TimeValue &lhs, const TimeValue &rhs);
+bool operator!=(const TimeValue &lhs, const TimeValue &rhs);
+bool operator<(const TimeValue &lhs, const TimeValue &rhs);
+bool operator<=(const TimeValue &lhs, const TimeValue &rhs);
+bool operator>(const TimeValue &lhs, const TimeValue &rhs);
+bool operator>=(const TimeValue &lhs, const TimeValue &rhs);
 
-uint64_t operator -(const TimeValue &lhs, const TimeValue &rhs);
+uint64_t operator-(const TimeValue &lhs, const TimeValue &rhs);
 
 } // namespace lldb_private
 
-
-#endif  // liblldb_TimeValue_h_
+#endif // liblldb_TimeValue_h_

Modified: lldb/trunk/include/lldb/Host/XML.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/XML.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/XML.h (original)
+++ lldb/trunk/include/lldb/Host/XML.h Tue Sep  6 15:57:50 2016
@@ -11,7 +11,7 @@
 #define liblldb_XML_h_
 
 // C Includes
-#if defined( LIBXML2_DEFINED )
+#if defined(LIBXML2_DEFINED)
 #include <libxml/xmlreader.h>
 #endif
 
@@ -24,208 +24,168 @@
 #include "llvm/ADT/StringRef.h"
 
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/StructuredData.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
 
-#if defined( LIBXML2_DEFINED )
-    typedef xmlNodePtr XMLNodeImpl;
-    typedef xmlDocPtr  XMLDocumentImpl;
+#if defined(LIBXML2_DEFINED)
+typedef xmlNodePtr XMLNodeImpl;
+typedef xmlDocPtr XMLDocumentImpl;
 #else
-    typedef void * XMLNodeImpl;
-    typedef void * XMLDocumentImpl;
+typedef void *XMLNodeImpl;
+typedef void *XMLDocumentImpl;
 #endif
 
-    class XMLNode;
-    
-    typedef std::vector<std::string> NamePath;
-    typedef std::function <bool(const XMLNode &node)> NodeCallback;
-    typedef std::function <bool(const llvm::StringRef &name, const llvm::StringRef &value)> AttributeCallback;
-
-    class XMLNode
-    {
-    public:
-        XMLNode();
-        
-        XMLNode(XMLNodeImpl node);
-        
-        ~XMLNode();
-        
-        explicit operator bool() const
-        {
-            return IsValid();
-        }
-        
-        void
-        Clear();
-        
-        bool
-        IsValid() const;
-        
-        bool
-        IsElement () const;
-
-        llvm::StringRef
-        GetName() const;
-        
-        bool
-        GetElementText (std::string &text) const;
-
-        bool
-        GetElementTextAsUnsigned (uint64_t &value, uint64_t fail_value = 0, int base = 0) const;
-
-        bool
-        GetElementTextAsFloat (double &value, double fail_value = 0.0) const;
-
-        bool
-        NameIs (const char *name) const;
-        
-        XMLNode
-        GetParent() const;
-        
-        XMLNode
-        GetSibling() const;
-        
-        XMLNode
-        GetChild () const;
-        
-        llvm::StringRef
-        GetAttributeValue(const char *name, const char *fail_value = nullptr) const;
-        
-        XMLNode
-        FindFirstChildElementWithName (const char *name) const;
-        
-        XMLNode
-        GetElementForPath (const NamePath &path);
-        
-        //----------------------------------------------------------------------
-        // Iterate through all sibling nodes of any type
-        //----------------------------------------------------------------------
-        void
-        ForEachSiblingNode (NodeCallback const &callback) const;
-
-        //----------------------------------------------------------------------
-        // Iterate through only the sibling nodes that are elements
-        //----------------------------------------------------------------------
-        void
-        ForEachSiblingElement (NodeCallback const &callback) const;
-
-        //----------------------------------------------------------------------
-        // Iterate through only the sibling nodes that are elements and whose
-        // name matches \a name.
-        //----------------------------------------------------------------------
-        void
-        ForEachSiblingElementWithName (const char *name, NodeCallback const &callback) const;
-        
-        void
-        ForEachChildNode (NodeCallback const &callback) const;
-        
-        void
-        ForEachChildElement (NodeCallback const &callback) const;
-        
-        void
-        ForEachChildElementWithName (const char *name, NodeCallback const &callback) const;
-        
-        void
-        ForEachAttribute (AttributeCallback const &callback) const;
-        
-    protected:
-        XMLNodeImpl m_node;
-    };
-
-    class XMLDocument
-    {
-    public:
-        XMLDocument ();
-        
-        ~XMLDocument ();
-        
-        explicit operator bool() const
-        {
-            return IsValid();
-        }
-        
-        bool
-        IsValid() const;
-        
-        void
-        Clear();
-        
-        bool
-        ParseFile (const char *path);
-        
-        bool
-        ParseMemory (const char *xml, size_t xml_length, const char *url = "untitled.xml");
-
-        //----------------------------------------------------------------------
-        // If \a name is nullptr, just get the root element node, else only return
-        // a value XMLNode if the name of the root element matches \a name.
-        //----------------------------------------------------------------------
-        XMLNode
-        GetRootElement(const char *required_name = nullptr);
-
-        const std::string &
-        GetErrors() const;
-        
-        static void
-        ErrorCallback (void *ctx, const char *format, ...);
-
-        static bool
-        XMLEnabled ();
-        
-    protected:
-        XMLDocumentImpl m_document;
-        StreamString m_errors;
-    };
-
-    class ApplePropertyList
-    {
-    public:
-        ApplePropertyList();
-
-        ApplePropertyList(const char *path);
-
-        ~ApplePropertyList();
-
-        bool
-        ParseFile (const char *path);
-
-        const std::string &
-        GetErrors() const;
-        
-        explicit operator bool() const
-        {
-            return IsValid();
-        }
-        
-        bool
-        IsValid() const;
-        
-        XMLNode
-        GetValueNode (const char *key) const;
-
-        bool
-        GetValueAsString (const char *key, std::string &value) const;
-
-        StructuredData::ObjectSP
-        GetStructuredData();
-
-    protected:
-        // Using a node returned from GetValueNode() extract its value as a
-        // string (if possible). Array and dictionary nodes will return false
-        // as they have no string value. Boolean nodes will return true and
-        // \a value will be "true" or "false" as the string value comes from
-        // the element name itself. All other nodes will return the text
-        // content of the XMLNode.
-        static bool
-        ExtractStringFromValueNode (const XMLNode &node, std::string &value);
-
-        XMLDocument m_xml_doc;
-        XMLNode m_dict_node;
-    };
+class XMLNode;
+
+typedef std::vector<std::string> NamePath;
+typedef std::function<bool(const XMLNode &node)> NodeCallback;
+typedef std::function<bool(const llvm::StringRef &name,
+                           const llvm::StringRef &value)>
+    AttributeCallback;
+
+class XMLNode {
+public:
+  XMLNode();
+
+  XMLNode(XMLNodeImpl node);
+
+  ~XMLNode();
+
+  explicit operator bool() const { return IsValid(); }
+
+  void Clear();
+
+  bool IsValid() const;
+
+  bool IsElement() const;
+
+  llvm::StringRef GetName() const;
+
+  bool GetElementText(std::string &text) const;
+
+  bool GetElementTextAsUnsigned(uint64_t &value, uint64_t fail_value = 0,
+                                int base = 0) const;
+
+  bool GetElementTextAsFloat(double &value, double fail_value = 0.0) const;
+
+  bool NameIs(const char *name) const;
+
+  XMLNode GetParent() const;
+
+  XMLNode GetSibling() const;
+
+  XMLNode GetChild() const;
+
+  llvm::StringRef GetAttributeValue(const char *name,
+                                    const char *fail_value = nullptr) const;
+
+  XMLNode FindFirstChildElementWithName(const char *name) const;
+
+  XMLNode GetElementForPath(const NamePath &path);
+
+  //----------------------------------------------------------------------
+  // Iterate through all sibling nodes of any type
+  //----------------------------------------------------------------------
+  void ForEachSiblingNode(NodeCallback const &callback) const;
+
+  //----------------------------------------------------------------------
+  // Iterate through only the sibling nodes that are elements
+  //----------------------------------------------------------------------
+  void ForEachSiblingElement(NodeCallback const &callback) const;
+
+  //----------------------------------------------------------------------
+  // Iterate through only the sibling nodes that are elements and whose
+  // name matches \a name.
+  //----------------------------------------------------------------------
+  void ForEachSiblingElementWithName(const char *name,
+                                     NodeCallback const &callback) const;
+
+  void ForEachChildNode(NodeCallback const &callback) const;
+
+  void ForEachChildElement(NodeCallback const &callback) const;
+
+  void ForEachChildElementWithName(const char *name,
+                                   NodeCallback const &callback) const;
+
+  void ForEachAttribute(AttributeCallback const &callback) const;
+
+protected:
+  XMLNodeImpl m_node;
+};
+
+class XMLDocument {
+public:
+  XMLDocument();
+
+  ~XMLDocument();
+
+  explicit operator bool() const { return IsValid(); }
+
+  bool IsValid() const;
+
+  void Clear();
+
+  bool ParseFile(const char *path);
+
+  bool ParseMemory(const char *xml, size_t xml_length,
+                   const char *url = "untitled.xml");
+
+  //----------------------------------------------------------------------
+  // If \a name is nullptr, just get the root element node, else only return
+  // a value XMLNode if the name of the root element matches \a name.
+  //----------------------------------------------------------------------
+  XMLNode GetRootElement(const char *required_name = nullptr);
+
+  const std::string &GetErrors() const;
+
+  static void ErrorCallback(void *ctx, const char *format, ...);
+
+  static bool XMLEnabled();
+
+protected:
+  XMLDocumentImpl m_document;
+  StreamString m_errors;
+};
+
+class ApplePropertyList {
+public:
+  ApplePropertyList();
+
+  ApplePropertyList(const char *path);
+
+  ~ApplePropertyList();
+
+  bool ParseFile(const char *path);
+
+  const std::string &GetErrors() const;
+
+  explicit operator bool() const { return IsValid(); }
+
+  bool IsValid() const;
+
+  XMLNode GetValueNode(const char *key) const;
+
+  bool GetValueAsString(const char *key, std::string &value) const;
+
+  StructuredData::ObjectSP GetStructuredData();
+
+protected:
+  // Using a node returned from GetValueNode() extract its value as a
+  // string (if possible). Array and dictionary nodes will return false
+  // as they have no string value. Boolean nodes will return true and
+  // \a value will be "true" or "false" as the string value comes from
+  // the element name itself. All other nodes will return the text
+  // content of the XMLNode.
+  static bool ExtractStringFromValueNode(const XMLNode &node,
+                                         std::string &value);
+
+  XMLDocument m_xml_doc;
+  XMLNode m_dict_node;
+};
 
 } // namespace lldb_private
 
-#endif  // liblldb_XML_h_
+#endif // liblldb_XML_h_

Modified: lldb/trunk/include/lldb/Host/android/HostInfoAndroid.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/android/HostInfoAndroid.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/android/HostInfoAndroid.h (original)
+++ lldb/trunk/include/lldb/Host/android/HostInfoAndroid.h Tue Sep  6 15:57:50 2016
@@ -12,20 +12,20 @@
 
 #include "lldb/Host/linux/HostInfoLinux.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class HostInfoAndroid : public HostInfoLinux
-{
-    friend class HostInfoBase;
-
-  public:
-    static FileSpec GetDefaultShell();
-    static FileSpec ResolveLibraryPath (const std::string& path, const ArchSpec& arch);
-
-  protected:
-    static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);
-    static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
+class HostInfoAndroid : public HostInfoLinux {
+  friend class HostInfoBase;
+
+public:
+  static FileSpec GetDefaultShell();
+  static FileSpec ResolveLibraryPath(const std::string &path,
+                                     const ArchSpec &arch);
+
+protected:
+  static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
+                                             ArchSpec &arch_64);
+  static bool ComputeTempFileBaseDirectory(FileSpec &file_spec);
 };
 
 } // end of namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/common/GetOptInc.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/GetOptInc.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/GetOptInc.h (original)
+++ lldb/trunk/include/lldb/Host/common/GetOptInc.h Tue Sep  6 15:57:50 2016
@@ -12,54 +12,41 @@
 
 #if defined(REPLACE_GETOPT)
 // from getopt.h
-#define no_argument       0
+#define no_argument 0
 #define required_argument 1
 #define optional_argument 2
 
 // option structure
-struct option
-{
-    const char *name;
-    // has_arg can't be an enum because some compilers complain about
-    // type mismatches in all the code that assumes it is an int.
-    int  has_arg;
-    int *flag;
-    int  val;
+struct option {
+  const char *name;
+  // has_arg can't be an enum because some compilers complain about
+  // type mismatches in all the code that assumes it is an int.
+  int has_arg;
+  int *flag;
+  int val;
 };
 
-int getopt( int argc, char * const argv[], const char *optstring );
+int getopt(int argc, char *const argv[], const char *optstring);
 
 // from getopt.h
-extern char * optarg;
-extern int    optind;
-extern int    opterr;
-extern int    optopt;
+extern char *optarg;
+extern int optind;
+extern int opterr;
+extern int optopt;
 
 // defined in unistd.h
-extern int    optreset;
+extern int optreset;
 #else
-# include <unistd.h>
-# include <getopt.h>
+#include <getopt.h>
+#include <unistd.h>
 #endif
 
 #if defined(REPLACE_GETOPT_LONG)
-int getopt_long
-(
-    int argc,
-    char * const *argv,
-    const char *optstring,
-    const struct option *longopts,
-    int *longindex
-);
+int getopt_long(int argc, char *const *argv, const char *optstring,
+                const struct option *longopts, int *longindex);
 #endif
 
 #if defined(REPLACE_GETOPT_LONG_ONLY)
-int getopt_long_only
-(
-    int argc,
-    char * const *argv,
-    const char *optstring,
-    const struct option *longopts,
-    int *longindex
-);
+int getopt_long_only(int argc, char *const *argv, const char *optstring,
+                     const struct option *longopts, int *longindex);
 #endif

Modified: lldb/trunk/include/lldb/Host/common/NativeBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeBreakpoint.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeBreakpoint.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeBreakpoint.h Tue Sep  6 15:57:50 2016
@@ -12,55 +12,45 @@
 
 #include "lldb/lldb-types.h"
 
-namespace lldb_private
-{
-    class NativeBreakpointList;
+namespace lldb_private {
+class NativeBreakpointList;
 
-    class NativeBreakpoint
-    {
-        friend class NativeBreakpointList;
+class NativeBreakpoint {
+  friend class NativeBreakpointList;
 
-    public:
-        // The assumption is that derived breakpoints are enabled when created.
-        NativeBreakpoint (lldb::addr_t addr);
+public:
+  // The assumption is that derived breakpoints are enabled when created.
+  NativeBreakpoint(lldb::addr_t addr);
 
-        virtual
-        ~NativeBreakpoint ();
+  virtual ~NativeBreakpoint();
 
-        Error
-        Enable ();
+  Error Enable();
 
-        Error
-        Disable ();
+  Error Disable();
 
-        lldb::addr_t
-        GetAddress () const { return m_addr; }
+  lldb::addr_t GetAddress() const { return m_addr; }
 
-        bool
-        IsEnabled () const { return m_enabled; }
+  bool IsEnabled() const { return m_enabled; }
 
-        virtual bool
-        IsSoftwareBreakpoint () const = 0;
+  virtual bool IsSoftwareBreakpoint() const = 0;
 
-    protected:
-        const lldb::addr_t m_addr;
-        int32_t m_ref_count;
+protected:
+  const lldb::addr_t m_addr;
+  int32_t m_ref_count;
 
-        virtual Error
-        DoEnable () = 0;
+  virtual Error DoEnable() = 0;
 
-        virtual Error
-        DoDisable () = 0;
+  virtual Error DoDisable() = 0;
 
-    private:
-        bool m_enabled;
+private:
+  bool m_enabled;
 
-        // -----------------------------------------------------------
-        // interface for NativeBreakpointList
-        // -----------------------------------------------------------
-        void AddRef ();
-        int32_t DecRef ();
-    };
+  // -----------------------------------------------------------
+  // interface for NativeBreakpointList
+  // -----------------------------------------------------------
+  void AddRef();
+  int32_t DecRef();
+};
 }
 
 #endif // ifndef liblldb_NativeBreakpoint_h_

Modified: lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeBreakpointList.h Tue Sep  6 15:57:50 2016
@@ -10,47 +10,42 @@
 #ifndef liblldb_NativeBreakpointList_h_
 #define liblldb_NativeBreakpointList_h_
 
-#include "lldb/lldb-private-forward.h"
 #include "lldb/Core/Error.h"
+#include "lldb/lldb-private-forward.h"
 // #include "lldb/Host/NativeBreakpoint.h"
 
 #include <functional>
 #include <map>
 #include <mutex>
 
-namespace lldb_private
-{
-    class NativeBreakpointList
-    {
-    public:
-        typedef std::function<Error (lldb::addr_t addr, size_t size_hint, bool hardware, NativeBreakpointSP &breakpoint_sp)> CreateBreakpointFunc;
+namespace lldb_private {
+class NativeBreakpointList {
+public:
+  typedef std::function<Error(lldb::addr_t addr, size_t size_hint,
+                              bool hardware, NativeBreakpointSP &breakpoint_sp)>
+      CreateBreakpointFunc;
 
-        NativeBreakpointList ();
+  NativeBreakpointList();
 
-        Error
-        AddRef (lldb::addr_t addr, size_t size_hint, bool hardware, CreateBreakpointFunc create_func);
+  Error AddRef(lldb::addr_t addr, size_t size_hint, bool hardware,
+               CreateBreakpointFunc create_func);
 
-        Error
-        DecRef (lldb::addr_t addr);
+  Error DecRef(lldb::addr_t addr);
 
-        Error
-        EnableBreakpoint (lldb::addr_t addr);
+  Error EnableBreakpoint(lldb::addr_t addr);
 
-        Error
-        DisableBreakpoint (lldb::addr_t addr);
+  Error DisableBreakpoint(lldb::addr_t addr);
 
-        Error
-        GetBreakpoint (lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp);
+  Error GetBreakpoint(lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp);
 
-        Error
-        RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const;
+  Error RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const;
 
-    private:
-        typedef std::map<lldb::addr_t, NativeBreakpointSP> BreakpointMap;
+private:
+  typedef std::map<lldb::addr_t, NativeBreakpointSP> BreakpointMap;
 
-        std::recursive_mutex m_mutex;
-        BreakpointMap m_breakpoints;
-    };
+  std::recursive_mutex m_mutex;
+  BreakpointMap m_breakpoints;
+};
 }
 
 #endif // ifndef liblldb_NativeBreakpointList_h_

Modified: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h Tue Sep  6 15:57:50 2016
@@ -13,419 +13,349 @@
 #include <mutex>
 #include <vector>
 
-#include "lldb/lldb-private-forward.h"
-#include "lldb/lldb-types.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Host/MainLoop.h"
+#include "lldb/lldb-private-forward.h"
+#include "lldb/lldb-types.h"
 #include "llvm/ADT/StringRef.h"
 
 #include "NativeBreakpointList.h"
 #include "NativeWatchpointList.h"
 
-namespace lldb_private
-{
-    class MemoryRegionInfo;
-    class ResumeActionList;
-
-    //------------------------------------------------------------------
-    // NativeProcessProtocol
-    //------------------------------------------------------------------
-    class NativeProcessProtocol :
-        public std::enable_shared_from_this<NativeProcessProtocol>
-    {
-        friend class SoftwareBreakpoint;
-
-    public:
-
-        virtual ~NativeProcessProtocol ()
-        {
-        }
-
-        virtual Error
-        Resume (const ResumeActionList &resume_actions) = 0;
-
-        virtual Error
-        Halt () = 0;
-
-        virtual Error
-        Detach () = 0;
-
-        //------------------------------------------------------------------
-        /// Sends a process a UNIX signal \a signal.
-        ///
-        /// @return
-        ///     Returns an error object.
-        //------------------------------------------------------------------
-        virtual Error
-        Signal (int signo) = 0;
-
-        //------------------------------------------------------------------
-        /// Tells a process to interrupt all operations as if by a Ctrl-C.
-        ///
-        /// The default implementation will send a local host's equivalent of
-        /// a SIGSTOP to the process via the NativeProcessProtocol::Signal()
-        /// operation.
-        ///
-        /// @return
-        ///     Returns an error object.
-        //------------------------------------------------------------------
-        virtual Error
-        Interrupt ();
-
-        virtual Error
-        Kill () = 0;
-
-        //----------------------------------------------------------------------
-        // Memory and memory region functions
-        //----------------------------------------------------------------------
-
-        virtual Error
-        GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info);
-
-        virtual Error
-        ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) = 0;
-
-        virtual Error
-        ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) = 0;
-
-        virtual Error
-        WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written) = 0;
-
-        virtual Error
-        AllocateMemory(size_t size, uint32_t permissions, lldb::addr_t &addr) = 0;
-
-        virtual Error
-        DeallocateMemory (lldb::addr_t addr) = 0;
-
-        virtual lldb::addr_t
-        GetSharedLibraryInfoAddress () = 0;
-
-        virtual bool
-        IsAlive () const;
-
-        virtual size_t
-        UpdateThreads () = 0;
-
-        virtual bool
-        GetArchitecture (ArchSpec &arch) const = 0;
-
-        //----------------------------------------------------------------------
-        // Breakpoint functions
-        //----------------------------------------------------------------------
-        virtual Error
-        SetBreakpoint (lldb::addr_t addr, uint32_t size, bool hardware) = 0;
-
-        virtual Error
-        RemoveBreakpoint (lldb::addr_t addr);
-
-        virtual Error
-        EnableBreakpoint (lldb::addr_t addr);
-
-        virtual Error
-        DisableBreakpoint (lldb::addr_t addr);
-
-        //----------------------------------------------------------------------
-        // Watchpoint functions
-        //----------------------------------------------------------------------
-        virtual const NativeWatchpointList::WatchpointMap&
-        GetWatchpointMap () const;
-
-        virtual uint32_t
-        GetMaxWatchpoints () const;
-
-        virtual Error
-        SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware);
-
-        virtual Error
-        RemoveWatchpoint (lldb::addr_t addr);
-
-        //----------------------------------------------------------------------
-        // Accessors
-        //----------------------------------------------------------------------
-        lldb::pid_t
-        GetID() const
-        {
-            return m_pid;
-        }
-
-        lldb::StateType
-        GetState () const;
-
-        bool
-        IsRunning () const
-        {
-            return m_state == lldb::eStateRunning || IsStepping();
-        }
-
-        bool
-        IsStepping () const
-        {
-            return m_state == lldb::eStateStepping;
-        }
-
-        bool
-        CanResume () const
-        {
-            return m_state == lldb::eStateStopped;
-        }
-
-        bool
-        GetByteOrder (lldb::ByteOrder &byte_order) const;
-
-        //----------------------------------------------------------------------
-        // Exit Status
-        //----------------------------------------------------------------------
-        virtual bool
-        GetExitStatus (lldb_private::ExitType *exit_type, int *status, std::string &exit_description);
-
-        virtual bool
-        SetExitStatus (lldb_private::ExitType exit_type, int status, const char *exit_description, bool bNotifyStateChange);
-
-        //----------------------------------------------------------------------
-        // Access to threads
-        //----------------------------------------------------------------------
-        NativeThreadProtocolSP
-        GetThreadAtIndex (uint32_t idx);
-
-        NativeThreadProtocolSP
-        GetThreadByID (lldb::tid_t tid);
-
-        void
-        SetCurrentThreadID (lldb::tid_t tid)
-        {
-            m_current_thread_id = tid;
-        }
-
-        lldb::tid_t
-        GetCurrentThreadID ()
-        {
-            return m_current_thread_id;
-        }
-
-        NativeThreadProtocolSP
-        GetCurrentThread ()
-        {
-            return GetThreadByID (m_current_thread_id);
-        }
-
-        //----------------------------------------------------------------------
-        // Access to inferior stdio
-        //----------------------------------------------------------------------
-        virtual
-        int GetTerminalFileDescriptor ()
-        {
-            return m_terminal_fd;
-        }
-
-        //----------------------------------------------------------------------
-        // Stop id interface
-        //----------------------------------------------------------------------
-
-        uint32_t
-        GetStopID () const;
-
-        // ---------------------------------------------------------------------
-        // Callbacks for low-level process state changes
-        // ---------------------------------------------------------------------
-        class NativeDelegate
-        {
-        public:
-            virtual
-            ~NativeDelegate () {}
-
-            virtual void
-            InitializeDelegate (NativeProcessProtocol *process) = 0;
-
-            virtual void
-            ProcessStateChanged (NativeProcessProtocol *process, lldb::StateType state) = 0;
-
-            virtual void
-            DidExec (NativeProcessProtocol *process) = 0;
-        };
-
-        //------------------------------------------------------------------
-        /// Register a native delegate.
-        ///
-        /// Clients can register nofication callbacks by passing in a
-        /// NativeDelegate impl and passing it into this function.
-        ///
-        /// Note: it is required that the lifetime of the
-        /// native_delegate outlive the NativeProcessProtocol.
-        ///
-        /// @param[in] native_delegate
-        ///     A NativeDelegate impl to be called when certain events
-        ///     happen within the NativeProcessProtocol or related threads.
-        ///
-        /// @return
-        ///     true if the delegate was registered successfully;
-        ///     false if the delegate was already registered.
-        ///
-        /// @see NativeProcessProtocol::NativeDelegate.
-        //------------------------------------------------------------------
-        bool
-        RegisterNativeDelegate (NativeDelegate &native_delegate);
-
-        //------------------------------------------------------------------
-        /// Unregister a native delegate previously registered.
-        ///
-        /// @param[in] native_delegate
-        ///     A NativeDelegate impl previously registered with this process.
-        ///
-        /// @return Returns \b true if the NativeDelegate was
-        /// successfully removed from the process, \b false otherwise.
-        ///
-        /// @see NativeProcessProtocol::NativeDelegate
-        //------------------------------------------------------------------
-        bool
-        UnregisterNativeDelegate (NativeDelegate &native_delegate);
-
-        virtual Error
-        GetLoadedModuleFileSpec(const char* module_path, FileSpec& file_spec) = 0;
-
-        virtual Error
-        GetFileLoadAddress(const llvm::StringRef& file_name, lldb::addr_t& load_addr) = 0;
-
-        //------------------------------------------------------------------
-        /// Launch a process for debugging. This method will create an concrete
-        /// instance of NativeProcessProtocol, based on the host platform.
-        /// (e.g. NativeProcessLinux on linux, etc.)
-        ///
-        /// @param[in] launch_info
-        ///     Information required to launch the process.
-        ///
-        /// @param[in] native_delegate
-        ///     The delegate that will receive messages regarding the
-        ///     inferior.  Must outlive the NativeProcessProtocol
-        ///     instance.
-        ///
-        /// @param[in] mainloop
-        ///     The mainloop instance with which the process can register
-        ///     callbacks. Must outlive the NativeProcessProtocol
-        ///     instance.
-        ///
-        /// @param[out] process_sp
-        ///     On successful return from the method, this parameter
-        ///     contains the shared pointer to the
-        ///     NativeProcessProtocol that can be used to manipulate
-        ///     the native process.
-        ///
-        /// @return
-        ///     An error object indicating if the operation succeeded,
-        ///     and if not, what error occurred.
-        //------------------------------------------------------------------
-        static Error
-        Launch (ProcessLaunchInfo &launch_info,
-                NativeDelegate &native_delegate,
-                MainLoop &mainloop,
-                NativeProcessProtocolSP &process_sp);
-
-        //------------------------------------------------------------------
-        /// Attach to an existing process. This method will create an concrete
-        /// instance of NativeProcessProtocol, based on the host platform.
-        /// (e.g. NativeProcessLinux on linux, etc.)
-        ///
-        /// @param[in] pid
-        ///     pid of the process locatable
-        ///
-        /// @param[in] native_delegate
-        ///     The delegate that will receive messages regarding the
-        ///     inferior.  Must outlive the NativeProcessProtocol
-        ///     instance.
-        ///
-        /// @param[in] mainloop
-        ///     The mainloop instance with which the process can register
-        ///     callbacks. Must outlive the NativeProcessProtocol
-        ///     instance.
-        ///
-        /// @param[out] process_sp
-        ///     On successful return from the method, this parameter
-        ///     contains the shared pointer to the
-        ///     NativeProcessProtocol that can be used to manipulate
-        ///     the native process.
-        ///
-        /// @return
-        ///     An error object indicating if the operation succeeded,
-        ///     and if not, what error occurred.
-        //------------------------------------------------------------------
-        static Error
-        Attach (lldb::pid_t pid,
-                NativeDelegate &native_delegate,
-                MainLoop &mainloop,
-                NativeProcessProtocolSP &process_sp);
-
-    protected:
-        lldb::pid_t m_pid;
-
-        std::vector<NativeThreadProtocolSP> m_threads;
-        lldb::tid_t m_current_thread_id;
-        mutable std::recursive_mutex m_threads_mutex;
-
-        lldb::StateType m_state;
-        mutable std::recursive_mutex m_state_mutex;
-
-        lldb_private::ExitType m_exit_type;
-        int m_exit_status;
-        std::string m_exit_description;
-        std::recursive_mutex m_delegates_mutex;
-        std::vector<NativeDelegate*> m_delegates;
-        NativeBreakpointList m_breakpoint_list;
-        NativeWatchpointList m_watchpoint_list;
-        int m_terminal_fd;
-        uint32_t m_stop_id;
-
-        // lldb_private::Host calls should be used to launch a process for debugging, and
-        // then the process should be attached to. When attaching to a process
-        // lldb_private::Host calls should be used to locate the process to attach to,
-        // and then this function should be called.
-        NativeProcessProtocol (lldb::pid_t pid);
-
-        // -----------------------------------------------------------
-        // Internal interface for state handling
-        // -----------------------------------------------------------
-        void
-        SetState (lldb::StateType state, bool notify_delegates = true);
-
-        // Derived classes need not implement this.  It can be used as a
-        // hook to clear internal caches that should be invalidated when
-        // stop ids change.
-        //
-        // Note this function is called with the state mutex obtained
-        // by the caller.
-        virtual void
-        DoStopIDBumped (uint32_t newBumpId);
-
-        // -----------------------------------------------------------
-        // Internal interface for software breakpoints
-        // -----------------------------------------------------------
-        Error
-        SetSoftwareBreakpoint (lldb::addr_t addr, uint32_t size_hint);
-
-        virtual Error
-        GetSoftwareBreakpointTrapOpcode (size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) = 0;
-
-        // -----------------------------------------------------------
-        /// Notify the delegate that an exec occurred.
-        ///
-        /// Provide a mechanism for a delegate to clear out any exec-
-        /// sensitive data.
-        // -----------------------------------------------------------
-        void
-        NotifyDidExec ();
-
-        NativeThreadProtocolSP
-        GetThreadByIDUnlocked (lldb::tid_t tid);
-
-        // -----------------------------------------------------------
-        // Static helper methods for derived classes.
-        // -----------------------------------------------------------
-        static Error
-        ResolveProcessArchitecture(lldb::pid_t pid, ArchSpec &arch);
-
-    private:
-
-        void
-        SynchronouslyNotifyProcessStateChanged (lldb::StateType state);
-    };
+namespace lldb_private {
+class MemoryRegionInfo;
+class ResumeActionList;
+
+//------------------------------------------------------------------
+// NativeProcessProtocol
+//------------------------------------------------------------------
+class NativeProcessProtocol
+    : public std::enable_shared_from_this<NativeProcessProtocol> {
+  friend class SoftwareBreakpoint;
+
+public:
+  virtual ~NativeProcessProtocol() {}
+
+  virtual Error Resume(const ResumeActionList &resume_actions) = 0;
+
+  virtual Error Halt() = 0;
+
+  virtual Error Detach() = 0;
+
+  //------------------------------------------------------------------
+  /// Sends a process a UNIX signal \a signal.
+  ///
+  /// @return
+  ///     Returns an error object.
+  //------------------------------------------------------------------
+  virtual Error Signal(int signo) = 0;
+
+  //------------------------------------------------------------------
+  /// Tells a process to interrupt all operations as if by a Ctrl-C.
+  ///
+  /// The default implementation will send a local host's equivalent of
+  /// a SIGSTOP to the process via the NativeProcessProtocol::Signal()
+  /// operation.
+  ///
+  /// @return
+  ///     Returns an error object.
+  //------------------------------------------------------------------
+  virtual Error Interrupt();
+
+  virtual Error Kill() = 0;
+
+  //----------------------------------------------------------------------
+  // Memory and memory region functions
+  //----------------------------------------------------------------------
+
+  virtual Error GetMemoryRegionInfo(lldb::addr_t load_addr,
+                                    MemoryRegionInfo &range_info);
+
+  virtual Error ReadMemory(lldb::addr_t addr, void *buf, size_t size,
+                           size_t &bytes_read) = 0;
+
+  virtual Error ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size,
+                                      size_t &bytes_read) = 0;
+
+  virtual Error WriteMemory(lldb::addr_t addr, const void *buf, size_t size,
+                            size_t &bytes_written) = 0;
+
+  virtual Error AllocateMemory(size_t size, uint32_t permissions,
+                               lldb::addr_t &addr) = 0;
+
+  virtual Error DeallocateMemory(lldb::addr_t addr) = 0;
+
+  virtual lldb::addr_t GetSharedLibraryInfoAddress() = 0;
+
+  virtual bool IsAlive() const;
+
+  virtual size_t UpdateThreads() = 0;
+
+  virtual bool GetArchitecture(ArchSpec &arch) const = 0;
+
+  //----------------------------------------------------------------------
+  // Breakpoint functions
+  //----------------------------------------------------------------------
+  virtual Error SetBreakpoint(lldb::addr_t addr, uint32_t size,
+                              bool hardware) = 0;
+
+  virtual Error RemoveBreakpoint(lldb::addr_t addr);
+
+  virtual Error EnableBreakpoint(lldb::addr_t addr);
+
+  virtual Error DisableBreakpoint(lldb::addr_t addr);
+
+  //----------------------------------------------------------------------
+  // Watchpoint functions
+  //----------------------------------------------------------------------
+  virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const;
+
+  virtual uint32_t GetMaxWatchpoints() const;
+
+  virtual Error SetWatchpoint(lldb::addr_t addr, size_t size,
+                              uint32_t watch_flags, bool hardware);
+
+  virtual Error RemoveWatchpoint(lldb::addr_t addr);
+
+  //----------------------------------------------------------------------
+  // Accessors
+  //----------------------------------------------------------------------
+  lldb::pid_t GetID() const { return m_pid; }
+
+  lldb::StateType GetState() const;
+
+  bool IsRunning() const {
+    return m_state == lldb::eStateRunning || IsStepping();
+  }
+
+  bool IsStepping() const { return m_state == lldb::eStateStepping; }
+
+  bool CanResume() const { return m_state == lldb::eStateStopped; }
+
+  bool GetByteOrder(lldb::ByteOrder &byte_order) const;
+
+  //----------------------------------------------------------------------
+  // Exit Status
+  //----------------------------------------------------------------------
+  virtual bool GetExitStatus(lldb_private::ExitType *exit_type, int *status,
+                             std::string &exit_description);
+
+  virtual bool SetExitStatus(lldb_private::ExitType exit_type, int status,
+                             const char *exit_description,
+                             bool bNotifyStateChange);
+
+  //----------------------------------------------------------------------
+  // Access to threads
+  //----------------------------------------------------------------------
+  NativeThreadProtocolSP GetThreadAtIndex(uint32_t idx);
+
+  NativeThreadProtocolSP GetThreadByID(lldb::tid_t tid);
+
+  void SetCurrentThreadID(lldb::tid_t tid) { m_current_thread_id = tid; }
+
+  lldb::tid_t GetCurrentThreadID() { return m_current_thread_id; }
+
+  NativeThreadProtocolSP GetCurrentThread() {
+    return GetThreadByID(m_current_thread_id);
+  }
+
+  //----------------------------------------------------------------------
+  // Access to inferior stdio
+  //----------------------------------------------------------------------
+  virtual int GetTerminalFileDescriptor() { return m_terminal_fd; }
+
+  //----------------------------------------------------------------------
+  // Stop id interface
+  //----------------------------------------------------------------------
+
+  uint32_t GetStopID() const;
+
+  // ---------------------------------------------------------------------
+  // Callbacks for low-level process state changes
+  // ---------------------------------------------------------------------
+  class NativeDelegate {
+  public:
+    virtual ~NativeDelegate() {}
+
+    virtual void InitializeDelegate(NativeProcessProtocol *process) = 0;
+
+    virtual void ProcessStateChanged(NativeProcessProtocol *process,
+                                     lldb::StateType state) = 0;
+
+    virtual void DidExec(NativeProcessProtocol *process) = 0;
+  };
+
+  //------------------------------------------------------------------
+  /// Register a native delegate.
+  ///
+  /// Clients can register nofication callbacks by passing in a
+  /// NativeDelegate impl and passing it into this function.
+  ///
+  /// Note: it is required that the lifetime of the
+  /// native_delegate outlive the NativeProcessProtocol.
+  ///
+  /// @param[in] native_delegate
+  ///     A NativeDelegate impl to be called when certain events
+  ///     happen within the NativeProcessProtocol or related threads.
+  ///
+  /// @return
+  ///     true if the delegate was registered successfully;
+  ///     false if the delegate was already registered.
+  ///
+  /// @see NativeProcessProtocol::NativeDelegate.
+  //------------------------------------------------------------------
+  bool RegisterNativeDelegate(NativeDelegate &native_delegate);
+
+  //------------------------------------------------------------------
+  /// Unregister a native delegate previously registered.
+  ///
+  /// @param[in] native_delegate
+  ///     A NativeDelegate impl previously registered with this process.
+  ///
+  /// @return Returns \b true if the NativeDelegate was
+  /// successfully removed from the process, \b false otherwise.
+  ///
+  /// @see NativeProcessProtocol::NativeDelegate
+  //------------------------------------------------------------------
+  bool UnregisterNativeDelegate(NativeDelegate &native_delegate);
+
+  virtual Error GetLoadedModuleFileSpec(const char *module_path,
+                                        FileSpec &file_spec) = 0;
+
+  virtual Error GetFileLoadAddress(const llvm::StringRef &file_name,
+                                   lldb::addr_t &load_addr) = 0;
+
+  //------------------------------------------------------------------
+  /// Launch a process for debugging. This method will create an concrete
+  /// instance of NativeProcessProtocol, based on the host platform.
+  /// (e.g. NativeProcessLinux on linux, etc.)
+  ///
+  /// @param[in] launch_info
+  ///     Information required to launch the process.
+  ///
+  /// @param[in] native_delegate
+  ///     The delegate that will receive messages regarding the
+  ///     inferior.  Must outlive the NativeProcessProtocol
+  ///     instance.
+  ///
+  /// @param[in] mainloop
+  ///     The mainloop instance with which the process can register
+  ///     callbacks. Must outlive the NativeProcessProtocol
+  ///     instance.
+  ///
+  /// @param[out] process_sp
+  ///     On successful return from the method, this parameter
+  ///     contains the shared pointer to the
+  ///     NativeProcessProtocol that can be used to manipulate
+  ///     the native process.
+  ///
+  /// @return
+  ///     An error object indicating if the operation succeeded,
+  ///     and if not, what error occurred.
+  //------------------------------------------------------------------
+  static Error Launch(ProcessLaunchInfo &launch_info,
+                      NativeDelegate &native_delegate, MainLoop &mainloop,
+                      NativeProcessProtocolSP &process_sp);
+
+  //------------------------------------------------------------------
+  /// Attach to an existing process. This method will create an concrete
+  /// instance of NativeProcessProtocol, based on the host platform.
+  /// (e.g. NativeProcessLinux on linux, etc.)
+  ///
+  /// @param[in] pid
+  ///     pid of the process locatable
+  ///
+  /// @param[in] native_delegate
+  ///     The delegate that will receive messages regarding the
+  ///     inferior.  Must outlive the NativeProcessProtocol
+  ///     instance.
+  ///
+  /// @param[in] mainloop
+  ///     The mainloop instance with which the process can register
+  ///     callbacks. Must outlive the NativeProcessProtocol
+  ///     instance.
+  ///
+  /// @param[out] process_sp
+  ///     On successful return from the method, this parameter
+  ///     contains the shared pointer to the
+  ///     NativeProcessProtocol that can be used to manipulate
+  ///     the native process.
+  ///
+  /// @return
+  ///     An error object indicating if the operation succeeded,
+  ///     and if not, what error occurred.
+  //------------------------------------------------------------------
+  static Error Attach(lldb::pid_t pid, NativeDelegate &native_delegate,
+                      MainLoop &mainloop, NativeProcessProtocolSP &process_sp);
+
+protected:
+  lldb::pid_t m_pid;
+
+  std::vector<NativeThreadProtocolSP> m_threads;
+  lldb::tid_t m_current_thread_id;
+  mutable std::recursive_mutex m_threads_mutex;
+
+  lldb::StateType m_state;
+  mutable std::recursive_mutex m_state_mutex;
+
+  lldb_private::ExitType m_exit_type;
+  int m_exit_status;
+  std::string m_exit_description;
+  std::recursive_mutex m_delegates_mutex;
+  std::vector<NativeDelegate *> m_delegates;
+  NativeBreakpointList m_breakpoint_list;
+  NativeWatchpointList m_watchpoint_list;
+  int m_terminal_fd;
+  uint32_t m_stop_id;
+
+  // lldb_private::Host calls should be used to launch a process for debugging,
+  // and
+  // then the process should be attached to. When attaching to a process
+  // lldb_private::Host calls should be used to locate the process to attach to,
+  // and then this function should be called.
+  NativeProcessProtocol(lldb::pid_t pid);
+
+  // -----------------------------------------------------------
+  // Internal interface for state handling
+  // -----------------------------------------------------------
+  void SetState(lldb::StateType state, bool notify_delegates = true);
+
+  // Derived classes need not implement this.  It can be used as a
+  // hook to clear internal caches that should be invalidated when
+  // stop ids change.
+  //
+  // Note this function is called with the state mutex obtained
+  // by the caller.
+  virtual void DoStopIDBumped(uint32_t newBumpId);
+
+  // -----------------------------------------------------------
+  // Internal interface for software breakpoints
+  // -----------------------------------------------------------
+  Error SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint);
+
+  virtual Error
+  GetSoftwareBreakpointTrapOpcode(size_t trap_opcode_size_hint,
+                                  size_t &actual_opcode_size,
+                                  const uint8_t *&trap_opcode_bytes) = 0;
+
+  // -----------------------------------------------------------
+  /// Notify the delegate that an exec occurred.
+  ///
+  /// Provide a mechanism for a delegate to clear out any exec-
+  /// sensitive data.
+  // -----------------------------------------------------------
+  void NotifyDidExec();
+
+  NativeThreadProtocolSP GetThreadByIDUnlocked(lldb::tid_t tid);
+
+  // -----------------------------------------------------------
+  // Static helper methods for derived classes.
+  // -----------------------------------------------------------
+  static Error ResolveProcessArchitecture(lldb::pid_t pid, ArchSpec &arch);
+
+private:
+  void SynchronouslyNotifyProcessStateChanged(lldb::StateType state);
+};
 }
 
 #endif // #ifndef liblldb_NativeProcessProtocol_h_

Modified: lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h Tue Sep  6 15:57:50 2016
@@ -14,212 +14,183 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Host/common/NativeWatchpointList.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
 
 class NativeThreadProtocol;
 
-class NativeRegisterContext:
-    public std::enable_shared_from_this<NativeRegisterContext>
-{
+class NativeRegisterContext
+    : public std::enable_shared_from_this<NativeRegisterContext> {
 public:
-    //------------------------------------------------------------------
-    // Constructors and Destructors
-    //------------------------------------------------------------------
-    NativeRegisterContext (NativeThreadProtocol &thread, uint32_t concrete_frame_idx);
+  //------------------------------------------------------------------
+  // Constructors and Destructors
+  //------------------------------------------------------------------
+  NativeRegisterContext(NativeThreadProtocol &thread,
+                        uint32_t concrete_frame_idx);
 
-    virtual
-    ~NativeRegisterContext ();
+  virtual ~NativeRegisterContext();
 
-    // void
-    // InvalidateIfNeeded (bool force);
+  // void
+  // InvalidateIfNeeded (bool force);
 
-    //------------------------------------------------------------------
-    // Subclasses must override these functions
-    //------------------------------------------------------------------
-    // virtual void
-    // InvalidateAllRegisters () = 0;
+  //------------------------------------------------------------------
+  // Subclasses must override these functions
+  //------------------------------------------------------------------
+  // virtual void
+  // InvalidateAllRegisters () = 0;
 
-    virtual uint32_t
-    GetRegisterCount () const = 0;
+  virtual uint32_t GetRegisterCount() const = 0;
 
-    virtual uint32_t
-    GetUserRegisterCount () const = 0;
+  virtual uint32_t GetUserRegisterCount() const = 0;
 
-    virtual const RegisterInfo *
-    GetRegisterInfoAtIndex (uint32_t reg) const = 0;
+  virtual const RegisterInfo *GetRegisterInfoAtIndex(uint32_t reg) const = 0;
 
-    const char *
-    GetRegisterSetNameForRegisterAtIndex (uint32_t reg_index) const;
+  const char *GetRegisterSetNameForRegisterAtIndex(uint32_t reg_index) const;
 
-    virtual uint32_t
-    GetRegisterSetCount () const = 0;
+  virtual uint32_t GetRegisterSetCount() const = 0;
 
-    virtual const RegisterSet *
-    GetRegisterSet (uint32_t set_index) const = 0;
+  virtual const RegisterSet *GetRegisterSet(uint32_t set_index) const = 0;
 
-    virtual Error
-    ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) = 0;
+  virtual Error ReadRegister(const RegisterInfo *reg_info,
+                             RegisterValue &reg_value) = 0;
 
-    virtual Error
-    WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) = 0;
+  virtual Error WriteRegister(const RegisterInfo *reg_info,
+                              const RegisterValue &reg_value) = 0;
 
-    virtual Error
-    ReadAllRegisterValues (lldb::DataBufferSP &data_sp) = 0;
+  virtual Error ReadAllRegisterValues(lldb::DataBufferSP &data_sp) = 0;
 
-    virtual Error
-    WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) = 0;
+  virtual Error WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) = 0;
 
-    uint32_t
-    ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num) const;
+  uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind,
+                                               uint32_t num) const;
 
-    //------------------------------------------------------------------
-    // Subclasses can override these functions if desired
-    //------------------------------------------------------------------
-    virtual uint32_t
-    NumSupportedHardwareBreakpoints ();
+  //------------------------------------------------------------------
+  // Subclasses can override these functions if desired
+  //------------------------------------------------------------------
+  virtual uint32_t NumSupportedHardwareBreakpoints();
 
-    virtual uint32_t
-    SetHardwareBreakpoint (lldb::addr_t addr, size_t size);
+  virtual uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size);
 
-    virtual bool
-    ClearHardwareBreakpoint (uint32_t hw_idx);
+  virtual bool ClearHardwareBreakpoint(uint32_t hw_idx);
 
-    virtual uint32_t
-    NumSupportedHardwareWatchpoints ();
+  virtual uint32_t NumSupportedHardwareWatchpoints();
 
-    virtual uint32_t
-    SetHardwareWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags);
+  virtual uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size,
+                                         uint32_t watch_flags);
 
-    virtual bool
-    ClearHardwareWatchpoint (uint32_t hw_index);
+  virtual bool ClearHardwareWatchpoint(uint32_t hw_index);
 
-    virtual Error
-    ClearAllHardwareWatchpoints ();
+  virtual Error ClearAllHardwareWatchpoints();
 
-    virtual Error
-    IsWatchpointHit(uint32_t wp_index, bool &is_hit);
+  virtual Error IsWatchpointHit(uint32_t wp_index, bool &is_hit);
 
-    virtual Error
-    GetWatchpointHitIndex(uint32_t &wp_index, lldb::addr_t trap_addr);
+  virtual Error GetWatchpointHitIndex(uint32_t &wp_index,
+                                      lldb::addr_t trap_addr);
 
-    virtual Error
-    IsWatchpointVacant (uint32_t wp_index, bool &is_vacant);
+  virtual Error IsWatchpointVacant(uint32_t wp_index, bool &is_vacant);
 
-    virtual lldb::addr_t
-    GetWatchpointAddress (uint32_t wp_index);
+  virtual lldb::addr_t GetWatchpointAddress(uint32_t wp_index);
 
-    // MIPS Linux kernel returns a masked address (last 3bits are masked)
-    // when a HW watchpoint is hit. However user may not have set a watchpoint
-    // on this address. This function emulates the instruction at PC and 
-    // finds the base address used in the load/store instruction. This gives the 
-    // exact address used to read/write the variable being watched.
-    // For example:
-    // 'n' is at 0x120010d00 and 'm' is 0x120010d04. When a watchpoint is set at 'm', 
-    // then watch exception is generated even when 'n' is read/written. This function
-    // returns address of 'n' so that client can check whether a watchpoint is set
-    // on this address or not.
-    virtual lldb::addr_t
-    GetWatchpointHitAddress (uint32_t wp_index);
+  // MIPS Linux kernel returns a masked address (last 3bits are masked)
+  // when a HW watchpoint is hit. However user may not have set a watchpoint
+  // on this address. This function emulates the instruction at PC and
+  // finds the base address used in the load/store instruction. This gives the
+  // exact address used to read/write the variable being watched.
+  // For example:
+  // 'n' is at 0x120010d00 and 'm' is 0x120010d04. When a watchpoint is set at
+  // 'm',
+  // then watch exception is generated even when 'n' is read/written. This
+  // function
+  // returns address of 'n' so that client can check whether a watchpoint is set
+  // on this address or not.
+  virtual lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index);
 
-    virtual bool
-    HardwareSingleStep (bool enable);
+  virtual bool HardwareSingleStep(bool enable);
 
-    virtual Error
-    ReadRegisterValueFromMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, size_t src_len, RegisterValue &reg_value);
+  virtual Error
+  ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info,
+                              lldb::addr_t src_addr, size_t src_len,
+                              RegisterValue &reg_value);
 
-    virtual Error
-    WriteRegisterValueToMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, size_t dst_len, const RegisterValue &reg_value);
+  virtual Error
+  WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info,
+                             lldb::addr_t dst_addr, size_t dst_len,
+                             const RegisterValue &reg_value);
 
-    //------------------------------------------------------------------
-    // Subclasses should not override these
-    //------------------------------------------------------------------
-    virtual lldb::tid_t
-    GetThreadID() const;
+  //------------------------------------------------------------------
+  // Subclasses should not override these
+  //------------------------------------------------------------------
+  virtual lldb::tid_t GetThreadID() const;
 
-    virtual NativeThreadProtocol &
-    GetThread ()
-    {
-        return m_thread;
-    }
+  virtual NativeThreadProtocol &GetThread() { return m_thread; }
 
-    const RegisterInfo *
-    GetRegisterInfoByName (const char *reg_name, uint32_t start_idx = 0);
+  const RegisterInfo *GetRegisterInfoByName(const char *reg_name,
+                                            uint32_t start_idx = 0);
 
-    const RegisterInfo *
-    GetRegisterInfo (uint32_t reg_kind, uint32_t reg_num);
+  const RegisterInfo *GetRegisterInfo(uint32_t reg_kind, uint32_t reg_num);
 
-    lldb::addr_t
-    GetPC (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+  lldb::addr_t GetPC(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
 
-    virtual lldb::addr_t
-    GetPCfromBreakpointLocation (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+  virtual lldb::addr_t
+  GetPCfromBreakpointLocation(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
 
-    Error
-    SetPC (lldb::addr_t pc);
+  Error SetPC(lldb::addr_t pc);
 
-    lldb::addr_t
-    GetSP (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+  lldb::addr_t GetSP(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
 
-    Error
-    SetSP (lldb::addr_t sp);
+  Error SetSP(lldb::addr_t sp);
 
-    lldb::addr_t
-    GetFP (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+  lldb::addr_t GetFP(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
 
-    Error
-    SetFP (lldb::addr_t fp);
+  Error SetFP(lldb::addr_t fp);
 
-    const char *
-    GetRegisterName (uint32_t reg);
+  const char *GetRegisterName(uint32_t reg);
 
-    lldb::addr_t
-    GetReturnAddress (lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
+  lldb::addr_t GetReturnAddress(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS);
 
-    lldb::addr_t
-    GetFlags (lldb::addr_t fail_value = 0);
+  lldb::addr_t GetFlags(lldb::addr_t fail_value = 0);
 
-    lldb::addr_t
-    ReadRegisterAsUnsigned (uint32_t reg, lldb::addr_t fail_value);
+  lldb::addr_t ReadRegisterAsUnsigned(uint32_t reg, lldb::addr_t fail_value);
 
-    lldb::addr_t
-    ReadRegisterAsUnsigned (const RegisterInfo *reg_info, lldb::addr_t fail_value);
+  lldb::addr_t ReadRegisterAsUnsigned(const RegisterInfo *reg_info,
+                                      lldb::addr_t fail_value);
 
-    Error
-    WriteRegisterFromUnsigned (uint32_t reg, uint64_t uval);
+  Error WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval);
 
-    Error
-    WriteRegisterFromUnsigned (const RegisterInfo *reg_info, uint64_t uval);
+  Error WriteRegisterFromUnsigned(const RegisterInfo *reg_info, uint64_t uval);
 
-    // uint32_t
-    // GetStopID () const
-    // {
-    //     return m_stop_id;
-    // }
+  // uint32_t
+  // GetStopID () const
+  // {
+  //     return m_stop_id;
+  // }
 
-    // void
-    // SetStopID (uint32_t stop_id)
-    // {
-    //     m_stop_id = stop_id;
-    // }
+  // void
+  // SetStopID (uint32_t stop_id)
+  // {
+  //     m_stop_id = stop_id;
+  // }
 
 protected:
-    //------------------------------------------------------------------
-    // Classes that inherit from RegisterContext can see and modify these
-    //------------------------------------------------------------------
-    NativeThreadProtocol &m_thread; // The thread that this register context belongs to.
-    uint32_t m_concrete_frame_idx;  // The concrete frame index for this register context
-    // uint32_t m_stop_id;             // The stop ID that any data in this context is valid for
+  //------------------------------------------------------------------
+  // Classes that inherit from RegisterContext can see and modify these
+  //------------------------------------------------------------------
+  NativeThreadProtocol
+      &m_thread; // The thread that this register context belongs to.
+  uint32_t m_concrete_frame_idx; // The concrete frame index for this register
+                                 // context
+  // uint32_t m_stop_id;             // The stop ID that any data in this
+  // context is valid for
 
 private:
-    //------------------------------------------------------------------
-    // For RegisterContext only
-    //------------------------------------------------------------------
-    DISALLOW_COPY_AND_ASSIGN (NativeRegisterContext);
+  //------------------------------------------------------------------
+  // For RegisterContext only
+  //------------------------------------------------------------------
+  DISALLOW_COPY_AND_ASSIGN(NativeRegisterContext);
 };
 
 } // namespace lldb_private
 
-#endif  // liblldb_NativeRegisterContext_h_
+#endif // liblldb_NativeRegisterContext_h_

Modified: lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- NativeRegisterContextRegisterInfo.h ----------------------*- C++ -*-===//
+//===-- NativeRegisterContextRegisterInfo.h ----------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -15,33 +16,27 @@
 #include "NativeRegisterContext.h"
 #include "Plugins/Process/Utility/RegisterInfoInterface.h"
 
-namespace lldb_private
-{
-    class NativeRegisterContextRegisterInfo: public NativeRegisterContext
-    {
-    public:
-        ///
-        /// Construct a NativeRegisterContextRegisterInfo, taking ownership
-        /// of the register_info_interface pointer.
-        ///
-        NativeRegisterContextRegisterInfo (NativeThreadProtocol &thread,
-                                           uint32_t concrete_frame_idx,
-                                           RegisterInfoInterface *register_info_interface);
-
-        uint32_t
-        GetRegisterCount () const override;
-
-        uint32_t
-        GetUserRegisterCount () const override;
-
-        const RegisterInfo *
-        GetRegisterInfoAtIndex (uint32_t reg_index) const override;
-
-        const RegisterInfoInterface&
-        GetRegisterInfoInterface () const;
-
-    private:
-        std::unique_ptr<RegisterInfoInterface> m_register_info_interface_up;
-    };
+namespace lldb_private {
+class NativeRegisterContextRegisterInfo : public NativeRegisterContext {
+public:
+  ///
+  /// Construct a NativeRegisterContextRegisterInfo, taking ownership
+  /// of the register_info_interface pointer.
+  ///
+  NativeRegisterContextRegisterInfo(
+      NativeThreadProtocol &thread, uint32_t concrete_frame_idx,
+      RegisterInfoInterface *register_info_interface);
+
+  uint32_t GetRegisterCount() const override;
+
+  uint32_t GetUserRegisterCount() const override;
+
+  const RegisterInfo *GetRegisterInfoAtIndex(uint32_t reg_index) const override;
+
+  const RegisterInfoInterface &GetRegisterInfoInterface() const;
+
+private:
+  std::unique_ptr<RegisterInfoInterface> m_register_info_interface_up;
+};
 }
 #endif

Modified: lldb/trunk/include/lldb/Host/common/NativeThreadProtocol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeThreadProtocol.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeThreadProtocol.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeThreadProtocol.h Tue Sep  6 15:57:50 2016
@@ -12,71 +12,54 @@
 
 #include <memory>
 
+#include "lldb/Host/Debug.h"
 #include "lldb/lldb-private-forward.h"
 #include "lldb/lldb-types.h"
-#include "lldb/Host/Debug.h"
 
-namespace lldb_private
-{
-    //------------------------------------------------------------------
-    // NativeThreadProtocol
-    //------------------------------------------------------------------
-    class NativeThreadProtocol:
-        public std::enable_shared_from_this<NativeThreadProtocol>
-    {
-    public:
-        NativeThreadProtocol (NativeProcessProtocol *process, lldb::tid_t tid);
-
-        virtual ~NativeThreadProtocol()
-        {
-        }
-
-        virtual std::string
-        GetName() = 0;
-
-        virtual lldb::StateType
-        GetState () = 0;
-
-        virtual NativeRegisterContextSP
-        GetRegisterContext () = 0;
-
-        virtual Error
-        ReadRegister (uint32_t reg, RegisterValue &reg_value);
-
-        virtual Error
-        WriteRegister (uint32_t reg, const RegisterValue &reg_value);
-
-        virtual Error
-        SaveAllRegisters (lldb::DataBufferSP &data_sp);
-
-        virtual Error
-        RestoreAllRegisters (lldb::DataBufferSP &data_sp);
-
-        virtual bool
-        GetStopReason (ThreadStopInfo &stop_info, std::string& description) = 0;
-
-        lldb::tid_t
-        GetID() const
-        {
-            return m_tid;
-        }
-
-        NativeProcessProtocolSP
-        GetProcess ();
-
-        // ---------------------------------------------------------------------
-        // Thread-specific watchpoints
-        // ---------------------------------------------------------------------
-        virtual Error
-        SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) = 0;
-
-        virtual Error
-        RemoveWatchpoint (lldb::addr_t addr) = 0;
-
-    protected:
-        NativeProcessProtocolWP m_process_wp;
-        lldb::tid_t m_tid;
-    };
+namespace lldb_private {
+//------------------------------------------------------------------
+// NativeThreadProtocol
+//------------------------------------------------------------------
+class NativeThreadProtocol
+    : public std::enable_shared_from_this<NativeThreadProtocol> {
+public:
+  NativeThreadProtocol(NativeProcessProtocol *process, lldb::tid_t tid);
+
+  virtual ~NativeThreadProtocol() {}
+
+  virtual std::string GetName() = 0;
+
+  virtual lldb::StateType GetState() = 0;
+
+  virtual NativeRegisterContextSP GetRegisterContext() = 0;
+
+  virtual Error ReadRegister(uint32_t reg, RegisterValue &reg_value);
+
+  virtual Error WriteRegister(uint32_t reg, const RegisterValue &reg_value);
+
+  virtual Error SaveAllRegisters(lldb::DataBufferSP &data_sp);
+
+  virtual Error RestoreAllRegisters(lldb::DataBufferSP &data_sp);
+
+  virtual bool GetStopReason(ThreadStopInfo &stop_info,
+                             std::string &description) = 0;
+
+  lldb::tid_t GetID() const { return m_tid; }
+
+  NativeProcessProtocolSP GetProcess();
+
+  // ---------------------------------------------------------------------
+  // Thread-specific watchpoints
+  // ---------------------------------------------------------------------
+  virtual Error SetWatchpoint(lldb::addr_t addr, size_t size,
+                              uint32_t watch_flags, bool hardware) = 0;
+
+  virtual Error RemoveWatchpoint(lldb::addr_t addr) = 0;
+
+protected:
+  NativeProcessProtocolWP m_process_wp;
+  lldb::tid_t m_tid;
+};
 }
 
 #endif // #ifndef liblldb_NativeThreadProtocol_h_

Modified: lldb/trunk/include/lldb/Host/common/NativeWatchpointList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeWatchpointList.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeWatchpointList.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeWatchpointList.h Tue Sep  6 15:57:50 2016
@@ -10,38 +10,33 @@
 #ifndef liblldb_NativeWatchpointList_h_
 #define liblldb_NativeWatchpointList_h_
 
-#include "lldb/lldb-private-forward.h"
 #include "lldb/Core/Error.h"
+#include "lldb/lldb-private-forward.h"
 
 #include <map>
 
-namespace lldb_private
-{
-    struct NativeWatchpoint
-    {
-        lldb::addr_t m_addr;
-        size_t m_size;
-        uint32_t m_watch_flags;
-        bool m_hardware;
-    };
-
-    class NativeWatchpointList
-    {
-    public:
-        Error
-        Add (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware);
-
-        Error
-        Remove (lldb::addr_t addr);
-
-        using WatchpointMap = std::map<lldb::addr_t, NativeWatchpoint>;
-
-        const WatchpointMap&
-        GetWatchpointMap () const;
-
-    private:
-        WatchpointMap m_watchpoints;
-    };
+namespace lldb_private {
+struct NativeWatchpoint {
+  lldb::addr_t m_addr;
+  size_t m_size;
+  uint32_t m_watch_flags;
+  bool m_hardware;
+};
+
+class NativeWatchpointList {
+public:
+  Error Add(lldb::addr_t addr, size_t size, uint32_t watch_flags,
+            bool hardware);
+
+  Error Remove(lldb::addr_t addr);
+
+  using WatchpointMap = std::map<lldb::addr_t, NativeWatchpoint>;
+
+  const WatchpointMap &GetWatchpointMap() const;
+
+private:
+  WatchpointMap m_watchpoints;
+};
 }
 
 #endif // ifndef liblldb_NativeWatchpointList_h_

Modified: lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h (original)
+++ lldb/trunk/include/lldb/Host/common/SoftwareBreakpoint.h Tue Sep  6 15:57:50 2016
@@ -10,44 +10,44 @@
 #ifndef liblldb_SoftwareBreakpoint_h_
 #define liblldb_SoftwareBreakpoint_h_
 
-#include "lldb/lldb-private-forward.h"
 #include "NativeBreakpoint.h"
+#include "lldb/lldb-private-forward.h"
 
-namespace lldb_private
-{
-    class SoftwareBreakpoint : public NativeBreakpoint
-    {
-        friend class NativeBreakpointList;
-
-    public:
-        static Error
-        CreateSoftwareBreakpoint (NativeProcessProtocol &process, lldb::addr_t addr, size_t size_hint, NativeBreakpointSP &breakpoint_spn);
-
-        SoftwareBreakpoint (NativeProcessProtocol &process, lldb::addr_t addr, const uint8_t *saved_opcodes, const uint8_t *trap_opcodes, size_t opcode_size);
-
-    protected:
-        Error
-        DoEnable () override;
-
-        Error
-        DoDisable () override;
-
-        bool
-        IsSoftwareBreakpoint () const override;
-
-    private:
-        /// Max number of bytes that a software trap opcode sequence can occupy.
-        static const size_t MAX_TRAP_OPCODE_SIZE = 8;
-
-        NativeProcessProtocol &m_process;
-        uint8_t m_saved_opcodes [MAX_TRAP_OPCODE_SIZE];
-        uint8_t m_trap_opcodes [MAX_TRAP_OPCODE_SIZE];
-        const size_t m_opcode_size;
-
-        static Error
-        EnableSoftwareBreakpoint (NativeProcessProtocol &process, lldb::addr_t addr, size_t bp_opcode_size, const uint8_t *bp_opcode_bytes, uint8_t *saved_opcode_bytes);
-
-    };
+namespace lldb_private {
+class SoftwareBreakpoint : public NativeBreakpoint {
+  friend class NativeBreakpointList;
+
+public:
+  static Error CreateSoftwareBreakpoint(NativeProcessProtocol &process,
+                                        lldb::addr_t addr, size_t size_hint,
+                                        NativeBreakpointSP &breakpoint_spn);
+
+  SoftwareBreakpoint(NativeProcessProtocol &process, lldb::addr_t addr,
+                     const uint8_t *saved_opcodes, const uint8_t *trap_opcodes,
+                     size_t opcode_size);
+
+protected:
+  Error DoEnable() override;
+
+  Error DoDisable() override;
+
+  bool IsSoftwareBreakpoint() const override;
+
+private:
+  /// Max number of bytes that a software trap opcode sequence can occupy.
+  static const size_t MAX_TRAP_OPCODE_SIZE = 8;
+
+  NativeProcessProtocol &m_process;
+  uint8_t m_saved_opcodes[MAX_TRAP_OPCODE_SIZE];
+  uint8_t m_trap_opcodes[MAX_TRAP_OPCODE_SIZE];
+  const size_t m_opcode_size;
+
+  static Error EnableSoftwareBreakpoint(NativeProcessProtocol &process,
+                                        lldb::addr_t addr,
+                                        size_t bp_opcode_size,
+                                        const uint8_t *bp_opcode_bytes,
+                                        uint8_t *saved_opcode_bytes);
+};
 }
 
 #endif // #ifndef liblldb_SoftwareBreakpoint_h_

Modified: lldb/trunk/include/lldb/Host/common/TCPSocket.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/TCPSocket.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/TCPSocket.h (original)
+++ lldb/trunk/include/lldb/Host/common/TCPSocket.h Tue Sep  6 15:57:50 2016
@@ -12,35 +12,34 @@
 
 #include "lldb/Host/Socket.h"
 
-namespace lldb_private
-{
-    class TCPSocket: public Socket
-    {
-    public:
-        TCPSocket(NativeSocket socket, bool should_close);
-        TCPSocket(bool child_processes_inherit, Error &error);
-
-        // returns port number or 0 if error
-        uint16_t GetLocalPortNumber () const;
-
-        // returns ip address string or empty string if error
-        std::string GetLocalIPAddress () const;
-
-        // must be connected
-        // returns port number or 0 if error
-        uint16_t GetRemotePortNumber () const;
-
-        // must be connected
-        // returns ip address string or empty string if error
-        std::string GetRemoteIPAddress () const;
-
-        int SetOptionNoDelay();
-        int SetOptionReuseAddress();
-
-        Error Connect(llvm::StringRef name) override;
-        Error Listen(llvm::StringRef name, int backlog) override;
-        Error Accept(llvm::StringRef name, bool child_processes_inherit, Socket *&conn_socket) override;
-    };
+namespace lldb_private {
+class TCPSocket : public Socket {
+public:
+  TCPSocket(NativeSocket socket, bool should_close);
+  TCPSocket(bool child_processes_inherit, Error &error);
+
+  // returns port number or 0 if error
+  uint16_t GetLocalPortNumber() const;
+
+  // returns ip address string or empty string if error
+  std::string GetLocalIPAddress() const;
+
+  // must be connected
+  // returns port number or 0 if error
+  uint16_t GetRemotePortNumber() const;
+
+  // must be connected
+  // returns ip address string or empty string if error
+  std::string GetRemoteIPAddress() const;
+
+  int SetOptionNoDelay();
+  int SetOptionReuseAddress();
+
+  Error Connect(llvm::StringRef name) override;
+  Error Listen(llvm::StringRef name, int backlog) override;
+  Error Accept(llvm::StringRef name, bool child_processes_inherit,
+               Socket *&conn_socket) override;
+};
 }
 
 #endif // ifndef liblldb_TCPSocket_h_

Modified: lldb/trunk/include/lldb/Host/common/UDPSocket.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/UDPSocket.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/UDPSocket.h (original)
+++ lldb/trunk/include/lldb/Host/common/UDPSocket.h Tue Sep  6 15:57:50 2016
@@ -12,24 +12,25 @@
 
 #include "lldb/Host/Socket.h"
 
-namespace lldb_private
-{
-    class UDPSocket: public Socket
-    {
-    public:
-        UDPSocket(bool child_processes_inherit, Error &error);
-
-        static Error Connect(llvm::StringRef name, bool child_processes_inherit, Socket *&send_socket, Socket *&recv_socket);
-    private:
-        UDPSocket(NativeSocket socket);
-
-        size_t Send(const void *buf, const size_t num_bytes) override;
-        Error Connect(llvm::StringRef name) override;
-        Error Listen(llvm::StringRef name, int backlog) override;
-        Error Accept(llvm::StringRef name, bool child_processes_inherit, Socket *&socket) override;
+namespace lldb_private {
+class UDPSocket : public Socket {
+public:
+  UDPSocket(bool child_processes_inherit, Error &error);
+
+  static Error Connect(llvm::StringRef name, bool child_processes_inherit,
+                       Socket *&send_socket, Socket *&recv_socket);
+
+private:
+  UDPSocket(NativeSocket socket);
+
+  size_t Send(const void *buf, const size_t num_bytes) override;
+  Error Connect(llvm::StringRef name) override;
+  Error Listen(llvm::StringRef name, int backlog) override;
+  Error Accept(llvm::StringRef name, bool child_processes_inherit,
+               Socket *&socket) override;
 
-        SocketAddress m_send_sockaddr;
-    };
+  SocketAddress m_send_sockaddr;
+};
 }
 
 #endif // ifndef liblldb_UDPSocket_h_

Modified: lldb/trunk/include/lldb/Host/freebsd/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/freebsd/Config.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/freebsd/Config.h (original)
+++ lldb/trunk/include/lldb/Host/freebsd/Config.h Tue Sep  6 15:57:50 2016
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 //----------------------------------------------------------------------
-// LLDB currently doesn't have a dynamic configuration mechanism, so we 
+// LLDB currently doesn't have a dynamic configuration mechanism, so we
 // are going to hardcode things for now. Eventually these files will
 // be auto generated by some configuration script that can detect
 // platform functionality availability.

Modified: lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h (original)
+++ lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h Tue Sep  6 15:57:50 2016
@@ -13,17 +13,15 @@
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/posix/HostInfoPosix.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class HostInfoFreeBSD : public HostInfoPosix
-{
-  public:
-    static uint32_t GetMaxThreadNameLength();
-    static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
-    static bool GetOSBuildString(std::string &s);
-    static bool GetOSKernelDescription(std::string &s);
-    static FileSpec GetProgramFileSpec();
+class HostInfoFreeBSD : public HostInfoPosix {
+public:
+  static uint32_t GetMaxThreadNameLength();
+  static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
+  static bool GetOSBuildString(std::string &s);
+  static bool GetOSKernelDescription(std::string &s);
+  static FileSpec GetProgramFileSpec();
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/freebsd/HostThreadFreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/freebsd/HostThreadFreeBSD.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/freebsd/HostThreadFreeBSD.h (original)
+++ lldb/trunk/include/lldb/Host/freebsd/HostThreadFreeBSD.h Tue Sep  6 15:57:50 2016
@@ -12,19 +12,17 @@
 
 #include "lldb/Host/posix/HostThreadPosix.h"
 
-#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class HostThreadFreeBSD : public HostThreadPosix
-{
-  public:
-    HostThreadFreeBSD();
-    HostThreadFreeBSD(lldb::thread_t thread);
+class HostThreadFreeBSD : public HostThreadPosix {
+public:
+  HostThreadFreeBSD();
+  HostThreadFreeBSD(lldb::thread_t thread);
 
-    static void GetName(lldb::tid_t tid, llvm::SmallVectorImpl<char> &name);
+  static void GetName(lldb::tid_t tid, llvm::SmallVectorImpl<char> &name);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/linux/AbstractSocket.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/AbstractSocket.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/AbstractSocket.h (original)
+++ lldb/trunk/include/lldb/Host/linux/AbstractSocket.h Tue Sep  6 15:57:50 2016
@@ -12,17 +12,15 @@
 
 #include "lldb/Host/posix/DomainSocket.h"
 
-namespace lldb_private
-{
-    class AbstractSocket: public DomainSocket
-    {
-    public:
-        AbstractSocket(bool child_processes_inherit, Error &error);
+namespace lldb_private {
+class AbstractSocket : public DomainSocket {
+public:
+  AbstractSocket(bool child_processes_inherit, Error &error);
 
-    protected:
-        size_t GetNameOffset() const override;
-        void DeleteSocketFile(llvm::StringRef name) override;
-    };
+protected:
+  size_t GetNameOffset() const override;
+  void DeleteSocketFile(llvm::StringRef name) override;
+};
 }
 
 #endif // ifndef liblldb_AbstractSocket_h_

Modified: lldb/trunk/include/lldb/Host/linux/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/Config.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/Config.h (original)
+++ lldb/trunk/include/lldb/Host/linux/Config.h Tue Sep  6 15:57:50 2016
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 //----------------------------------------------------------------------
-// LLDB currently doesn't have a dynamic configuration mechanism, so we 
+// LLDB currently doesn't have a dynamic configuration mechanism, so we
 // are going to hardcode things for now. Eventually these files will
 // be auto generated by some configuration script that can detect
 // platform functionality availability.

Modified: lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h (original)
+++ lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h Tue Sep  6 15:57:50 2016
@@ -17,33 +17,32 @@
 
 #include <string>
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class HostInfoLinux : public HostInfoPosix
-{
-    friend class HostInfoBase;
-
-  private:
-    // Static class, unconstructable.
-    HostInfoLinux();
-    ~HostInfoLinux();
-
-  public:
-    static void Initialize();
-    static uint32_t GetMaxThreadNameLength();
-
-    static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
-    static bool GetOSBuildString(std::string &s);
-    static bool GetOSKernelDescription(std::string &s);
-    static llvm::StringRef GetDistributionId();
-    static FileSpec GetProgramFileSpec();
-
-  protected:
-    static bool ComputeSupportExeDirectory(FileSpec &file_spec);
-    static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
-    static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
-    static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);
+class HostInfoLinux : public HostInfoPosix {
+  friend class HostInfoBase;
+
+private:
+  // Static class, unconstructable.
+  HostInfoLinux();
+  ~HostInfoLinux();
+
+public:
+  static void Initialize();
+  static uint32_t GetMaxThreadNameLength();
+
+  static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
+  static bool GetOSBuildString(std::string &s);
+  static bool GetOSKernelDescription(std::string &s);
+  static llvm::StringRef GetDistributionId();
+  static FileSpec GetProgramFileSpec();
+
+protected:
+  static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+  static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
+  static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
+  static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
+                                             ArchSpec &arch_64);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/linux/HostThreadLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/HostThreadLinux.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/HostThreadLinux.h (original)
+++ lldb/trunk/include/lldb/Host/linux/HostThreadLinux.h Tue Sep  6 15:57:50 2016
@@ -12,20 +12,18 @@
 
 #include "lldb/Host/posix/HostThreadPosix.h"
 
-#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class HostThreadLinux : public HostThreadPosix
-{
-  public:
-    HostThreadLinux();
-    HostThreadLinux(lldb::thread_t thread);
+class HostThreadLinux : public HostThreadPosix {
+public:
+  HostThreadLinux();
+  HostThreadLinux(lldb::thread_t thread);
 
-    static void SetName(lldb::thread_t thread, llvm::StringRef name);
-    static void GetName(lldb::thread_t thread, llvm::SmallVectorImpl<char> &name);
+  static void SetName(lldb::thread_t thread, llvm::StringRef name);
+  static void GetName(lldb::thread_t thread, llvm::SmallVectorImpl<char> &name);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/linux/ProcessLauncherLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/ProcessLauncherLinux.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/ProcessLauncherLinux.h (original)
+++ lldb/trunk/include/lldb/Host/linux/ProcessLauncherLinux.h Tue Sep  6 15:57:50 2016
@@ -12,14 +12,12 @@
 
 #include "lldb/Host/ProcessLauncher.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class ProcessLauncherLinux : public ProcessLauncher
-{
+class ProcessLauncherLinux : public ProcessLauncher {
 public:
-    virtual HostProcess
-    LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error);
+  virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+                                    Error &error);
 };
 
 } // end of namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/linux/Ptrace.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/Ptrace.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/Ptrace.h (original)
+++ lldb/trunk/include/lldb/Host/linux/Ptrace.h Tue Sep  6 15:57:50 2016
@@ -22,36 +22,36 @@ typedef int __ptrace_request;
 
 // Support ptrace extensions even when compiled without required kernel support
 #ifndef PTRACE_GETREGS
-    #define PTRACE_GETREGS 12
+#define PTRACE_GETREGS 12
 #endif
 #ifndef PTRACE_SETREGS
-    #define PTRACE_SETREGS 13
+#define PTRACE_SETREGS 13
 #endif
 #ifndef PTRACE_GETFPREGS
-    #define PTRACE_GETFPREGS 14
+#define PTRACE_GETFPREGS 14
 #endif
 #ifndef PTRACE_SETFPREGS
-    #define PTRACE_SETFPREGS 15
+#define PTRACE_SETFPREGS 15
 #endif
 #ifndef PTRACE_GETREGSET
-    #define PTRACE_GETREGSET 0x4204
+#define PTRACE_GETREGSET 0x4204
 #endif
 #ifndef PTRACE_SETREGSET
-    #define PTRACE_SETREGSET 0x4205
+#define PTRACE_SETREGSET 0x4205
 #endif
 #ifndef PTRACE_GET_THREAD_AREA
-    #define PTRACE_GET_THREAD_AREA 25
+#define PTRACE_GET_THREAD_AREA 25
 #endif
 #ifndef PTRACE_ARCH_PRCTL
-    #define PTRACE_ARCH_PRCTL      30
+#define PTRACE_ARCH_PRCTL 30
 #endif
 #ifndef ARCH_GET_FS
-    #define ARCH_SET_GS 0x1001
-    #define ARCH_SET_FS 0x1002
-    #define ARCH_GET_FS 0x1003
-    #define ARCH_GET_GS 0x1004
+#define ARCH_SET_GS 0x1001
+#define ARCH_SET_FS 0x1002
+#define ARCH_GET_FS 0x1003
+#define ARCH_GET_GS 0x1004
 #endif
 
-#define LLDB_PTRACE_NT_ARM_TLS  0x401           // ARM TLS register
+#define LLDB_PTRACE_NT_ARM_TLS 0x401 // ARM TLS register
 
 #endif // liblldb_Host_linux_Ptrace_h_

Modified: lldb/trunk/include/lldb/Host/linux/Uio.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/Uio.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/linux/Uio.h (original)
+++ lldb/trunk/include/lldb/Host/linux/Uio.h Tue Sep  6 15:57:50 2016
@@ -12,12 +12,12 @@
 
 #include <sys/uio.h>
 
-// We shall provide our own implementation of process_vm_readv if it is not present
+// We shall provide our own implementation of process_vm_readv if it is not
+// present
 #ifndef HAVE_PROCESS_VM_READV
-ssize_t process_vm_readv(::pid_t pid,
-			 const struct iovec *local_iov, unsigned long liovcnt,
-			 const struct iovec *remote_iov, unsigned long riovcnt,
-			 unsigned long flags);
+ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov,
+                         unsigned long liovcnt, const struct iovec *remote_iov,
+                         unsigned long riovcnt, unsigned long flags);
 #endif
 
 #endif // liblldb_Host_linux_Uio_h_

Modified: lldb/trunk/include/lldb/Host/macosx/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/macosx/Config.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/macosx/Config.h (original)
+++ lldb/trunk/include/lldb/Host/macosx/Config.h Tue Sep  6 15:57:50 2016
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 //----------------------------------------------------------------------
-// LLDB currently doesn't have a dynamic configuration mechanism, so we 
+// LLDB currently doesn't have a dynamic configuration mechanism, so we
 // are going to hardcode things for now. Eventually these files will
 // be auto generated by some configuration script that can detect
 // platform functionality availability.

Modified: lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h (original)
+++ lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h Tue Sep  6 15:57:50 2016
@@ -13,35 +13,34 @@
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/posix/HostInfoPosix.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class ArchSpec;
 
-class HostInfoMacOSX : public HostInfoPosix
-{
-    friend class HostInfoBase;
-
-  private:
-    // Static class, unconstructable.
-    HostInfoMacOSX();
-    ~HostInfoMacOSX();
-
-  public:
-    static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
-    static bool GetOSBuildString(std::string &s);
-    static bool GetOSKernelDescription(std::string &s);
-    static FileSpec GetProgramFileSpec();
-    static uint32_t GetMaxThreadNameLength();
-
-  protected:
-    static bool ComputeSupportExeDirectory(FileSpec &file_spec);
-    static void ComputeHostArchitectureSupport(ArchSpec &arch_32, ArchSpec &arch_64);
-    static bool ComputeHeaderDirectory(FileSpec &file_spec);
-    static bool ComputePythonDirectory(FileSpec &file_spec);
-    static bool ComputeClangDirectory(FileSpec &file_spec);
-    static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
-    static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
+class HostInfoMacOSX : public HostInfoPosix {
+  friend class HostInfoBase;
+
+private:
+  // Static class, unconstructable.
+  HostInfoMacOSX();
+  ~HostInfoMacOSX();
+
+public:
+  static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
+  static bool GetOSBuildString(std::string &s);
+  static bool GetOSKernelDescription(std::string &s);
+  static FileSpec GetProgramFileSpec();
+  static uint32_t GetMaxThreadNameLength();
+
+protected:
+  static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+  static void ComputeHostArchitectureSupport(ArchSpec &arch_32,
+                                             ArchSpec &arch_64);
+  static bool ComputeHeaderDirectory(FileSpec &file_spec);
+  static bool ComputePythonDirectory(FileSpec &file_spec);
+  static bool ComputeClangDirectory(FileSpec &file_spec);
+  static bool ComputeSystemPluginsDirectory(FileSpec &file_spec);
+  static bool ComputeUserPluginsDirectory(FileSpec &file_spec);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/macosx/HostThreadMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/macosx/HostThreadMacOSX.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/macosx/HostThreadMacOSX.h (original)
+++ lldb/trunk/include/lldb/Host/macosx/HostThreadMacOSX.h Tue Sep  6 15:57:50 2016
@@ -12,19 +12,17 @@
 
 #include "lldb/Host/posix/HostThreadPosix.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class HostThreadMacOSX : public HostThreadPosix
-{
-    friend class ThreadLauncher;
-
-  public:
-    HostThreadMacOSX();
-    HostThreadMacOSX(lldb::thread_t thread);
+class HostThreadMacOSX : public HostThreadPosix {
+  friend class ThreadLauncher;
 
-  protected:
-    static lldb::thread_result_t ThreadCreateTrampoline(lldb::thread_arg_t arg);
+public:
+  HostThreadMacOSX();
+  HostThreadMacOSX(lldb::thread_t thread);
+
+protected:
+  static lldb::thread_result_t ThreadCreateTrampoline(lldb::thread_arg_t arg);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/mingw/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/mingw/Config.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/mingw/Config.h (original)
+++ lldb/trunk/include/lldb/Host/mingw/Config.h Tue Sep  6 15:57:50 2016
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 //----------------------------------------------------------------------
-// LLDB currently doesn't have a dynamic configuration mechanism, so we 
+// LLDB currently doesn't have a dynamic configuration mechanism, so we
 // are going to hardcode things for now. Eventually these files will
 // be auto generated by some configuration script that can detect
 // platform functionality availability.

Modified: lldb/trunk/include/lldb/Host/msvc/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/msvc/Config.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/msvc/Config.h (original)
+++ lldb/trunk/include/lldb/Host/msvc/Config.h Tue Sep  6 15:57:50 2016
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 //----------------------------------------------------------------------
-// LLDB currently doesn't have a dynamic configuration mechanism, so we 
+// LLDB currently doesn't have a dynamic configuration mechanism, so we
 // are going to hardcode things for now. Eventually these files will
 // be auto generated by some configuration script that can detect
 // platform functionality availability.
@@ -28,8 +28,10 @@
 //#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1
 
 #if _HAS_EXCEPTIONS == 0
-// Due to a bug in <thread>, when _HAS_EXCEPTIONS == 0 the header will try to call
-// uncaught_exception() without having a declaration for it.  The fix for this is
+// Due to a bug in <thread>, when _HAS_EXCEPTIONS == 0 the header will try to
+// call
+// uncaught_exception() without having a declaration for it.  The fix for this
+// is
 // to manually #include <eh.h>, which contains this declaration.
 #include <eh.h>
 #endif

Modified: lldb/trunk/include/lldb/Host/netbsd/HostInfoNetBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/netbsd/HostInfoNetBSD.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/netbsd/HostInfoNetBSD.h (original)
+++ lldb/trunk/include/lldb/Host/netbsd/HostInfoNetBSD.h Tue Sep  6 15:57:50 2016
@@ -13,17 +13,15 @@
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/posix/HostInfoPosix.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class HostInfoNetBSD : public HostInfoPosix
-{
-  public:
-    static uint32_t GetMaxThreadNameLength();
-    static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
-    static bool GetOSBuildString(std::string &s);
-    static bool GetOSKernelDescription(std::string &s);
-    static FileSpec GetProgramFileSpec();
+class HostInfoNetBSD : public HostInfoPosix {
+public:
+  static uint32_t GetMaxThreadNameLength();
+  static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
+  static bool GetOSBuildString(std::string &s);
+  static bool GetOSKernelDescription(std::string &s);
+  static FileSpec GetProgramFileSpec();
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/netbsd/HostThreadNetBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/netbsd/HostThreadNetBSD.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/netbsd/HostThreadNetBSD.h (original)
+++ lldb/trunk/include/lldb/Host/netbsd/HostThreadNetBSD.h Tue Sep  6 15:57:50 2016
@@ -12,20 +12,18 @@
 
 #include "lldb/Host/posix/HostThreadPosix.h"
 
-#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class HostThreadNetBSD : public HostThreadPosix
-{
-  public:
-    HostThreadNetBSD();
-    HostThreadNetBSD(lldb::thread_t thread);
+class HostThreadNetBSD : public HostThreadPosix {
+public:
+  HostThreadNetBSD();
+  HostThreadNetBSD(lldb::thread_t thread);
 
-    static void SetName(lldb::thread_t tid, llvm::StringRef &name);
-    static void GetName(lldb::thread_t tid, llvm::SmallVectorImpl<char> &name);
+  static void SetName(lldb::thread_t tid, llvm::StringRef &name);
+  static void GetName(lldb::thread_t tid, llvm::SmallVectorImpl<char> &name);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h Tue Sep  6 15:57:50 2016
@@ -20,103 +20,107 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Core/Connection.h"
+#include "lldb/Host/IOObject.h"
 #include "lldb/Host/Pipe.h"
 #include "lldb/Host/Predicate.h"
-#include "lldb/Host/IOObject.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class Error;
 class Socket;
 class SocketAddress;
 
-class ConnectionFileDescriptor : public Connection
-{
-  public:
-    static const char* LISTEN_SCHEME;
-    static const char* ACCEPT_SCHEME;
-    static const char* UNIX_ACCEPT_SCHEME;
-    static const char* CONNECT_SCHEME;
-    static const char* TCP_CONNECT_SCHEME;
-    static const char* UDP_SCHEME;
-    static const char* UNIX_CONNECT_SCHEME;
-    static const char* UNIX_ABSTRACT_CONNECT_SCHEME;
-    static const char* FD_SCHEME;
-    static const char* FILE_SCHEME;
+class ConnectionFileDescriptor : public Connection {
+public:
+  static const char *LISTEN_SCHEME;
+  static const char *ACCEPT_SCHEME;
+  static const char *UNIX_ACCEPT_SCHEME;
+  static const char *CONNECT_SCHEME;
+  static const char *TCP_CONNECT_SCHEME;
+  static const char *UDP_SCHEME;
+  static const char *UNIX_CONNECT_SCHEME;
+  static const char *UNIX_ABSTRACT_CONNECT_SCHEME;
+  static const char *FD_SCHEME;
+  static const char *FILE_SCHEME;
 
-    ConnectionFileDescriptor(bool child_processes_inherit = false);
+  ConnectionFileDescriptor(bool child_processes_inherit = false);
 
-    ConnectionFileDescriptor(int fd, bool owns_fd);
+  ConnectionFileDescriptor(int fd, bool owns_fd);
 
-    ConnectionFileDescriptor(Socket* socket);
+  ConnectionFileDescriptor(Socket *socket);
 
-    ~ConnectionFileDescriptor() override;
+  ~ConnectionFileDescriptor() override;
 
-    bool IsConnected() const override;
+  bool IsConnected() const override;
 
-    lldb::ConnectionStatus Connect(const char *s, Error *error_ptr) override;
+  lldb::ConnectionStatus Connect(const char *s, Error *error_ptr) override;
 
-    lldb::ConnectionStatus Disconnect(Error *error_ptr) override;
+  lldb::ConnectionStatus Disconnect(Error *error_ptr) override;
 
-    size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec, lldb::ConnectionStatus &status, Error *error_ptr) override;
+  size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec,
+              lldb::ConnectionStatus &status, Error *error_ptr) override;
 
-    size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr) override;
+  size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status,
+               Error *error_ptr) override;
 
-    std::string GetURI() override;
+  std::string GetURI() override;
 
-    lldb::ConnectionStatus BytesAvailable(uint32_t timeout_usec, Error *error_ptr);
+  lldb::ConnectionStatus BytesAvailable(uint32_t timeout_usec,
+                                        Error *error_ptr);
 
-    bool InterruptRead() override;
+  bool InterruptRead() override;
 
-    lldb::IOObjectSP
-    GetReadObject() override
-    {
-        return m_read_sp;
-    }
+  lldb::IOObjectSP GetReadObject() override { return m_read_sp; }
 
-    uint16_t GetListeningPort(uint32_t timeout_sec);
+  uint16_t GetListeningPort(uint32_t timeout_sec);
 
-    bool GetChildProcessesInherit() const;
-    void SetChildProcessesInherit(bool child_processes_inherit);
+  bool GetChildProcessesInherit() const;
+  void SetChildProcessesInherit(bool child_processes_inherit);
 
-  protected:
-    void OpenCommandPipe();
+protected:
+  void OpenCommandPipe();
 
-    void CloseCommandPipe();
+  void CloseCommandPipe();
 
-    lldb::ConnectionStatus SocketListenAndAccept(const char *host_and_port, Error *error_ptr);
+  lldb::ConnectionStatus SocketListenAndAccept(const char *host_and_port,
+                                               Error *error_ptr);
 
-    lldb::ConnectionStatus ConnectTCP(const char *host_and_port, Error *error_ptr);
+  lldb::ConnectionStatus ConnectTCP(const char *host_and_port,
+                                    Error *error_ptr);
 
-    lldb::ConnectionStatus ConnectUDP(const char *args, Error *error_ptr);
+  lldb::ConnectionStatus ConnectUDP(const char *args, Error *error_ptr);
 
-    lldb::ConnectionStatus NamedSocketConnect(const char *socket_name, Error *error_ptr);
+  lldb::ConnectionStatus NamedSocketConnect(const char *socket_name,
+                                            Error *error_ptr);
 
-    lldb::ConnectionStatus NamedSocketAccept(const char *socket_name, Error *error_ptr);
+  lldb::ConnectionStatus NamedSocketAccept(const char *socket_name,
+                                           Error *error_ptr);
 
-    lldb::ConnectionStatus UnixAbstractSocketConnect(const char *socket_name, Error *error_ptr);
+  lldb::ConnectionStatus UnixAbstractSocketConnect(const char *socket_name,
+                                                   Error *error_ptr);
 
-    lldb::IOObjectSP m_read_sp;
-    lldb::IOObjectSP m_write_sp;
+  lldb::IOObjectSP m_read_sp;
+  lldb::IOObjectSP m_write_sp;
 
-    Predicate<uint16_t> m_port_predicate; // Used when binding to port zero to wait for the thread
-                                          // that creates the socket, binds and listens to resolve
-                                          // the port number.
+  Predicate<uint16_t>
+      m_port_predicate; // Used when binding to port zero to wait for the thread
+                        // that creates the socket, binds and listens to resolve
+                        // the port number.
 
-    Pipe m_pipe;
-    std::recursive_mutex m_mutex;
-    std::atomic<bool> m_shutting_down; // This marks that we are shutting down so if we get woken up from
-                                       // BytesAvailable to disconnect, we won't try to read again.
-    bool m_waiting_for_accept;
-    bool m_child_processes_inherit;
+  Pipe m_pipe;
+  std::recursive_mutex m_mutex;
+  std::atomic<bool> m_shutting_down; // This marks that we are shutting down so
+                                     // if we get woken up from
+  // BytesAvailable to disconnect, we won't try to read again.
+  bool m_waiting_for_accept;
+  bool m_child_processes_inherit;
 
-    std::string m_uri;
+  std::string m_uri;
 
-  private:
-    void InitializeSocket(Socket* socket);
+private:
+  void InitializeSocket(Socket *socket);
 
-    DISALLOW_COPY_AND_ASSIGN(ConnectionFileDescriptor);
+  DISALLOW_COPY_AND_ASSIGN(ConnectionFileDescriptor);
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/posix/DomainSocket.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/DomainSocket.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/DomainSocket.h (original)
+++ lldb/trunk/include/lldb/Host/posix/DomainSocket.h Tue Sep  6 15:57:50 2016
@@ -12,26 +12,26 @@
 
 #include "lldb/Host/Socket.h"
 
-namespace lldb_private
-{
-    class DomainSocket: public Socket
-    {
-    public:
-        DomainSocket(bool child_processes_inherit, Error &error);
-
-        Error Connect(llvm::StringRef name) override;
-        Error Listen(llvm::StringRef name, int backlog) override;
-        Error Accept(llvm::StringRef name, bool child_processes_inherit, Socket *&socket) override;
-
-    protected:
-        DomainSocket(SocketProtocol protocol, bool child_processes_inherit, Error &error);
-
-        virtual size_t GetNameOffset() const;
-        virtual void DeleteSocketFile(llvm::StringRef name);
-
-    private:
-        DomainSocket(NativeSocket socket);
-    };
+namespace lldb_private {
+class DomainSocket : public Socket {
+public:
+  DomainSocket(bool child_processes_inherit, Error &error);
+
+  Error Connect(llvm::StringRef name) override;
+  Error Listen(llvm::StringRef name, int backlog) override;
+  Error Accept(llvm::StringRef name, bool child_processes_inherit,
+               Socket *&socket) override;
+
+protected:
+  DomainSocket(SocketProtocol protocol, bool child_processes_inherit,
+               Error &error);
+
+  virtual size_t GetNameOffset() const;
+  virtual void DeleteSocketFile(llvm::StringRef name);
+
+private:
+  DomainSocket(NativeSocket socket);
+};
 }
 
 #endif // ifndef liblldb_DomainSocket_h_

Modified: lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h Tue Sep  6 15:57:50 2016
@@ -13,33 +13,30 @@
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/HostInfoBase.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class HostInfoPosix : public HostInfoBase
-{
-    friend class HostInfoBase;
-
-  public:
-    static size_t GetPageSize();
-    static bool GetHostname(std::string &s);
-    static const char *LookupUserName(uint32_t uid, std::string &user_name);
-    static const char *LookupGroupName(uint32_t gid, std::string &group_name);
-
-    static uint32_t GetUserID();
-    static uint32_t GetGroupID();
-    static uint32_t GetEffectiveUserID();
-    static uint32_t GetEffectiveGroupID();
+class HostInfoPosix : public HostInfoBase {
+  friend class HostInfoBase;
 
-    static FileSpec GetDefaultShell();
+public:
+  static size_t GetPageSize();
+  static bool GetHostname(std::string &s);
+  static const char *LookupUserName(uint32_t uid, std::string &user_name);
+  static const char *LookupGroupName(uint32_t gid, std::string &group_name);
 
-    static bool
-    GetEnvironmentVar(const std::string &var_name, std::string &var);
+  static uint32_t GetUserID();
+  static uint32_t GetGroupID();
+  static uint32_t GetEffectiveUserID();
+  static uint32_t GetEffectiveGroupID();
+
+  static FileSpec GetDefaultShell();
+
+  static bool GetEnvironmentVar(const std::string &var_name, std::string &var);
 
 protected:
-    static bool ComputeSupportExeDirectory(FileSpec &file_spec);
-    static bool ComputeHeaderDirectory(FileSpec &file_spec);
-    static bool ComputePythonDirectory(FileSpec &file_spec);
+  static bool ComputeSupportExeDirectory(FileSpec &file_spec);
+  static bool ComputeHeaderDirectory(FileSpec &file_spec);
+  static bool ComputePythonDirectory(FileSpec &file_spec);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/posix/HostProcessPosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/HostProcessPosix.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/HostProcessPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/HostProcessPosix.h Tue Sep  6 15:57:50 2016
@@ -14,33 +14,31 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-types.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Host/HostNativeProcessBase.h"
+#include "lldb/lldb-types.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class FileSpec;
 
-class HostProcessPosix : public HostNativeProcessBase
-{
-  public:
-    HostProcessPosix();
-    HostProcessPosix(lldb::process_t process);
-    ~HostProcessPosix() override;
-
-    virtual Error Signal(int signo) const;
-    static Error Signal(lldb::process_t process, int signo);
+class HostProcessPosix : public HostNativeProcessBase {
+public:
+  HostProcessPosix();
+  HostProcessPosix(lldb::process_t process);
+  ~HostProcessPosix() override;
+
+  virtual Error Signal(int signo) const;
+  static Error Signal(lldb::process_t process, int signo);
 
-    Error Terminate() override;
-    Error GetMainModule(FileSpec &file_spec) const override;
+  Error Terminate() override;
+  Error GetMainModule(FileSpec &file_spec) const override;
 
-    lldb::pid_t GetProcessId() const override;
-    bool IsRunning() const override;
+  lldb::pid_t GetProcessId() const override;
+  bool IsRunning() const override;
 
-    HostThread
-    StartMonitoring(const Host::MonitorChildProcessCallback &callback, bool monitor_signals) override;
+  HostThread StartMonitoring(const Host::MonitorChildProcessCallback &callback,
+                             bool monitor_signals) override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/posix/HostThreadPosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/HostThreadPosix.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/HostThreadPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/HostThreadPosix.h Tue Sep  6 15:57:50 2016
@@ -12,22 +12,20 @@
 
 #include "lldb/Host/HostNativeThreadBase.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class HostThreadPosix : public HostNativeThreadBase
-{
-    DISALLOW_COPY_AND_ASSIGN(HostThreadPosix);
-
-  public:
-    HostThreadPosix();
-    HostThreadPosix(lldb::thread_t thread);
-    ~HostThreadPosix() override;
+class HostThreadPosix : public HostNativeThreadBase {
+  DISALLOW_COPY_AND_ASSIGN(HostThreadPosix);
 
-    Error Join(lldb::thread_result_t *result) override;
-    Error Cancel() override;
+public:
+  HostThreadPosix();
+  HostThreadPosix(lldb::thread_t thread);
+  ~HostThreadPosix() override;
 
-    Error Detach();
+  Error Join(lldb::thread_result_t *result) override;
+  Error Cancel() override;
+
+  Error Detach();
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/posix/LockFilePosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/LockFilePosix.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/LockFilePosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/LockFilePosix.h Tue Sep  6 15:57:50 2016
@@ -14,27 +14,21 @@
 
 namespace lldb_private {
 
-class LockFilePosix : public LockFileBase
-{
+class LockFilePosix : public LockFileBase {
 public:
-    explicit LockFilePosix (int fd);
-    ~LockFilePosix () override;
+  explicit LockFilePosix(int fd);
+  ~LockFilePosix() override;
 
 protected:
-    Error
-    DoWriteLock (const uint64_t start, const uint64_t len) override;
+  Error DoWriteLock(const uint64_t start, const uint64_t len) override;
 
-    Error
-    DoTryWriteLock (const uint64_t start, const uint64_t len) override;
+  Error DoTryWriteLock(const uint64_t start, const uint64_t len) override;
 
-    Error
-    DoReadLock (const uint64_t start, const uint64_t len) override;
+  Error DoReadLock(const uint64_t start, const uint64_t len) override;
 
-    Error
-    DoTryReadLock (const uint64_t start, const uint64_t len) override;
+  Error DoTryReadLock(const uint64_t start, const uint64_t len) override;
 
-    Error
-    DoUnlock () override;
+  Error DoUnlock() override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/posix/MainLoopPosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/MainLoopPosix.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/MainLoopPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/MainLoopPosix.h Tue Sep  6 15:57:50 2016
@@ -16,85 +16,89 @@
 
 namespace lldb_private {
 
-// Posix implementation of the MainLoopBase class. It can monitor file descriptors for
-// readability using pselect. In addition to the common base, this class provides the ability to
+// Posix implementation of the MainLoopBase class. It can monitor file
+// descriptors for
+// readability using pselect. In addition to the common base, this class
+// provides the ability to
 // invoke a given handler when a signal is received.
 //
-// Since this class is primarily intended to be used for single-threaded processing, it does not
-// attempt to perform any internal synchronisation and any concurrent accesses must be protected
-// externally. However, it is perfectly legitimate to have more than one instance of this class
-// running on separate threads, or even a single thread (with some limitations on signal
+// Since this class is primarily intended to be used for single-threaded
+// processing, it does not
+// attempt to perform any internal synchronisation and any concurrent accesses
+// must be protected
+// externally. However, it is perfectly legitimate to have more than one
+// instance of this class
+// running on separate threads, or even a single thread (with some limitations
+// on signal
 // monitoring).
 // TODO: Add locking if this class is to be used in a multi-threaded context.
-class MainLoopPosix: public MainLoopBase
-{
+class MainLoopPosix : public MainLoopBase {
 private:
-    class SignalHandle;
+  class SignalHandle;
 
 public:
-    typedef std::unique_ptr<SignalHandle> SignalHandleUP;
+  typedef std::unique_ptr<SignalHandle> SignalHandleUP;
 
-    ~MainLoopPosix() override;
+  ~MainLoopPosix() override;
 
-    ReadHandleUP
-    RegisterReadObject(const lldb::IOObjectSP &object_sp, const Callback &callback, Error &error) override;
-
-    // Listening for signals from multiple MainLoopPosix instances is perfectly safe as long as they
-    // don't try to listen for the same signal. The callback function is invoked when the control
-    // returns to the Run() function, not when the hander is executed. This means that you can
-    // treat the callback as a normal function and perform things which would not be safe in a
-    // signal handler. However, since the callback is not invoked synchronously, you cannot use
-    // this mechanism to handle SIGSEGV and the like.
-    SignalHandleUP
-    RegisterSignal(int signo, const Callback &callback, Error &error);
-
-    Error
-    Run() override;
-
-    // This should only be performed from a callback. Do not attempt to terminate the processing
-    // from another thread.
-    // TODO: Add synchronization if we want to be terminated from another thread.
-    void
-    RequestTermination() override
-    { m_terminate_request = true; }
+  ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp,
+                                  const Callback &callback,
+                                  Error &error) override;
+
+  // Listening for signals from multiple MainLoopPosix instances is perfectly
+  // safe as long as they
+  // don't try to listen for the same signal. The callback function is invoked
+  // when the control
+  // returns to the Run() function, not when the hander is executed. This means
+  // that you can
+  // treat the callback as a normal function and perform things which would not
+  // be safe in a
+  // signal handler. However, since the callback is not invoked synchronously,
+  // you cannot use
+  // this mechanism to handle SIGSEGV and the like.
+  SignalHandleUP RegisterSignal(int signo, const Callback &callback,
+                                Error &error);
+
+  Error Run() override;
+
+  // This should only be performed from a callback. Do not attempt to terminate
+  // the processing
+  // from another thread.
+  // TODO: Add synchronization if we want to be terminated from another thread.
+  void RequestTermination() override { m_terminate_request = true; }
 
 protected:
-    void
-    UnregisterReadObject(IOObject::WaitableHandle handle) override;
+  void UnregisterReadObject(IOObject::WaitableHandle handle) override;
 
-    void
-    UnregisterSignal(int signo);
+  void UnregisterSignal(int signo);
 
 private:
-    class SignalHandle
-    {
-    public:
-        ~SignalHandle() { m_mainloop.UnregisterSignal(m_signo); }
-
-    private:
-        SignalHandle(MainLoopPosix &mainloop, int signo) : m_mainloop(mainloop), m_signo(signo) { }
-
-        MainLoopPosix &m_mainloop;
-        int m_signo;
-
-        friend class MainLoopPosix;
-        DISALLOW_COPY_AND_ASSIGN(SignalHandle);
-    };
-
-    struct SignalInfo
-    {
-        Callback callback;
-        struct sigaction old_action;
-        bool was_blocked : 1;
-    };
-
-    llvm::DenseMap<IOObject::WaitableHandle, Callback> m_read_fds;
-    llvm::DenseMap<int, SignalInfo> m_signals;
-    bool m_terminate_request : 1;
+  class SignalHandle {
+  public:
+    ~SignalHandle() { m_mainloop.UnregisterSignal(m_signo); }
+
+  private:
+    SignalHandle(MainLoopPosix &mainloop, int signo)
+        : m_mainloop(mainloop), m_signo(signo) {}
+
+    MainLoopPosix &m_mainloop;
+    int m_signo;
+
+    friend class MainLoopPosix;
+    DISALLOW_COPY_AND_ASSIGN(SignalHandle);
+  };
+
+  struct SignalInfo {
+    Callback callback;
+    struct sigaction old_action;
+    bool was_blocked : 1;
+  };
+
+  llvm::DenseMap<IOObject::WaitableHandle, Callback> m_read_fds;
+  llvm::DenseMap<int, SignalInfo> m_signals;
+  bool m_terminate_request : 1;
 };
 
 } // namespace lldb_private
 
-
 #endif // lldb_Host_posix_MainLoopPosix_h_
-

Modified: lldb/trunk/include/lldb/Host/posix/PipePosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/PipePosix.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/PipePosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/PipePosix.h Tue Sep  6 15:57:50 2016
@@ -22,67 +22,53 @@ namespace lldb_private {
 ///
 /// A class that abstracts the LLDB core from host pipe functionality.
 //----------------------------------------------------------------------
-class PipePosix : public PipeBase
-{
+class PipePosix : public PipeBase {
 public:
-    static int kInvalidDescriptor;
+  static int kInvalidDescriptor;
 
-    PipePosix();
-    PipePosix(int read_fd, int write_fd);
-    PipePosix(const PipePosix &) = delete;
-    PipePosix(PipePosix &&pipe_posix);
-    PipePosix &operator=(const PipePosix &) = delete;
-    PipePosix &operator=(PipePosix &&pipe_posix);
-
-    ~PipePosix() override;
-
-    Error
-    CreateNew(bool child_process_inherit) override;
-    Error
-    CreateNew(llvm::StringRef name, bool child_process_inherit) override;
-    Error
-    CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl<char>& name) override;
-    Error
-    OpenAsReader(llvm::StringRef name, bool child_process_inherit) override;
-    Error
-    OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override;
-
-    bool
-    CanRead() const override;
-    bool
-    CanWrite() const override;
-
-    int
-    GetReadFileDescriptor() const override;
-    int
-    GetWriteFileDescriptor() const override;
-    int
-    ReleaseReadFileDescriptor() override;
-    int
-    ReleaseWriteFileDescriptor() override;
-    void
-    CloseReadFileDescriptor() override;
-    void
-    CloseWriteFileDescriptor() override;
-
-
-    // Close both descriptors
-    void
-    Close() override;
-
-    Error
-    Delete(llvm::StringRef name) override;
-
-    Error
-    Write(const void *buf, size_t size, size_t &bytes_written) override;
-    Error
-    ReadWithTimeout(void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_read) override;
+  PipePosix();
+  PipePosix(int read_fd, int write_fd);
+  PipePosix(const PipePosix &) = delete;
+  PipePosix(PipePosix &&pipe_posix);
+  PipePosix &operator=(const PipePosix &) = delete;
+  PipePosix &operator=(PipePosix &&pipe_posix);
+
+  ~PipePosix() override;
+
+  Error CreateNew(bool child_process_inherit) override;
+  Error CreateNew(llvm::StringRef name, bool child_process_inherit) override;
+  Error CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit,
+                             llvm::SmallVectorImpl<char> &name) override;
+  Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) override;
+  Error
+  OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit,
+                          const std::chrono::microseconds &timeout) override;
+
+  bool CanRead() const override;
+  bool CanWrite() const override;
+
+  int GetReadFileDescriptor() const override;
+  int GetWriteFileDescriptor() const override;
+  int ReleaseReadFileDescriptor() override;
+  int ReleaseWriteFileDescriptor() override;
+  void CloseReadFileDescriptor() override;
+  void CloseWriteFileDescriptor() override;
+
+  // Close both descriptors
+  void Close() override;
+
+  Error Delete(llvm::StringRef name) override;
+
+  Error Write(const void *buf, size_t size, size_t &bytes_written) override;
+  Error ReadWithTimeout(void *buf, size_t size,
+                        const std::chrono::microseconds &timeout,
+                        size_t &bytes_read) override;
 
 private:
-    int m_fds[2];
+  int m_fds[2];
 };
 
 } // namespace lldb_private
 
-#endif  // #if defined(__cplusplus)
-#endif  // liblldb_Host_posix_PipePosix_h_
+#endif // #if defined(__cplusplus)
+#endif // liblldb_Host_posix_PipePosix_h_

Modified: lldb/trunk/include/lldb/Host/posix/ProcessLauncherPosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/ProcessLauncherPosix.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/ProcessLauncherPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/ProcessLauncherPosix.h Tue Sep  6 15:57:50 2016
@@ -12,13 +12,12 @@
 
 #include "lldb/Host/ProcessLauncher.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class ProcessLauncherPosix : public ProcessLauncher
-{
-  public:
-    HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error) override;
+class ProcessLauncherPosix : public ProcessLauncher {
+public:
+  HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+                            Error &error) override;
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/windows/AutoHandle.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/AutoHandle.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/AutoHandle.h (original)
+++ lldb/trunk/include/lldb/Host/windows/AutoHandle.h Tue Sep  6 15:57:50 2016
@@ -10,31 +10,26 @@
 #ifndef LLDB_lldb_Host_windows_AutoHandle_h_
 #define LLDB_lldb_Host_windows_AutoHandle_h_
 
-namespace lldb_private  {
+namespace lldb_private {
 
-class AutoHandle  {
+class AutoHandle {
 public:
-    AutoHandle(HANDLE handle, HANDLE invalid_value = INVALID_HANDLE_VALUE)
-        : m_handle(handle)
-        , m_invalid_value(invalid_value)
-    {
-    }
-
-    ~AutoHandle()
-    {
-        if (m_handle != m_invalid_value)
-            ::CloseHandle(m_handle);
-    }
+  AutoHandle(HANDLE handle, HANDLE invalid_value = INVALID_HANDLE_VALUE)
+      : m_handle(handle), m_invalid_value(invalid_value) {}
 
-    bool IsValid() const { return m_handle != m_invalid_value; }
+  ~AutoHandle() {
+    if (m_handle != m_invalid_value)
+      ::CloseHandle(m_handle);
+  }
+
+  bool IsValid() const { return m_handle != m_invalid_value; }
+
+  HANDLE get() const { return m_handle; }
 
-    HANDLE get() const { return m_handle; }
 private:
-    HANDLE m_handle;
-    HANDLE m_invalid_value;
+  HANDLE m_handle;
+  HANDLE m_invalid_value;
 };
-
 }
 
 #endif
-

Modified: lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/ConnectionGenericFileWindows.h Tue Sep  6 15:57:50 2016
@@ -14,54 +14,50 @@
 #include "lldb/Host/windows/windows.h"
 #include "lldb/lldb-types.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class Error;
 
-class ConnectionGenericFile : public lldb_private::Connection
-{
-  public:
-    ConnectionGenericFile();
+class ConnectionGenericFile : public lldb_private::Connection {
+public:
+  ConnectionGenericFile();
 
-    ConnectionGenericFile(lldb::file_t file, bool owns_file);
+  ConnectionGenericFile(lldb::file_t file, bool owns_file);
 
-    ~ConnectionGenericFile() override;
+  ~ConnectionGenericFile() override;
 
-    bool IsConnected() const override;
+  bool IsConnected() const override;
 
-    lldb::ConnectionStatus Connect(const char *s, Error *error_ptr) override;
+  lldb::ConnectionStatus Connect(const char *s, Error *error_ptr) override;
 
-    lldb::ConnectionStatus Disconnect(Error *error_ptr) override;
+  lldb::ConnectionStatus Disconnect(Error *error_ptr) override;
 
-    size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec, lldb::ConnectionStatus &status, Error *error_ptr) override;
+  size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec,
+              lldb::ConnectionStatus &status, Error *error_ptr) override;
 
-    size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr) override;
+  size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status,
+               Error *error_ptr) override;
 
-    std::string GetURI() override;
+  std::string GetURI() override;
 
-    bool InterruptRead() override;
+  bool InterruptRead() override;
 
-  protected:
-    OVERLAPPED m_overlapped;
-    HANDLE m_file;
-    HANDLE m_event_handles[2];
-    bool m_owns_file;
-    LARGE_INTEGER m_file_position;
+protected:
+  OVERLAPPED m_overlapped;
+  HANDLE m_file;
+  HANDLE m_event_handles[2];
+  bool m_owns_file;
+  LARGE_INTEGER m_file_position;
 
-    enum
-    {
-        kBytesAvailableEvent,
-        kInterruptEvent
-    };
+  enum { kBytesAvailableEvent, kInterruptEvent };
 
-  private:
-    void InitializeEventHandles();
-    void IncrementFilePointer(DWORD amount);
+private:
+  void InitializeEventHandles();
+  void IncrementFilePointer(DWORD amount);
 
-    std::string m_uri;
+  std::string m_uri;
 
-    DISALLOW_COPY_AND_ASSIGN(ConnectionGenericFile);
+  DISALLOW_COPY_AND_ASSIGN(ConnectionGenericFile);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h Tue Sep  6 15:57:50 2016
@@ -10,51 +10,39 @@
 #ifndef lldb_Host_windows_HostInfoWindows_h_
 #define lldb_Host_windows_HostInfoWindows_h_
 
-#include "lldb/Host/HostInfoBase.h"
 #include "lldb/Host/FileSpec.h"
+#include "lldb/Host/HostInfoBase.h"
+
+namespace lldb_private {
+
+class HostInfoWindows : public HostInfoBase {
+  friend class HostInfoBase;
+
+private:
+  // Static class, unconstructable.
+  HostInfoWindows();
+  ~HostInfoWindows();
+
+public:
+  static void Initialize();
+  static void Terminate();
 
-namespace lldb_private
-{
+  static size_t GetPageSize();
 
-class HostInfoWindows : public HostInfoBase
-{
-    friend class HostInfoBase;
-
-  private:
-    // Static class, unconstructable.
-    HostInfoWindows();
-    ~HostInfoWindows();
-
-  public:
-      static void
-      Initialize();
-      static void
-      Terminate();
-
-      static size_t
-      GetPageSize();
-
-      static bool
-      GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
-      static bool
-      GetOSBuildString(std::string &s);
-      static bool
-      GetOSKernelDescription(std::string &s);
-      static bool
-      GetHostname(std::string &s);
-      static FileSpec
-      GetProgramFileSpec();
-      static FileSpec
-      GetDefaultShell();
+  static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
+  static bool GetOSBuildString(std::string &s);
+  static bool GetOSKernelDescription(std::string &s);
+  static bool GetHostname(std::string &s);
+  static FileSpec GetProgramFileSpec();
+  static FileSpec GetDefaultShell();
 
-      static bool
-      GetEnvironmentVar(const std::string &var_name, std::string &var);
+  static bool GetEnvironmentVar(const std::string &var_name, std::string &var);
 
-  protected:
-    static bool ComputePythonDirectory(FileSpec &file_spec);
+protected:
+  static bool ComputePythonDirectory(FileSpec &file_spec);
 
-  private:
-    static FileSpec m_program_filespec;
+private:
+  static FileSpec m_program_filespec;
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/windows/HostProcessWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/HostProcessWindows.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/HostProcessWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/HostProcessWindows.h Tue Sep  6 15:57:50 2016
@@ -13,35 +13,33 @@
 #include "lldb/Host/HostNativeProcessBase.h"
 #include "lldb/lldb-types.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class FileSpec;
 
-class HostProcessWindows : public HostNativeProcessBase
-{
-  public:
-    HostProcessWindows();
-    explicit HostProcessWindows(lldb::process_t process);
-    ~HostProcessWindows();
-
-    void SetOwnsHandle(bool owns);
+class HostProcessWindows : public HostNativeProcessBase {
+public:
+  HostProcessWindows();
+  explicit HostProcessWindows(lldb::process_t process);
+  ~HostProcessWindows();
+
+  void SetOwnsHandle(bool owns);
 
-    virtual Error Terminate();
-    virtual Error GetMainModule(FileSpec &file_spec) const;
+  virtual Error Terminate();
+  virtual Error GetMainModule(FileSpec &file_spec) const;
 
-    virtual lldb::pid_t GetProcessId() const;
-    virtual bool IsRunning() const;
+  virtual lldb::pid_t GetProcessId() const;
+  virtual bool IsRunning() const;
 
-    HostThread
-    StartMonitoring(const Host::MonitorChildProcessCallback &callback, bool monitor_signals) override;
+  HostThread StartMonitoring(const Host::MonitorChildProcessCallback &callback,
+                             bool monitor_signals) override;
 
 private:
-    static lldb::thread_result_t MonitorThread(void *thread_arg);
+  static lldb::thread_result_t MonitorThread(void *thread_arg);
 
-    void Close();
+  void Close();
 
-    bool m_owns_handle;
+  bool m_owns_handle;
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/windows/HostThreadWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/HostThreadWindows.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/HostThreadWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/HostThreadWindows.h Tue Sep  6 15:57:50 2016
@@ -14,28 +14,26 @@
 
 #include "llvm/ADT/SmallString.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class HostThreadWindows : public HostNativeThreadBase
-{
-    DISALLOW_COPY_AND_ASSIGN(HostThreadWindows);
+class HostThreadWindows : public HostNativeThreadBase {
+  DISALLOW_COPY_AND_ASSIGN(HostThreadWindows);
 
-  public:
-    HostThreadWindows();
-    HostThreadWindows(lldb::thread_t thread);
-    virtual ~HostThreadWindows();
+public:
+  HostThreadWindows();
+  HostThreadWindows(lldb::thread_t thread);
+  virtual ~HostThreadWindows();
 
-    void SetOwnsHandle(bool owns);
+  void SetOwnsHandle(bool owns);
 
-    virtual Error Join(lldb::thread_result_t *result);
-    virtual Error Cancel();
-    virtual void Reset();
+  virtual Error Join(lldb::thread_result_t *result);
+  virtual Error Cancel();
+  virtual void Reset();
 
-    lldb::tid_t GetThreadId() const;
+  lldb::tid_t GetThreadId() const;
 
-  private:
-    bool m_owns_handle;
+private:
+  bool m_owns_handle;
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/windows/LockFileWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/LockFileWindows.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/LockFileWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/LockFileWindows.h Tue Sep  6 15:57:50 2016
@@ -15,35 +15,28 @@
 
 namespace lldb_private {
 
-class LockFileWindows : public LockFileBase
-{
+class LockFileWindows : public LockFileBase {
 public:
-    explicit LockFileWindows (int fd);
-    ~LockFileWindows ();
+  explicit LockFileWindows(int fd);
+  ~LockFileWindows();
 
 protected:
-    Error
-    DoWriteLock (const uint64_t start, const uint64_t len) override;
+  Error DoWriteLock(const uint64_t start, const uint64_t len) override;
 
-    Error
-    DoTryWriteLock (const uint64_t start, const uint64_t len) override;
+  Error DoTryWriteLock(const uint64_t start, const uint64_t len) override;
 
-    Error
-    DoReadLock (const uint64_t start, const uint64_t len) override;
+  Error DoReadLock(const uint64_t start, const uint64_t len) override;
 
-    Error
-    DoTryReadLock (const uint64_t start, const uint64_t len) override;
+  Error DoTryReadLock(const uint64_t start, const uint64_t len) override;
 
-    Error
-    DoUnlock () override;
+  Error DoUnlock() override;
 
-    bool
-    IsValidFile () const override;
+  bool IsValidFile() const override;
 
 private:
-    HANDLE m_file;
+  HANDLE m_file;
 };
 
-}  // namespace lldb_private
+} // namespace lldb_private
 
-#endif  // liblldb_Host_posix_LockFileWindows_h_
+#endif // liblldb_Host_posix_LockFileWindows_h_

Modified: lldb/trunk/include/lldb/Host/windows/PipeWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/PipeWindows.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/PipeWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/PipeWindows.h Tue Sep  6 15:57:50 2016
@@ -13,8 +13,7 @@
 #include "lldb/Host/PipeBase.h"
 #include "lldb/Host/windows/windows.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 //----------------------------------------------------------------------
 /// @class Pipe PipeWindows.h "lldb/Host/windows/PipeWindows.h"
@@ -23,50 +22,56 @@ namespace lldb_private
 ///
 /// A class that abstracts the LLDB core from host pipe functionality.
 //----------------------------------------------------------------------
-class PipeWindows : public PipeBase
-{
-  public:
-    PipeWindows();
-    ~PipeWindows() override;
-
-    Error CreateNew(bool child_process_inherit) override;
-    Error CreateNew(llvm::StringRef name, bool child_process_inherit) override;
-    Error CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl<char>& name) override;
-    Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) override;
-    Error OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override;
-
-    bool CanRead() const override;
-    bool CanWrite() const override;
-
-    int GetReadFileDescriptor() const override;
-    int GetWriteFileDescriptor() const override;
-    int ReleaseReadFileDescriptor() override;
-    int ReleaseWriteFileDescriptor() override;
-    void CloseReadFileDescriptor() override;
-    void CloseWriteFileDescriptor() override;
-
-    void Close() override;
-
-    Error Delete(llvm::StringRef name) override;
-
-    Error Write(const void *buf, size_t size, size_t &bytes_written) override;
-    Error ReadWithTimeout(void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_read) override;
-
-    // PipeWindows specific methods.  These allow access to the underlying OS handle.
-    HANDLE GetReadNativeHandle();
-    HANDLE GetWriteNativeHandle();
-
-  private:
-    Error OpenNamedPipe(llvm::StringRef name, bool child_process_inherit, bool is_read);
+class PipeWindows : public PipeBase {
+public:
+  PipeWindows();
+  ~PipeWindows() override;
+
+  Error CreateNew(bool child_process_inherit) override;
+  Error CreateNew(llvm::StringRef name, bool child_process_inherit) override;
+  Error CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit,
+                             llvm::SmallVectorImpl<char> &name) override;
+  Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) override;
+  Error
+  OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit,
+                          const std::chrono::microseconds &timeout) override;
+
+  bool CanRead() const override;
+  bool CanWrite() const override;
+
+  int GetReadFileDescriptor() const override;
+  int GetWriteFileDescriptor() const override;
+  int ReleaseReadFileDescriptor() override;
+  int ReleaseWriteFileDescriptor() override;
+  void CloseReadFileDescriptor() override;
+  void CloseWriteFileDescriptor() override;
+
+  void Close() override;
+
+  Error Delete(llvm::StringRef name) override;
+
+  Error Write(const void *buf, size_t size, size_t &bytes_written) override;
+  Error ReadWithTimeout(void *buf, size_t size,
+                        const std::chrono::microseconds &timeout,
+                        size_t &bytes_read) override;
+
+  // PipeWindows specific methods.  These allow access to the underlying OS
+  // handle.
+  HANDLE GetReadNativeHandle();
+  HANDLE GetWriteNativeHandle();
+
+private:
+  Error OpenNamedPipe(llvm::StringRef name, bool child_process_inherit,
+                      bool is_read);
 
-    HANDLE m_read;
-    HANDLE m_write;
+  HANDLE m_read;
+  HANDLE m_write;
 
-    int m_read_fd;
-    int m_write_fd;
+  int m_read_fd;
+  int m_write_fd;
 
-    OVERLAPPED m_read_overlapped;
-    OVERLAPPED m_write_overlapped;
+  OVERLAPPED m_read_overlapped;
+  OVERLAPPED m_write_overlapped;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/windows/PosixApi.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/PosixApi.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/PosixApi.h (original)
+++ lldb/trunk/include/lldb/Host/windows/PosixApi.h Tue Sep  6 15:57:50 2016
@@ -25,26 +25,26 @@
 #define PATH_MAX 32768
 #endif
 
-#define O_NOCTTY    0
-#define O_NONBLOCK  0
-#define SIGTRAP     5
-#define SIGKILL     9
-#define SIGSTOP     20
+#define O_NOCTTY 0
+#define O_NONBLOCK 0
+#define SIGTRAP 5
+#define SIGKILL 9
+#define SIGSTOP 20
 
 #if defined(_MSC_VER)
-# define S_IRUSR  S_IREAD                      /* read, user */
-# define S_IWUSR  S_IWRITE                     /* write, user */
-# define S_IXUSR  0                            /* execute, user */
-#endif
-#define S_IRGRP  0                            /* read, group */
-#define S_IWGRP  0                            /* write, group */
-#define S_IXGRP  0                            /* execute, group */
-#define S_IROTH  0                            /* read, others */
-#define S_IWOTH  0                            /* write, others */
-#define S_IXOTH  0                            /* execute, others */
-#define S_IRWXU  0
-#define S_IRWXG  0
-#define S_IRWXO  0
+#define S_IRUSR S_IREAD  /* read, user */
+#define S_IWUSR S_IWRITE /* write, user */
+#define S_IXUSR 0        /* execute, user */
+#endif
+#define S_IRGRP 0 /* read, group */
+#define S_IWGRP 0 /* write, group */
+#define S_IXGRP 0 /* execute, group */
+#define S_IROTH 0 /* read, others */
+#define S_IWOTH 0 /* write, others */
+#define S_IXOTH 0 /* execute, others */
+#define S_IRWXU 0
+#define S_IRWXG 0
+#define S_IRWXO 0
 
 #ifdef _MSC_VER
 
@@ -54,54 +54,55 @@
 // open(), close(), creat(), etc.
 #include <io.h>
 
-
 typedef unsigned short mode_t;
 
-// pyconfig.h typedefs this.  We require python headers to be included before any
+// pyconfig.h typedefs this.  We require python headers to be included before
+// any
 // LLDB headers, but there's no way to prevent python's pid_t definition from
 // leaking, so this is the best option.
 #ifndef Py_CONFIG_H
 typedef uint32_t pid_t;
 #endif
 
-#define STDIN_FILENO  0
+#define STDIN_FILENO 0
 #define STDOUT_FILENO 1
 #define STDERR_FILENO 2
 
-#define S_IFDIR  _S_IFDIR
-#define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
+#define S_IFDIR _S_IFDIR
+#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
 
 #endif // _MSC_VER
 
-// MSVC 2015 and higher have timespec.  Otherwise we need to define it ourselves.
+// MSVC 2015 and higher have timespec.  Otherwise we need to define it
+// ourselves.
 #if !defined(_MSC_VER) || _MSC_VER < 1900
-struct timespec
-{
+struct timespec {
   time_t tv_sec;
-  long   tv_nsec;
+  long tv_nsec;
 };
 #endif
 
-
 // Various useful posix functions that are not present in Windows.  We provide
 // custom implementations.
 int vasprintf(char **ret, const char *fmt, va_list ap);
-char * strcasestr(const char *s, const char* find);
-char* realpath(const char * name, char * resolved);
+char *strcasestr(const char *s, const char *find);
+char *realpath(const char *name, char *resolved);
 
 int usleep(uint32_t useconds);
-char* getcwd(char* path, int max);
-int chdir(const char* path);
-char* basename(char *path);
+char *getcwd(char *path, int max);
+int chdir(const char *path);
+char *basename(char *path);
 char *dirname(char *path);
 
-int strcasecmp(const char* s1, const char* s2);
-int strncasecmp(const char* s1, const char* s2, size_t n);
+int strcasecmp(const char *s1, const char *s2);
+int strncasecmp(const char *s1, const char *s2, size_t n);
 
 // empty functions
 inline int posix_openpt(int flag) { LLVM_BUILTIN_UNREACHABLE; }
 
-inline int strerror_r(int errnum, char *buf, size_t buflen) { LLVM_BUILTIN_UNREACHABLE; }
+inline int strerror_r(int errnum, char *buf, size_t buflen) {
+  LLVM_BUILTIN_UNREACHABLE;
+}
 
 inline int unlockpt(int fd) { LLVM_BUILTIN_UNREACHABLE; }
 inline int grantpt(int fd) { LLVM_BUILTIN_UNREACHABLE; }
@@ -110,16 +111,14 @@ inline char *ptsname(int fd) { LLVM_BUIL
 inline pid_t fork(void) { LLVM_BUILTIN_UNREACHABLE; }
 inline pid_t setsid(void) { LLVM_BUILTIN_UNREACHABLE; }
 
-
 // vsnprintf and snprintf are provided in MSVC 2015 and higher.
 #if _MSC_VER < 1900
 namespace lldb_private {
-  int vsnprintf(char *buffer, size_t count, const char *format, va_list argptr);
+int vsnprintf(char *buffer, size_t count, const char *format, va_list argptr);
 }
 
 // inline to avoid linkage conflicts
-int inline snprintf(char *buffer, size_t count, const char *format, ...)
-{
+int inline snprintf(char *buffer, size_t count, const char *format, ...) {
   va_list argptr;
   va_start(argptr, format);
   int r = lldb_private::vsnprintf(buffer, count, format, argptr);
@@ -128,5 +127,4 @@ int inline snprintf(char *buffer, size_t
 }
 #endif
 
-
 #endif

Modified: lldb/trunk/include/lldb/Host/windows/ProcessLauncherWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/ProcessLauncherWindows.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/ProcessLauncherWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/ProcessLauncherWindows.h Tue Sep  6 15:57:50 2016
@@ -13,18 +13,17 @@
 #include "lldb/Host/ProcessLauncher.h"
 #include "lldb/Host/windows/windows.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
 class ProcessLaunchInfo;
 
-class ProcessLauncherWindows : public ProcessLauncher
-{
-  public:
-    virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error);
+class ProcessLauncherWindows : public ProcessLauncher {
+public:
+  virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info,
+                                    Error &error);
 
-  protected:
-    HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd);
+protected:
+  HANDLE GetStdioHandle(const ProcessLaunchInfo &launch_info, int fd);
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/windows/editlinewin.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/editlinewin.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/editlinewin.h (original)
+++ lldb/trunk/include/lldb/Host/windows/editlinewin.h Tue Sep  6 15:57:50 2016
@@ -13,111 +13,104 @@
 
 // EditLine editor function return codes.
 // For user-defined function interface
-#define CC_NORM         0
-#define CC_NEWLINE      1
-#define CC_EOF          2
-#define CC_ARGHACK      3
-#define CC_REFRESH      4
-#define CC_CURSOR       5
-#define CC_ERROR        6
-#define CC_FATAL        7
-#define CC_REDISPLAY    8
+#define CC_NORM 0
+#define CC_NEWLINE 1
+#define CC_EOF 2
+#define CC_ARGHACK 3
+#define CC_REFRESH 4
+#define CC_CURSOR 5
+#define CC_ERROR 6
+#define CC_FATAL 7
+#define CC_REDISPLAY 8
 #define CC_REFRESH_BEEP 9
 
 // el_set/el_get parameters
-#define EL_PROMPT        0    // , el_pfunc_t
-#define EL_TERMINAL      1    // , const char *
-#define EL_EDITOR        2    // , const char *
-#define EL_SIGNAL        3    // , int);
-#define EL_BIND          4    // , const char *, ..., NULL
-#define EL_TELLTC        5    // , const char *, ..., NULL
-#define EL_SETTC         6    // , const char *, ..., NULL
-#define EL_ECHOTC        7    // , const char *, ..., NULL
-#define EL_SETTY         8    // , const char *, ..., NULL
-#define EL_ADDFN         9    // , const char *, const char *, el_func_t
-#define EL_HIST          10   // , hist_fun_t, const char *
-#define EL_EDITMODE      11   // , int
-#define EL_RPROMPT       12   // , el_pfunc_t
-#define EL_GETCFN        13   // , el_rfunc_t
-#define EL_CLIENTDATA    14   // , void *
-#define EL_UNBUFFERED    15   // , int
-#define EL_PREP_TERM     16   // , int
-#define EL_GETTC         17   // , const char *, ..., NULL
-#define EL_GETFP         18   // , int, FILE **
-#define EL_SETFP         19   // , int, FILE *
-#define EL_REFRESH       20   // , void
-#define EL_PROMPT_ESC	 21   // , prompt_func, Char);              set/get
+#define EL_PROMPT 0      // , el_pfunc_t
+#define EL_TERMINAL 1    // , const char *
+#define EL_EDITOR 2      // , const char *
+#define EL_SIGNAL 3      // , int);
+#define EL_BIND 4        // , const char *, ..., NULL
+#define EL_TELLTC 5      // , const char *, ..., NULL
+#define EL_SETTC 6       // , const char *, ..., NULL
+#define EL_ECHOTC 7      // , const char *, ..., NULL
+#define EL_SETTY 8       // , const char *, ..., NULL
+#define EL_ADDFN 9       // , const char *, const char *, el_func_t
+#define EL_HIST 10       // , hist_fun_t, const char *
+#define EL_EDITMODE 11   // , int
+#define EL_RPROMPT 12    // , el_pfunc_t
+#define EL_GETCFN 13     // , el_rfunc_t
+#define EL_CLIENTDATA 14 // , void *
+#define EL_UNBUFFERED 15 // , int
+#define EL_PREP_TERM 16  // , int
+#define EL_GETTC 17      // , const char *, ..., NULL
+#define EL_GETFP 18      // , int, FILE **
+#define EL_SETFP 19      // , int, FILE *
+#define EL_REFRESH 20    // , void
+#define EL_PROMPT_ESC 21 // , prompt_func, Char);              set/get
 
 #define EL_BUILTIN_GETCFN (NULL)
 
 // history defines
-#define H_FUNC           0    // , UTSL
-#define H_SETSIZE        1    // , const int
-#define H_GETSIZE        2    // , void
-#define H_FIRST          3    // , void
-#define H_LAST           4    // , void
-#define H_PREV           5    // , void
-#define H_NEXT           6    // , void
-#define H_CURR           8    // , const int
-#define H_SET            7    // , int
-#define H_ADD            9    // , const char *
-#define H_ENTER          10   // , const char *
-#define H_APPEND         11   // , const char *
-#define H_END            12   // , void
-#define H_NEXT_STR       13   // , const char *
-#define H_PREV_STR       14   // , const char *
-#define H_NEXT_EVENT     15   // , const int
-#define H_PREV_EVENT     16   // , const int
-#define H_LOAD           17   // , const char *
-#define H_SAVE           18   // , const char *
-#define H_CLEAR          19   // , void
-#define H_SETUNIQUE      20   // , int
-#define H_GETUNIQUE      21   // , void
-#define H_DEL            22   // , int
-
-struct EditLine
-{
-};
-
-struct LineInfo
-{
-    const char *buffer;
-    const char *cursor;
-    const char *lastchar;
+#define H_FUNC 0        // , UTSL
+#define H_SETSIZE 1     // , const int
+#define H_GETSIZE 2     // , void
+#define H_FIRST 3       // , void
+#define H_LAST 4        // , void
+#define H_PREV 5        // , void
+#define H_NEXT 6        // , void
+#define H_CURR 8        // , const int
+#define H_SET 7         // , int
+#define H_ADD 9         // , const char *
+#define H_ENTER 10      // , const char *
+#define H_APPEND 11     // , const char *
+#define H_END 12        // , void
+#define H_NEXT_STR 13   // , const char *
+#define H_PREV_STR 14   // , const char *
+#define H_NEXT_EVENT 15 // , const int
+#define H_PREV_EVENT 16 // , const int
+#define H_LOAD 17       // , const char *
+#define H_SAVE 18       // , const char *
+#define H_CLEAR 19      // , void
+#define H_SETUNIQUE 20  // , int
+#define H_GETUNIQUE 21  // , void
+#define H_DEL 22        // , int
+
+struct EditLine {};
+
+struct LineInfo {
+  const char *buffer;
+  const char *cursor;
+  const char *lastchar;
 };
 
-struct History
-{
-};
+struct History {};
 
-struct HistEvent
-{
-    int         num;
-    const char *str;
+struct HistEvent {
+  int num;
+  const char *str;
 };
 
-extern "C"
-{
-    // edit line API
-    EditLine        *el_init     ( const char *, FILE *, FILE *, FILE * );
-    const char      *el_gets     ( EditLine *, int * );
-    int              el_set      ( EditLine *, int, ... );
-
-    void             el_end      ( EditLine * );
-    void             el_reset    ( EditLine * );
-    int              el_getc     ( EditLine *, char * );
-    void             el_push     ( EditLine *, const char * );
-    void             el_beep     ( EditLine * );
-    int              el_parse    ( EditLine *, int, const char ** );
-    int              el_get      ( EditLine *, int, ... );
-    int              el_source   ( EditLine *, const char * );
-    void             el_resize   ( EditLine * );
-    const LineInfo  *el_line     ( EditLine * );
-    int              el_insertstr( EditLine *, const char * );
-    void             el_deletestr( EditLine *, int );
-
-    // history API
-    History         *history_init( void );
-    void             history_end ( History * );
-    int              history     ( History *, HistEvent *, int, ... );
+extern "C" {
+// edit line API
+EditLine *el_init(const char *, FILE *, FILE *, FILE *);
+const char *el_gets(EditLine *, int *);
+int el_set(EditLine *, int, ...);
+
+void el_end(EditLine *);
+void el_reset(EditLine *);
+int el_getc(EditLine *, char *);
+void el_push(EditLine *, const char *);
+void el_beep(EditLine *);
+int el_parse(EditLine *, int, const char **);
+int el_get(EditLine *, int, ...);
+int el_source(EditLine *, const char *);
+void el_resize(EditLine *);
+const LineInfo *el_line(EditLine *);
+int el_insertstr(EditLine *, const char *);
+void el_deletestr(EditLine *, int);
+
+// history API
+History *history_init(void);
+void history_end(History *);
+int history(History *, HistEvent *, int, ...);
 };
\ No newline at end of file

Modified: lldb/trunk/include/lldb/Host/windows/windows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/windows.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/windows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/windows.h Tue Sep  6 15:57:50 2016
@@ -26,4 +26,4 @@
 #define FAR
 #define NEAR
 
-#endif  // LLDB_lldb_windows_h_
+#endif // LLDB_lldb_windows_h_

Modified: lldb/trunk/include/lldb/Initialization/SystemInitializer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Initialization/SystemInitializer.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Initialization/SystemInitializer.h (original)
+++ lldb/trunk/include/lldb/Initialization/SystemInitializer.h Tue Sep  6 15:57:50 2016
@@ -10,16 +10,14 @@
 #ifndef LLDB_INITIALIZATION_SYSTEM_INITIALIZER_H
 #define LLDB_INITIALIZATION_SYSTEM_INITIALIZER_H
 
-namespace lldb_private
-{
-class SystemInitializer
-{
-  public:
-    SystemInitializer();
-    virtual ~SystemInitializer();
+namespace lldb_private {
+class SystemInitializer {
+public:
+  SystemInitializer();
+  virtual ~SystemInitializer();
 
-    virtual void Initialize() = 0;
-    virtual void Terminate() = 0;
+  virtual void Initialize() = 0;
+  virtual void Terminate() = 0;
 };
 }
 

Modified: lldb/trunk/include/lldb/Initialization/SystemInitializerCommon.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Initialization/SystemInitializerCommon.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Initialization/SystemInitializerCommon.h (original)
+++ lldb/trunk/include/lldb/Initialization/SystemInitializerCommon.h Tue Sep  6 15:57:50 2016
@@ -12,8 +12,7 @@
 
 #include "SystemInitializer.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 //------------------------------------------------------------------
 /// Initializes common lldb functionality.
 ///
@@ -24,14 +23,13 @@ namespace lldb_private
 /// an instance of SystemLifetimeManager with this class passed to
 /// the constructor.
 //------------------------------------------------------------------
-class SystemInitializerCommon : public SystemInitializer
-{
-  public:
-    SystemInitializerCommon();
-    ~SystemInitializerCommon() override;
+class SystemInitializerCommon : public SystemInitializer {
+public:
+  SystemInitializerCommon();
+  ~SystemInitializerCommon() override;
 
-    void Initialize() override;
-    void Terminate() override;
+  void Initialize() override;
+  void Terminate() override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Initialization/SystemLifetimeManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Initialization/SystemLifetimeManager.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Initialization/SystemLifetimeManager.h (original)
+++ lldb/trunk/include/lldb/Initialization/SystemLifetimeManager.h Tue Sep  6 15:57:50 2016
@@ -15,28 +15,26 @@
 #include <memory>
 #include <mutex>
 
-namespace lldb_private
-{
+namespace lldb_private {
 class SystemInitializer;
 
-class SystemLifetimeManager
-{
-  public:
-    SystemLifetimeManager();
-    ~SystemLifetimeManager();
-
-    void Initialize(std::unique_ptr<SystemInitializer> initializer, LoadPluginCallbackType plugin_callback);
-    void Terminate();
-
-  private:
-      std::recursive_mutex m_mutex;
-      std::unique_ptr<SystemInitializer> m_initializer;
-      bool m_initialized;
-
-      // Noncopyable.
-      SystemLifetimeManager(const SystemLifetimeManager &other) = delete;
-      SystemLifetimeManager &
-      operator=(const SystemLifetimeManager &other) = delete;
+class SystemLifetimeManager {
+public:
+  SystemLifetimeManager();
+  ~SystemLifetimeManager();
+
+  void Initialize(std::unique_ptr<SystemInitializer> initializer,
+                  LoadPluginCallbackType plugin_callback);
+  void Terminate();
+
+private:
+  std::recursive_mutex m_mutex;
+  std::unique_ptr<SystemInitializer> m_initializer;
+  bool m_initialized;
+
+  // Noncopyable.
+  SystemLifetimeManager(const SystemLifetimeManager &other) = delete;
+  SystemLifetimeManager &operator=(const SystemLifetimeManager &other) = delete;
 };
 }
 

Modified: lldb/trunk/include/lldb/Interpreter/Args.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Args.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Args.h Tue Sep  6 15:57:50 2016
@@ -14,16 +14,16 @@
 // C++ Includes
 #include <list>
 #include <string>
-#include <vector>
 #include <utility>
+#include <vector>
 
 // Other libraries and framework includes
 #include "llvm/ADT/StringRef.h"
 // Project includes
-#include "lldb/lldb-private-types.h"
-#include "lldb/lldb-types.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Host/OptionParser.h"
+#include "lldb/lldb-private-types.h"
+#include "lldb/lldb-types.h"
 
 namespace lldb_private {
 
@@ -32,24 +32,15 @@ typedef std::pair<std::string, OptionArg
 typedef std::vector<OptionArgPair> OptionArgVector;
 typedef std::shared_ptr<OptionArgVector> OptionArgVectorSP;
 
-struct OptionArgElement
-{
-    enum {
-        eUnrecognizedArg = -1,
-        eBareDash = -2,
-        eBareDoubleDash = -3
-    };
-    
-    OptionArgElement (int defs_index, int pos, int arg_pos) :
-        opt_defs_index(defs_index),
-        opt_pos (pos),
-        opt_arg_pos (arg_pos)
-    {
-    }
-
-    int opt_defs_index;
-    int opt_pos;
-    int opt_arg_pos;
+struct OptionArgElement {
+  enum { eUnrecognizedArg = -1, eBareDash = -2, eBareDoubleDash = -3 };
+
+  OptionArgElement(int defs_index, int pos, int arg_pos)
+      : opt_defs_index(defs_index), opt_pos(pos), opt_arg_pos(arg_pos) {}
+
+  int opt_defs_index;
+  int opt_pos;
+  int opt_arg_pos;
 };
 
 typedef std::vector<OptionArgElement> OptionElementVector;
@@ -65,457 +56,424 @@ typedef std::vector<OptionArgElement> Op
 /// can be escaped using a \ character to avoid having to surround an
 /// argument that contains a space with quotes.
 //----------------------------------------------------------------------
-class Args
-{
+class Args {
 public:
-
-    //------------------------------------------------------------------
-    /// Construct with an option command string.
-    ///
-    /// @param[in] command
-    ///     A NULL terminated command that will be copied and split up
-    ///     into arguments.
-    ///
-    /// @see Args::SetCommandString(llvm::StringRef)
-    //------------------------------------------------------------------
-    Args (llvm::StringRef command = llvm::StringRef());
-
-    Args (const Args &rhs);
-    
-    const Args &
-    operator= (const Args &rhs);
-
-    //------------------------------------------------------------------
-    /// Destructor.
-    //------------------------------------------------------------------
-    ~Args();
-
-    //------------------------------------------------------------------
-    /// Dump all entries to the stream \a s using label \a label_name.
-    ///
-    /// If label_name is nullptr, the dump operation is skipped.
-    ///
-    /// @param[in] s
-    ///     The stream to which to dump all arguments in the argument
-    ///     vector.
-    /// @param[in] label_name
-    ///     The label_name to use as the label printed for each
-    ///     entry of the args like so:
-    ///       {label_name}[{index}]={value}
-    //------------------------------------------------------------------
-    void
-    Dump (Stream &s, const char *label_name = "argv") const;
-
-    //------------------------------------------------------------------
-    /// Sets the command string contained by this object.
-    ///
-    /// The command string will be copied and split up into arguments
-    /// that can be accessed via the accessor functions.
-    ///
-    /// @param[in] command
-    ///     A command StringRef that will be copied and split up
-    ///     into arguments.
-    ///
-    /// @see Args::GetArgumentCount() const
-    /// @see Args::GetArgumentAtIndex (size_t) const
-    /// @see Args::GetArgumentVector ()
-    /// @see Args::Shift ()
-    /// @see Args::Unshift (const char *)
-    //------------------------------------------------------------------
-    void
-    SetCommandString (llvm::StringRef command);
-
-    bool
-    GetCommandString (std::string &command) const;
-
-    bool
-    GetQuotedCommandString (std::string &command) const;
-
-    //------------------------------------------------------------------
-    /// Gets the number of arguments left in this command object.
-    ///
-    /// @return
-    ///     The number or arguments in this object.
-    //------------------------------------------------------------------
-    size_t
-    GetArgumentCount () const;
-
-    //------------------------------------------------------------------
-    /// Gets the NULL terminated C string argument pointer for the
-    /// argument at index \a idx.
-    ///
-    /// @return
-    ///     The NULL terminated C string argument pointer if \a idx is a
-    ///     valid argument index, NULL otherwise.
-    //------------------------------------------------------------------
-    const char *
-    GetArgumentAtIndex (size_t idx) const;
-
-    char
-    GetArgumentQuoteCharAtIndex (size_t idx) const;
-
-    //------------------------------------------------------------------
-    /// Gets the argument vector.
-    ///
-    /// The value returned by this function can be used by any function
-    /// that takes and vector. The return value is just like \a argv
-    /// in the standard C entry point function:
-    ///     \code
-    ///         int main (int argc, const char **argv);
-    ///     \endcode
-    ///
-    /// @return
-    ///     An array of NULL terminated C string argument pointers that
-    ///     also has a terminating NULL C string pointer
-    //------------------------------------------------------------------
-    char **
-    GetArgumentVector ();
-
-    //------------------------------------------------------------------
-    /// Gets the argument vector.
-    ///
-    /// The value returned by this function can be used by any function
-    /// that takes and vector. The return value is just like \a argv
-    /// in the standard C entry point function:
-    ///     \code
-    ///         int main (int argc, const char **argv);
-    ///     \endcode
-    ///
-    /// @return
-    ///     An array of NULL terminate C string argument pointers that
-    ///     also has a terminating NULL C string pointer
-    //------------------------------------------------------------------
-    const char **
-    GetConstArgumentVector () const;
-
-
-    //------------------------------------------------------------------
-    /// Appends a new argument to the end of the list argument list.
-    ///
-    /// @param[in] arg_cstr
-    ///     The new argument as a NULL terminated C string.
-    ///
-    /// @param[in] quote_char
-    ///     If the argument was originally quoted, put in the quote char here.
-    ///
-    /// @return
-    ///     The NULL terminated C string of the copy of \a arg_cstr.
-    //------------------------------------------------------------------
-    const char *
-    AppendArgument (const char *arg_cstr, char quote_char = '\0');
-
-    void
-    AppendArguments (const Args &rhs);
-    
-    void
-    AppendArguments (const char **argv);
-
-    //------------------------------------------------------------------
-    /// Insert the argument value at index \a idx to \a arg_cstr.
-    ///
-    /// @param[in] idx
-    ///     The index of where to insert the argument.
-    ///
-    /// @param[in] arg_cstr
-    ///     The new argument as a NULL terminated C string.
-    ///
-    /// @param[in] quote_char
-    ///     If the argument was originally quoted, put in the quote char here.
-    ///
-    /// @return
-    ///     The NULL terminated C string of the copy of \a arg_cstr.
-    //------------------------------------------------------------------
-    const char *
-    InsertArgumentAtIndex (size_t idx, const char *arg_cstr, char quote_char = '\0');
-
-    //------------------------------------------------------------------
-    /// Replaces the argument value at index \a idx to \a arg_cstr
-    /// if \a idx is a valid argument index.
-    ///
-    /// @param[in] idx
-    ///     The index of the argument that will have its value replaced.
-    ///
-    /// @param[in] arg_cstr
-    ///     The new argument as a NULL terminated C string.
-    ///
-    /// @param[in] quote_char
-    ///     If the argument was originally quoted, put in the quote char here.
-    ///
-    /// @return
-    ///     The NULL terminated C string of the copy of \a arg_cstr if
-    ///     \a idx was a valid index, NULL otherwise.
-    //------------------------------------------------------------------
-    const char *
-    ReplaceArgumentAtIndex (size_t idx, const char *arg_cstr, char quote_char = '\0');
-
-    //------------------------------------------------------------------
-    /// Deletes the argument value at index
-    /// if \a idx is a valid argument index.
-    ///
-    /// @param[in] idx
-    ///     The index of the argument that will have its value replaced.
-    ///
-    //------------------------------------------------------------------
-    void
-    DeleteArgumentAtIndex (size_t idx);
-
-    //------------------------------------------------------------------
-    /// Sets the argument vector value, optionally copying all
-    /// arguments into an internal buffer.
-    ///
-    /// Sets the arguments to match those found in \a argv. All argument
-    /// strings will be copied into an internal buffers.
-    //
-    //  FIXME: Handle the quote character somehow.
-    //------------------------------------------------------------------
-    void
-    SetArguments (size_t argc, const char **argv);
-
-    void
-    SetArguments (const char **argv);
-
-    //------------------------------------------------------------------
-    /// Shifts the first argument C string value of the array off the
-    /// argument array.
-    ///
-    /// The string value will be freed, so a copy of the string should
-    /// be made by calling Args::GetArgumentAtIndex (size_t) const
-    /// first and copying the returned value before calling
-    /// Args::Shift().
-    ///
-    /// @see Args::GetArgumentAtIndex (size_t) const
-    //------------------------------------------------------------------
-    void
-    Shift ();
-
-    //------------------------------------------------------------------
-    /// Inserts a class owned copy of \a arg_cstr at the beginning of
-    /// the argument vector.
-    ///
-    /// A copy \a arg_cstr will be made.
-    ///
-    /// @param[in] arg_cstr
-    ///     The argument to push on the front of the argument stack.
-    ///
-    /// @param[in] quote_char
-    ///     If the argument was originally quoted, put in the quote char here.
-    ///
-    /// @return
-    ///     A pointer to the copy of \a arg_cstr that was made.
-    //------------------------------------------------------------------
-    const char *
-    Unshift (const char *arg_cstr, char quote_char = '\0');
-
-    //------------------------------------------------------------------
-    /// Parse the arguments in the contained arguments.
-    ///
-    /// The arguments that are consumed by the argument parsing process
-    /// will be removed from the argument vector. The arguments that
-    /// get processed start at the second argument. The first argument
-    /// is assumed to be the command and will not be touched.
-    ///
-    /// param[in] platform_sp
-    ///   The platform used for option validation.  This is necessary
-    ///   because an empty execution_context is not enough to get us
-    ///   to a reasonable platform.  If the platform isn't given,
-    ///   we'll try to get it from the execution context.  If we can't
-    ///   get it from the execution context, we'll skip validation.
-    ///
-    /// param[in] require_validation
-    ///   When true, it will fail option parsing if validation could
-    ///   not occur due to not having a platform.
-    ///
-    /// @see class Options
-    //------------------------------------------------------------------
-    Error
-    ParseOptions (Options &options, ExecutionContext *execution_context,
-                  lldb::PlatformSP platform_sp, bool require_validation);
-    
-    size_t
-    FindArgumentIndexForOption (Option *long_options, int long_options_index);
-    
-    bool
-    IsPositionalArgument (const char *arg);
-
-    // The following works almost identically to ParseOptions, except that no option is required to have arguments,
-    // and it builds up the option_arg_vector as it parses the options.
-
-    void
-    ParseAliasOptions (Options &options, CommandReturnObject &result, OptionArgVector *option_arg_vector, 
-                       std::string &raw_input_line);
-
-    void
-    ParseArgsForCompletion (Options &options, OptionElementVector &option_element_vector, uint32_t cursor_index);
-
-    //------------------------------------------------------------------
-    // Clear the arguments.
-    //
-    // For re-setting or blanking out the list of arguments.
-    //------------------------------------------------------------------
-    void
-    Clear ();
-
-    static const char *
-    StripSpaces (std::string &s,
-                 bool leading = true,
-                 bool trailing = true,
-                 bool return_null_if_empty = true);
-
-    static bool
-    UInt64ValueIsValidForByteSize (uint64_t uval64, size_t total_byte_size)
-    {
-        if (total_byte_size > 8)
-            return false;
-        
-        if (total_byte_size == 8)
-            return true;
-        
-        const uint64_t max = ((uint64_t)1 << (uint64_t)(total_byte_size * 8)) - 1;
-        return uval64 <= max;
-    }
-
-    static bool
-    SInt64ValueIsValidForByteSize (int64_t sval64, size_t total_byte_size)
-    {
-        if (total_byte_size > 8)
-            return false;
-        
-        if (total_byte_size == 8)
-            return true;
-        
-        const int64_t max = ((int64_t)1 << (uint64_t)(total_byte_size * 8 - 1)) - 1;
-        const int64_t min = ~(max);
-        return min <= sval64 && sval64 <= max;
-    }
-
-    static lldb::addr_t
-    StringToAddress (const ExecutionContext *exe_ctx,
-                     const char *s,
-                     lldb::addr_t fail_value,
-                     Error *error);
-
-    static bool
-    StringToBoolean (const char *s, bool fail_value, bool *success_ptr);
-
-    static bool
-    StringToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr);
-
-    static char StringToChar(const char *s, char fail_value, bool *success_ptr);
-
-    static int64_t
-    StringToOptionEnum (const char *s, OptionEnumValueElement *enum_values, int32_t fail_value, Error &error);
-
-    static lldb::ScriptLanguage
-    StringToScriptLanguage (const char *s, lldb::ScriptLanguage fail_value, bool *success_ptr);
-
-    // TODO: Use StringRef
-    static Error
-    StringToFormat (const char *s,
-                    lldb::Format &format,
-                    size_t *byte_size_ptr); // If non-NULL, then a byte size can precede the format character
-
-    static lldb::Encoding
-    StringToEncoding (const char *s,
-                      lldb::Encoding fail_value = lldb::eEncodingInvalid);
-
-    static lldb::Encoding
-    StringToEncoding(llvm::StringRef s, lldb::Encoding fail_value = lldb::eEncodingInvalid);
-
-    static uint32_t
-    StringToGenericRegister (const char *s);
-
-    static uint32_t
-    StringToGenericRegister(llvm::StringRef s);
-
-    // TODO: Update to take a StringRef
-    static const char *
-    StringToVersion (const char *s, uint32_t &major, uint32_t &minor, uint32_t &update);
-
-    static const char *
-    GetShellSafeArgument (const FileSpec& shell, const char *unsafe_arg, std::string &safe_arg);
-
-    // EncodeEscapeSequences will change the textual representation of common
-    // escape sequences like "\n" (two characters) into a single '\n'. It does
-    // this for all of the supported escaped sequences and for the \0ooo (octal)
-    // and \xXX (hex). The resulting "dst" string will contain the character
-    // versions of all supported escape sequences. The common supported escape
-    // sequences are: "\a", "\b", "\f", "\n", "\r", "\t", "\v", "\'", "\"", "\\".
-
-    static void
-    EncodeEscapeSequences (const char *src, std::string &dst);
-
-    // ExpandEscapeSequences will change a string of possibly non-printable
-    // characters and expand them into text. So '\n' will turn into two characters
-    // like "\n" which is suitable for human reading. When a character is not
-    // printable and isn't one of the common in escape sequences listed in the
-    // help for EncodeEscapeSequences, then it will be encoded as octal. Printable
-    // characters are left alone.
-    static void
-    ExpandEscapedCharacters (const char *src, std::string &dst);
-
-    static std::string
-    EscapeLLDBCommandArgument (const std::string& arg, char quote_char);
-
-    // This one isn't really relevant to Arguments per se, but we're using the Args as a
-    // general strings container, so...
-    void
-    LongestCommonPrefix (std::string &common_prefix);
-
-    //------------------------------------------------------------------
-    /// Add or replace an environment variable with the given value.
-    ///
-    /// This command adds the environment variable if it is not already
-    /// present using the given value.  If the environment variable is
-    /// already in the list, it replaces the first such occurrence
-    /// with the new value.
-    //------------------------------------------------------------------
-    void
-    AddOrReplaceEnvironmentVariable(const char *env_var_name,
-                                    const char *new_value);
-
-    /// Return whether a given environment variable exists.
-    ///
-    /// This command treats Args like a list of environment variables,
-    /// as used in ProcessLaunchInfo.  It treats each argument as
-    /// an {env_var_name}={value} or an {env_var_name} entry.
-    ///
-    /// @param[in] env_var_name
-    ///     Specifies the name of the environment variable to check.
-    ///
-    /// @param[out] argument_index
-    ///     If non-null, then when the environment variable is found,
-    ///     the index of the argument position will be returned in
-    ///     the size_t pointed to by this argument.
-    ///
-    /// @return
-    ///     true if the specified env var name exists in the list in
-    ///     either of the above-mentioned formats; otherwise, false.
-    //------------------------------------------------------------------
-    bool
-    ContainsEnvironmentVariable(const char *env_var_name,
-                                size_t *argument_index = nullptr) const;
+  //------------------------------------------------------------------
+  /// Construct with an option command string.
+  ///
+  /// @param[in] command
+  ///     A NULL terminated command that will be copied and split up
+  ///     into arguments.
+  ///
+  /// @see Args::SetCommandString(llvm::StringRef)
+  //------------------------------------------------------------------
+  Args(llvm::StringRef command = llvm::StringRef());
+
+  Args(const Args &rhs);
+
+  const Args &operator=(const Args &rhs);
+
+  //------------------------------------------------------------------
+  /// Destructor.
+  //------------------------------------------------------------------
+  ~Args();
+
+  //------------------------------------------------------------------
+  /// Dump all entries to the stream \a s using label \a label_name.
+  ///
+  /// If label_name is nullptr, the dump operation is skipped.
+  ///
+  /// @param[in] s
+  ///     The stream to which to dump all arguments in the argument
+  ///     vector.
+  /// @param[in] label_name
+  ///     The label_name to use as the label printed for each
+  ///     entry of the args like so:
+  ///       {label_name}[{index}]={value}
+  //------------------------------------------------------------------
+  void Dump(Stream &s, const char *label_name = "argv") const;
+
+  //------------------------------------------------------------------
+  /// Sets the command string contained by this object.
+  ///
+  /// The command string will be copied and split up into arguments
+  /// that can be accessed via the accessor functions.
+  ///
+  /// @param[in] command
+  ///     A command StringRef that will be copied and split up
+  ///     into arguments.
+  ///
+  /// @see Args::GetArgumentCount() const
+  /// @see Args::GetArgumentAtIndex (size_t) const
+  /// @see Args::GetArgumentVector ()
+  /// @see Args::Shift ()
+  /// @see Args::Unshift (const char *)
+  //------------------------------------------------------------------
+  void SetCommandString(llvm::StringRef command);
+
+  bool GetCommandString(std::string &command) const;
+
+  bool GetQuotedCommandString(std::string &command) const;
+
+  //------------------------------------------------------------------
+  /// Gets the number of arguments left in this command object.
+  ///
+  /// @return
+  ///     The number or arguments in this object.
+  //------------------------------------------------------------------
+  size_t GetArgumentCount() const;
+
+  //------------------------------------------------------------------
+  /// Gets the NULL terminated C string argument pointer for the
+  /// argument at index \a idx.
+  ///
+  /// @return
+  ///     The NULL terminated C string argument pointer if \a idx is a
+  ///     valid argument index, NULL otherwise.
+  //------------------------------------------------------------------
+  const char *GetArgumentAtIndex(size_t idx) const;
+
+  char GetArgumentQuoteCharAtIndex(size_t idx) const;
+
+  //------------------------------------------------------------------
+  /// Gets the argument vector.
+  ///
+  /// The value returned by this function can be used by any function
+  /// that takes and vector. The return value is just like \a argv
+  /// in the standard C entry point function:
+  ///     \code
+  ///         int main (int argc, const char **argv);
+  ///     \endcode
+  ///
+  /// @return
+  ///     An array of NULL terminated C string argument pointers that
+  ///     also has a terminating NULL C string pointer
+  //------------------------------------------------------------------
+  char **GetArgumentVector();
+
+  //------------------------------------------------------------------
+  /// Gets the argument vector.
+  ///
+  /// The value returned by this function can be used by any function
+  /// that takes and vector. The return value is just like \a argv
+  /// in the standard C entry point function:
+  ///     \code
+  ///         int main (int argc, const char **argv);
+  ///     \endcode
+  ///
+  /// @return
+  ///     An array of NULL terminate C string argument pointers that
+  ///     also has a terminating NULL C string pointer
+  //------------------------------------------------------------------
+  const char **GetConstArgumentVector() const;
+
+  //------------------------------------------------------------------
+  /// Appends a new argument to the end of the list argument list.
+  ///
+  /// @param[in] arg_cstr
+  ///     The new argument as a NULL terminated C string.
+  ///
+  /// @param[in] quote_char
+  ///     If the argument was originally quoted, put in the quote char here.
+  ///
+  /// @return
+  ///     The NULL terminated C string of the copy of \a arg_cstr.
+  //------------------------------------------------------------------
+  const char *AppendArgument(const char *arg_cstr, char quote_char = '\0');
+
+  void AppendArguments(const Args &rhs);
+
+  void AppendArguments(const char **argv);
+
+  //------------------------------------------------------------------
+  /// Insert the argument value at index \a idx to \a arg_cstr.
+  ///
+  /// @param[in] idx
+  ///     The index of where to insert the argument.
+  ///
+  /// @param[in] arg_cstr
+  ///     The new argument as a NULL terminated C string.
+  ///
+  /// @param[in] quote_char
+  ///     If the argument was originally quoted, put in the quote char here.
+  ///
+  /// @return
+  ///     The NULL terminated C string of the copy of \a arg_cstr.
+  //------------------------------------------------------------------
+  const char *InsertArgumentAtIndex(size_t idx, const char *arg_cstr,
+                                    char quote_char = '\0');
+
+  //------------------------------------------------------------------
+  /// Replaces the argument value at index \a idx to \a arg_cstr
+  /// if \a idx is a valid argument index.
+  ///
+  /// @param[in] idx
+  ///     The index of the argument that will have its value replaced.
+  ///
+  /// @param[in] arg_cstr
+  ///     The new argument as a NULL terminated C string.
+  ///
+  /// @param[in] quote_char
+  ///     If the argument was originally quoted, put in the quote char here.
+  ///
+  /// @return
+  ///     The NULL terminated C string of the copy of \a arg_cstr if
+  ///     \a idx was a valid index, NULL otherwise.
+  //------------------------------------------------------------------
+  const char *ReplaceArgumentAtIndex(size_t idx, const char *arg_cstr,
+                                     char quote_char = '\0');
+
+  //------------------------------------------------------------------
+  /// Deletes the argument value at index
+  /// if \a idx is a valid argument index.
+  ///
+  /// @param[in] idx
+  ///     The index of the argument that will have its value replaced.
+  ///
+  //------------------------------------------------------------------
+  void DeleteArgumentAtIndex(size_t idx);
+
+  //------------------------------------------------------------------
+  /// Sets the argument vector value, optionally copying all
+  /// arguments into an internal buffer.
+  ///
+  /// Sets the arguments to match those found in \a argv. All argument
+  /// strings will be copied into an internal buffers.
+  //
+  //  FIXME: Handle the quote character somehow.
+  //------------------------------------------------------------------
+  void SetArguments(size_t argc, const char **argv);
+
+  void SetArguments(const char **argv);
+
+  //------------------------------------------------------------------
+  /// Shifts the first argument C string value of the array off the
+  /// argument array.
+  ///
+  /// The string value will be freed, so a copy of the string should
+  /// be made by calling Args::GetArgumentAtIndex (size_t) const
+  /// first and copying the returned value before calling
+  /// Args::Shift().
+  ///
+  /// @see Args::GetArgumentAtIndex (size_t) const
+  //------------------------------------------------------------------
+  void Shift();
+
+  //------------------------------------------------------------------
+  /// Inserts a class owned copy of \a arg_cstr at the beginning of
+  /// the argument vector.
+  ///
+  /// A copy \a arg_cstr will be made.
+  ///
+  /// @param[in] arg_cstr
+  ///     The argument to push on the front of the argument stack.
+  ///
+  /// @param[in] quote_char
+  ///     If the argument was originally quoted, put in the quote char here.
+  ///
+  /// @return
+  ///     A pointer to the copy of \a arg_cstr that was made.
+  //------------------------------------------------------------------
+  const char *Unshift(const char *arg_cstr, char quote_char = '\0');
+
+  //------------------------------------------------------------------
+  /// Parse the arguments in the contained arguments.
+  ///
+  /// The arguments that are consumed by the argument parsing process
+  /// will be removed from the argument vector. The arguments that
+  /// get processed start at the second argument. The first argument
+  /// is assumed to be the command and will not be touched.
+  ///
+  /// param[in] platform_sp
+  ///   The platform used for option validation.  This is necessary
+  ///   because an empty execution_context is not enough to get us
+  ///   to a reasonable platform.  If the platform isn't given,
+  ///   we'll try to get it from the execution context.  If we can't
+  ///   get it from the execution context, we'll skip validation.
+  ///
+  /// param[in] require_validation
+  ///   When true, it will fail option parsing if validation could
+  ///   not occur due to not having a platform.
+  ///
+  /// @see class Options
+  //------------------------------------------------------------------
+  Error ParseOptions(Options &options, ExecutionContext *execution_context,
+                     lldb::PlatformSP platform_sp, bool require_validation);
+
+  size_t FindArgumentIndexForOption(Option *long_options,
+                                    int long_options_index);
+
+  bool IsPositionalArgument(const char *arg);
+
+  // The following works almost identically to ParseOptions, except that no
+  // option is required to have arguments,
+  // and it builds up the option_arg_vector as it parses the options.
+
+  void ParseAliasOptions(Options &options, CommandReturnObject &result,
+                         OptionArgVector *option_arg_vector,
+                         std::string &raw_input_line);
+
+  void ParseArgsForCompletion(Options &options,
+                              OptionElementVector &option_element_vector,
+                              uint32_t cursor_index);
+
+  //------------------------------------------------------------------
+  // Clear the arguments.
+  //
+  // For re-setting or blanking out the list of arguments.
+  //------------------------------------------------------------------
+  void Clear();
+
+  static const char *StripSpaces(std::string &s, bool leading = true,
+                                 bool trailing = true,
+                                 bool return_null_if_empty = true);
+
+  static bool UInt64ValueIsValidForByteSize(uint64_t uval64,
+                                            size_t total_byte_size) {
+    if (total_byte_size > 8)
+      return false;
+
+    if (total_byte_size == 8)
+      return true;
+
+    const uint64_t max = ((uint64_t)1 << (uint64_t)(total_byte_size * 8)) - 1;
+    return uval64 <= max;
+  }
+
+  static bool SInt64ValueIsValidForByteSize(int64_t sval64,
+                                            size_t total_byte_size) {
+    if (total_byte_size > 8)
+      return false;
+
+    if (total_byte_size == 8)
+      return true;
+
+    const int64_t max = ((int64_t)1 << (uint64_t)(total_byte_size * 8 - 1)) - 1;
+    const int64_t min = ~(max);
+    return min <= sval64 && sval64 <= max;
+  }
+
+  static lldb::addr_t StringToAddress(const ExecutionContext *exe_ctx,
+                                      const char *s, lldb::addr_t fail_value,
+                                      Error *error);
+
+  static bool StringToBoolean(const char *s, bool fail_value,
+                              bool *success_ptr);
+
+  static bool StringToBoolean(llvm::StringRef s, bool fail_value,
+                              bool *success_ptr);
+
+  static char StringToChar(const char *s, char fail_value, bool *success_ptr);
+
+  static int64_t StringToOptionEnum(const char *s,
+                                    OptionEnumValueElement *enum_values,
+                                    int32_t fail_value, Error &error);
+
+  static lldb::ScriptLanguage
+  StringToScriptLanguage(const char *s, lldb::ScriptLanguage fail_value,
+                         bool *success_ptr);
+
+  // TODO: Use StringRef
+  static Error StringToFormat(const char *s, lldb::Format &format,
+                              size_t *byte_size_ptr); // If non-NULL, then a
+                                                      // byte size can precede
+                                                      // the format character
+
+  static lldb::Encoding
+  StringToEncoding(const char *s,
+                   lldb::Encoding fail_value = lldb::eEncodingInvalid);
+
+  static lldb::Encoding
+  StringToEncoding(llvm::StringRef s,
+                   lldb::Encoding fail_value = lldb::eEncodingInvalid);
+
+  static uint32_t StringToGenericRegister(const char *s);
+
+  static uint32_t StringToGenericRegister(llvm::StringRef s);
+
+  // TODO: Update to take a StringRef
+  static const char *StringToVersion(const char *s, uint32_t &major,
+                                     uint32_t &minor, uint32_t &update);
+
+  static const char *GetShellSafeArgument(const FileSpec &shell,
+                                          const char *unsafe_arg,
+                                          std::string &safe_arg);
+
+  // EncodeEscapeSequences will change the textual representation of common
+  // escape sequences like "\n" (two characters) into a single '\n'. It does
+  // this for all of the supported escaped sequences and for the \0ooo (octal)
+  // and \xXX (hex). The resulting "dst" string will contain the character
+  // versions of all supported escape sequences. The common supported escape
+  // sequences are: "\a", "\b", "\f", "\n", "\r", "\t", "\v", "\'", "\"", "\\".
+
+  static void EncodeEscapeSequences(const char *src, std::string &dst);
+
+  // ExpandEscapeSequences will change a string of possibly non-printable
+  // characters and expand them into text. So '\n' will turn into two characters
+  // like "\n" which is suitable for human reading. When a character is not
+  // printable and isn't one of the common in escape sequences listed in the
+  // help for EncodeEscapeSequences, then it will be encoded as octal. Printable
+  // characters are left alone.
+  static void ExpandEscapedCharacters(const char *src, std::string &dst);
+
+  static std::string EscapeLLDBCommandArgument(const std::string &arg,
+                                               char quote_char);
+
+  // This one isn't really relevant to Arguments per se, but we're using the
+  // Args as a
+  // general strings container, so...
+  void LongestCommonPrefix(std::string &common_prefix);
+
+  //------------------------------------------------------------------
+  /// Add or replace an environment variable with the given value.
+  ///
+  /// This command adds the environment variable if it is not already
+  /// present using the given value.  If the environment variable is
+  /// already in the list, it replaces the first such occurrence
+  /// with the new value.
+  //------------------------------------------------------------------
+  void AddOrReplaceEnvironmentVariable(const char *env_var_name,
+                                       const char *new_value);
+
+  /// Return whether a given environment variable exists.
+  ///
+  /// This command treats Args like a list of environment variables,
+  /// as used in ProcessLaunchInfo.  It treats each argument as
+  /// an {env_var_name}={value} or an {env_var_name} entry.
+  ///
+  /// @param[in] env_var_name
+  ///     Specifies the name of the environment variable to check.
+  ///
+  /// @param[out] argument_index
+  ///     If non-null, then when the environment variable is found,
+  ///     the index of the argument position will be returned in
+  ///     the size_t pointed to by this argument.
+  ///
+  /// @return
+  ///     true if the specified env var name exists in the list in
+  ///     either of the above-mentioned formats; otherwise, false.
+  //------------------------------------------------------------------
+  bool ContainsEnvironmentVariable(const char *env_var_name,
+                                   size_t *argument_index = nullptr) const;
 
 protected:
-    //------------------------------------------------------------------
-    // Classes that inherit from Args can see and modify these
-    //------------------------------------------------------------------
-    typedef std::list<std::string> arg_sstr_collection;
-    typedef std::vector<const char *> arg_cstr_collection;
-    typedef std::vector<char> arg_quote_char_collection;
-    arg_sstr_collection m_args;
-    arg_cstr_collection m_argv; ///< The current argument vector.
-    arg_quote_char_collection m_args_quote_char;
+  //------------------------------------------------------------------
+  // Classes that inherit from Args can see and modify these
+  //------------------------------------------------------------------
+  typedef std::list<std::string> arg_sstr_collection;
+  typedef std::vector<const char *> arg_cstr_collection;
+  typedef std::vector<char> arg_quote_char_collection;
+  arg_sstr_collection m_args;
+  arg_cstr_collection m_argv; ///< The current argument vector.
+  arg_quote_char_collection m_args_quote_char;
 
-    void
-    UpdateArgsAfterOptionParsing ();
+  void UpdateArgsAfterOptionParsing();
 
-    void
-    UpdateArgvFromArgs ();
+  void UpdateArgvFromArgs();
 
-    llvm::StringRef
-    ParseSingleArgument (llvm::StringRef command);
+  llvm::StringRef ParseSingleArgument(llvm::StringRef command);
 };
 
 } // namespace lldb_private
 
-#endif  // liblldb_Command_h_
+#endif // liblldb_Command_h_

Modified: lldb/trunk/include/lldb/Interpreter/CommandAlias.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandAlias.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandAlias.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandAlias.h Tue Sep  6 15:57:50 2016
@@ -16,107 +16,78 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-forward.h"
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandObject.h"
+#include "lldb/lldb-forward.h"
 
 namespace lldb_private {
-class CommandAlias : public CommandObject
-{
+class CommandAlias : public CommandObject {
 public:
-    typedef std::unique_ptr<CommandAlias> UniquePointer;
+  typedef std::unique_ptr<CommandAlias> UniquePointer;
+
+  CommandAlias(CommandInterpreter &interpreter, lldb::CommandObjectSP cmd_sp,
+               const char *options_args, const char *name,
+               const char *help = nullptr, const char *syntax = nullptr,
+               uint32_t flags = 0);
+
+  void GetAliasExpansion(StreamString &help_string);
+
+  bool IsValid() { return m_underlying_command_sp && m_option_args_sp; }
+
+  explicit operator bool() { return IsValid(); }
+
+  bool WantsRawCommandString() override;
+
+  bool WantsCompletion() override;
+
+  int HandleCompletion(Args &input, int &cursor_index,
+                       int &cursor_char_position, int match_start_point,
+                       int max_return_elements, bool &word_complete,
+                       StringList &matches) override;
+
+  int HandleArgumentCompletion(Args &input, int &cursor_index,
+                               int &cursor_char_position,
+                               OptionElementVector &opt_element_vector,
+                               int match_start_point, int max_return_elements,
+                               bool &word_complete,
+                               StringList &matches) override;
+
+  Options *GetOptions() override;
+
+  bool IsAlias() override { return true; }
+
+  bool IsDashDashCommand() override;
+
+  const char *GetHelp() override;
+
+  const char *GetHelpLong() override;
+
+  void SetHelp(const char *str) override;
+
+  void SetHelpLong(const char *str) override;
+
+  bool Execute(const char *args_string, CommandReturnObject &result) override;
+
+  lldb::CommandObjectSP GetUnderlyingCommand() {
+    return m_underlying_command_sp;
+  }
+  OptionArgVectorSP GetOptionArguments() { return m_option_args_sp; }
+  const char *GetOptionString() { return m_option_string.c_str(); }
+
+  // this takes an alias - potentially nested (i.e. an alias to an alias)
+  // and expands it all the way to a non-alias command
+  std::pair<lldb::CommandObjectSP, OptionArgVectorSP> Desugar();
 
-    CommandAlias (CommandInterpreter &interpreter,
-                  lldb::CommandObjectSP cmd_sp,
-                  const char *options_args,
-                  const char *name,
-                  const char *help = nullptr,
-                  const char *syntax = nullptr,
-                  uint32_t flags = 0);
-    
-    void
-    GetAliasExpansion (StreamString &help_string);
-    
-    bool
-    IsValid ()
-    {
-        return m_underlying_command_sp && m_option_args_sp;
-    }
-    
-    explicit operator bool ()
-    {
-        return IsValid();
-    }
-    
-    bool
-    WantsRawCommandString() override;
-    
-    bool
-    WantsCompletion() override;
-    
-    int
-    HandleCompletion (Args &input,
-                      int &cursor_index,
-                      int &cursor_char_position,
-                      int match_start_point,
-                      int max_return_elements,
-                      bool &word_complete,
-                      StringList &matches) override;
-    
-    int
-    HandleArgumentCompletion (Args &input,
-                              int &cursor_index,
-                              int &cursor_char_position,
-                              OptionElementVector &opt_element_vector,
-                              int match_start_point,
-                              int max_return_elements,
-                              bool &word_complete,
-                              StringList &matches) override;
-    
-    Options*
-    GetOptions() override;
-    
-    bool
-    IsAlias () override { return true; }
-    
-    bool
-    IsDashDashCommand () override;
-    
-    const char*
-    GetHelp () override;
-    
-    const char*
-    GetHelpLong () override;
-    
-    void
-    SetHelp (const char * str) override;
-    
-    void
-    SetHelpLong (const char * str) override;
-    
-    bool
-    Execute(const char *args_string, CommandReturnObject &result) override;
-    
-    lldb::CommandObjectSP GetUnderlyingCommand() { return m_underlying_command_sp; }
-    OptionArgVectorSP GetOptionArguments() { return m_option_args_sp; }
-    const char* GetOptionString() { return m_option_string.c_str(); }
-    
-    // this takes an alias - potentially nested (i.e. an alias to an alias)
-    // and expands it all the way to a non-alias command
-    std::pair<lldb::CommandObjectSP, OptionArgVectorSP>
-    Desugar ();
-    
 protected:
-    bool
-    IsNestedAlias ();
-    
+  bool IsNestedAlias();
+
 private:
-    lldb::CommandObjectSP m_underlying_command_sp;
-    std::string m_option_string;
-    OptionArgVectorSP m_option_args_sp ;
-    LazyBool m_is_dashdash_alias;
-    bool m_did_set_help : 1;
-    bool m_did_set_help_long : 1;
+  lldb::CommandObjectSP m_underlying_command_sp;
+  std::string m_option_string;
+  OptionArgVectorSP m_option_args_sp;
+  LazyBool m_is_dashdash_alias;
+  bool m_did_set_help : 1;
+  bool m_did_set_help_long : 1;
 };
 } // namespace lldb_private
 

Modified: lldb/trunk/include/lldb/Interpreter/CommandCompletions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandCompletions.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandCompletions.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandCompletions.h Tue Sep  6 15:57:50 2016
@@ -16,288 +16,231 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
-#include "lldb/Core/SearchFilter.h"
 #include "lldb/Core/FileSpecList.h"
 #include "lldb/Core/RegularExpression.h"
+#include "lldb/Core/SearchFilter.h"
+#include "lldb/lldb-private.h"
 
-namespace lldb_private
-{
-class CommandCompletions
-{
+namespace lldb_private {
+class CommandCompletions {
 public:
-
-    //----------------------------------------------------------------------
-    // This is the command completion callback that is used to complete the argument of the option
-    // it is bound to (in the OptionDefinition table below).  Return the total number of matches.
-    //----------------------------------------------------------------------
-    typedef int (*CompletionCallback) (CommandInterpreter &interpreter,
-                                       const char *completion_str,          // This is the argument we are completing
-                                       int match_start_point,               // This is the point in the list of matches that you should start returning elements
-                                       int max_return_elements,             // This is the number of matches requested.
-                                       lldb_private::SearchFilter *searcher,// A search filter to limit the search...
-                                       bool &word_complete,
-                                       lldb_private::StringList &matches);  // The array of matches we return.
-    typedef enum
-    {
-        eNoCompletion             = 0u,
-        eSourceFileCompletion     = (1u << 0),
-        eDiskFileCompletion       = (1u << 1),
-        eDiskDirectoryCompletion  = (1u << 2),
-        eSymbolCompletion         = (1u << 3),
-        eModuleCompletion         = (1u << 4),
-        eSettingsNameCompletion   = (1u << 5),
-        ePlatformPluginCompletion = (1u << 6),
-        eArchitectureCompletion   = (1u << 7),
-        eVariablePathCompletion   = (1u << 8),
-        // This item serves two purposes.  It is the last element in the enum,
-        // so you can add custom enums starting from here in your Option class.
-        // Also if you & in this bit the base code will not process the option.
-        eCustomCompletion         = (1u << 9)
-    } CommonCompletionTypes;
-
-    struct CommonCompletionElement
-    {
-        uint32_t type;
-        CompletionCallback callback;
-    };
-
-    static bool InvokeCommonCompletionCallbacks (CommandInterpreter &interpreter,
-                                                 uint32_t completion_mask,
-                                                 const char *completion_str,
-                                                 int match_start_point,
-                                                 int max_return_elements,
-                                                 SearchFilter *searcher,
-                                                 bool &word_complete,
-                                                 StringList &matches);
-    
-    //----------------------------------------------------------------------
-    // These are the generic completer functions:
-    //----------------------------------------------------------------------
-    static int
-    DiskFiles (CommandInterpreter &interpreter,
-               const char *partial_file_name,
-               int match_start_point,
-               int max_return_elements,
-               SearchFilter *searcher,
-               bool &word_complete,
-               StringList &matches);
-
-    static int
-    DiskDirectories (CommandInterpreter &interpreter,
-                     const char *partial_file_name,
-                     int match_start_point,
-                     int max_return_elements,
-                     SearchFilter *searcher,
-                     bool &word_complete,
-                     StringList &matches);
-    
-    static int
-    SourceFiles (CommandInterpreter &interpreter,
-                 const char *partial_file_name,
-                 int match_start_point,
-                 int max_return_elements,
-                 SearchFilter *searcher,
-                 bool &word_complete,
-                 StringList &matches);
-    
-    static int
-    Modules (CommandInterpreter &interpreter,
-             const char *partial_file_name,
-             int match_start_point,
-             int max_return_elements,
-             SearchFilter *searcher,
-             bool &word_complete,
-             lldb_private::StringList &matches);
-    
-    static int
-    Symbols (CommandInterpreter &interpreter,
-             const char *partial_file_name,
-             int match_start_point,
-             int max_return_elements,
-             SearchFilter *searcher,
-             bool &word_complete,
-             lldb_private::StringList &matches);
-    
-    static int
-    SettingsNames (CommandInterpreter &interpreter,
-                   const char *partial_file_name,
-                   int match_start_point,
-                   int max_return_elements,
-                   SearchFilter *searcher,
-                   bool &word_complete,
-                   lldb_private::StringList &matches);
-
-    static int
-    PlatformPluginNames (CommandInterpreter &interpreter,
-                         const char *partial_file_name,
-                         int match_start_point,
-                         int max_return_elements,
-                         SearchFilter *searcher,
-                         bool &word_complete,
-                         lldb_private::StringList &matches);
-
-    
-    static int
-    ArchitectureNames (CommandInterpreter &interpreter,
-                       const char *partial_file_name,
-                       int match_start_point,
-                       int max_return_elements,
-                       SearchFilter *searcher,
-                       bool &word_complete,
-                       lldb_private::StringList &matches);
-
-    static int
-    VariablePath (CommandInterpreter &interpreter,
-                  const char *partial_file_name,
-                  int match_start_point,
-                  int max_return_elements,
-                  SearchFilter *searcher,
-                  bool &word_complete,
-                  lldb_private::StringList &matches);
-
-    //----------------------------------------------------------------------
-    // The Completer class is a convenient base class for building searchers
-    // that go along with the SearchFilter passed to the standard Completer
-    // functions.
-    //----------------------------------------------------------------------
-    class Completer : public Searcher
-    {
-    public:
-        Completer (CommandInterpreter &interpreter,
-                   const char *completion_str,
-                   int match_start_point,
-                   int max_return_elements,
-                   StringList &matches);
-
-        ~Completer() override;
-
-        CallbackReturn
-        SearchCallback(SearchFilter &filter,
-                       SymbolContext &context,
-                       Address *addr,
-                       bool complete) override = 0;
-
-        Depth
-        GetDepth() override = 0;
-
-        virtual size_t
-        DoCompletion (SearchFilter *filter) = 0;
-
-        protected:
-            CommandInterpreter &m_interpreter;
-            std::string m_completion_str;
-            int m_match_start_point;
-            int m_max_return_elements;
-            StringList &m_matches;
-
-        private:
-            DISALLOW_COPY_AND_ASSIGN(Completer);
-    };
-
-    //----------------------------------------------------------------------
-    // SourceFileCompleter implements the source file completer
-    //----------------------------------------------------------------------
-    class SourceFileCompleter : public Completer
-    {
-    public:
-        SourceFileCompleter (CommandInterpreter &interpreter,
-                             bool include_support_files,
-                             const char *completion_str,
-                             int match_start_point,
-                             int max_return_elements,
+  //----------------------------------------------------------------------
+  // This is the command completion callback that is used to complete the
+  // argument of the option
+  // it is bound to (in the OptionDefinition table below).  Return the total
+  // number of matches.
+  //----------------------------------------------------------------------
+  typedef int (*CompletionCallback)(
+      CommandInterpreter &interpreter,
+      const char *completion_str, // This is the argument we are completing
+      int match_start_point,   // This is the point in the list of matches that
+                               // you should start returning elements
+      int max_return_elements, // This is the number of matches requested.
+      lldb_private::SearchFilter
+          *searcher, // A search filter to limit the search...
+      bool &word_complete,
+      lldb_private::StringList &matches); // The array of matches we return.
+  typedef enum {
+    eNoCompletion = 0u,
+    eSourceFileCompletion = (1u << 0),
+    eDiskFileCompletion = (1u << 1),
+    eDiskDirectoryCompletion = (1u << 2),
+    eSymbolCompletion = (1u << 3),
+    eModuleCompletion = (1u << 4),
+    eSettingsNameCompletion = (1u << 5),
+    ePlatformPluginCompletion = (1u << 6),
+    eArchitectureCompletion = (1u << 7),
+    eVariablePathCompletion = (1u << 8),
+    // This item serves two purposes.  It is the last element in the enum,
+    // so you can add custom enums starting from here in your Option class.
+    // Also if you & in this bit the base code will not process the option.
+    eCustomCompletion = (1u << 9)
+  } CommonCompletionTypes;
+
+  struct CommonCompletionElement {
+    uint32_t type;
+    CompletionCallback callback;
+  };
+
+  static bool InvokeCommonCompletionCallbacks(
+      CommandInterpreter &interpreter, uint32_t completion_mask,
+      const char *completion_str, int match_start_point,
+      int max_return_elements, SearchFilter *searcher, bool &word_complete,
+      StringList &matches);
+
+  //----------------------------------------------------------------------
+  // These are the generic completer functions:
+  //----------------------------------------------------------------------
+  static int DiskFiles(CommandInterpreter &interpreter,
+                       const char *partial_file_name, int match_start_point,
+                       int max_return_elements, SearchFilter *searcher,
+                       bool &word_complete, StringList &matches);
+
+  static int DiskDirectories(CommandInterpreter &interpreter,
+                             const char *partial_file_name,
+                             int match_start_point, int max_return_elements,
+                             SearchFilter *searcher, bool &word_complete,
                              StringList &matches);
-        
-        Searcher::Depth GetDepth() override;
 
-        Searcher::CallbackReturn
-        SearchCallback(SearchFilter &filter,
-                       SymbolContext &context,
-                       Address *addr,
-                       bool complete) override;
-
-        size_t
-        DoCompletion(SearchFilter *filter) override;
-
-    private:
-        bool m_include_support_files;
-        FileSpecList m_matching_files;
-        const char *m_file_name;
-        const char *m_dir_name;
-
-        DISALLOW_COPY_AND_ASSIGN(SourceFileCompleter);
-    };
-
-    //----------------------------------------------------------------------
-    // ModuleCompleter implements the module completer
-    //----------------------------------------------------------------------
-    class ModuleCompleter : public Completer
-    {
-    public:
-        ModuleCompleter (CommandInterpreter &interpreter,
-                         const char *completion_str,
-                         int match_start_point,
-                         int max_return_elements,
-                         StringList &matches);
-        
-        Searcher::Depth GetDepth() override;
-
-        Searcher::CallbackReturn
-        SearchCallback(SearchFilter &filter,
-                       SymbolContext &context,
-                       Address *addr,
-                       bool complete) override;
-
-        size_t
-        DoCompletion(SearchFilter *filter) override;
-
-    private:
-        const char *m_file_name;
-        const char *m_dir_name;
-
-        DISALLOW_COPY_AND_ASSIGN(ModuleCompleter);
-    };
-
-    //----------------------------------------------------------------------
-    // SymbolCompleter implements the symbol completer
-    //----------------------------------------------------------------------
-    class SymbolCompleter : public Completer
-    {
-    public:
-        SymbolCompleter (CommandInterpreter &interpreter,
-                         const char *completion_str,
-                         int match_start_point,
-                         int max_return_elements,
-                         StringList &matches);
-        
-        Searcher::Depth GetDepth() override;
-
-        Searcher::CallbackReturn
-        SearchCallback(SearchFilter &filter,
-                       SymbolContext &context,
-                       Address *addr,
-                       bool complete) override;
-
-        size_t
-        DoCompletion(SearchFilter *filter) override;
-
-    private:
-//        struct NameCmp {
-//            bool operator() (const ConstString& lhs, const ConstString& rhs) const
-//            {
-//                return lhs < rhs;
-//            }
-//        };
-
-        RegularExpression m_regex;
-        typedef std::set<ConstString> collection;
-        collection m_match_set;
+  static int SourceFiles(CommandInterpreter &interpreter,
+                         const char *partial_file_name, int match_start_point,
+                         int max_return_elements, SearchFilter *searcher,
+                         bool &word_complete, StringList &matches);
+
+  static int Modules(CommandInterpreter &interpreter,
+                     const char *partial_file_name, int match_start_point,
+                     int max_return_elements, SearchFilter *searcher,
+                     bool &word_complete, lldb_private::StringList &matches);
+
+  static int Symbols(CommandInterpreter &interpreter,
+                     const char *partial_file_name, int match_start_point,
+                     int max_return_elements, SearchFilter *searcher,
+                     bool &word_complete, lldb_private::StringList &matches);
+
+  static int SettingsNames(CommandInterpreter &interpreter,
+                           const char *partial_file_name, int match_start_point,
+                           int max_return_elements, SearchFilter *searcher,
+                           bool &word_complete,
+                           lldb_private::StringList &matches);
+
+  static int PlatformPluginNames(CommandInterpreter &interpreter,
+                                 const char *partial_file_name,
+                                 int match_start_point, int max_return_elements,
+                                 SearchFilter *searcher, bool &word_complete,
+                                 lldb_private::StringList &matches);
+
+  static int ArchitectureNames(CommandInterpreter &interpreter,
+                               const char *partial_file_name,
+                               int match_start_point, int max_return_elements,
+                               SearchFilter *searcher, bool &word_complete,
+                               lldb_private::StringList &matches);
+
+  static int VariablePath(CommandInterpreter &interpreter,
+                          const char *partial_file_name, int match_start_point,
+                          int max_return_elements, SearchFilter *searcher,
+                          bool &word_complete,
+                          lldb_private::StringList &matches);
+
+  //----------------------------------------------------------------------
+  // The Completer class is a convenient base class for building searchers
+  // that go along with the SearchFilter passed to the standard Completer
+  // functions.
+  //----------------------------------------------------------------------
+  class Completer : public Searcher {
+  public:
+    Completer(CommandInterpreter &interpreter, const char *completion_str,
+              int match_start_point, int max_return_elements,
+              StringList &matches);
+
+    ~Completer() override;
+
+    CallbackReturn SearchCallback(SearchFilter &filter, SymbolContext &context,
+                                  Address *addr, bool complete) override = 0;
+
+    Depth GetDepth() override = 0;
+
+    virtual size_t DoCompletion(SearchFilter *filter) = 0;
+
+  protected:
+    CommandInterpreter &m_interpreter;
+    std::string m_completion_str;
+    int m_match_start_point;
+    int m_max_return_elements;
+    StringList &m_matches;
+
+  private:
+    DISALLOW_COPY_AND_ASSIGN(Completer);
+  };
+
+  //----------------------------------------------------------------------
+  // SourceFileCompleter implements the source file completer
+  //----------------------------------------------------------------------
+  class SourceFileCompleter : public Completer {
+  public:
+    SourceFileCompleter(CommandInterpreter &interpreter,
+                        bool include_support_files, const char *completion_str,
+                        int match_start_point, int max_return_elements,
+                        StringList &matches);
+
+    Searcher::Depth GetDepth() override;
+
+    Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+                                            SymbolContext &context,
+                                            Address *addr,
+                                            bool complete) override;
+
+    size_t DoCompletion(SearchFilter *filter) override;
+
+  private:
+    bool m_include_support_files;
+    FileSpecList m_matching_files;
+    const char *m_file_name;
+    const char *m_dir_name;
+
+    DISALLOW_COPY_AND_ASSIGN(SourceFileCompleter);
+  };
+
+  //----------------------------------------------------------------------
+  // ModuleCompleter implements the module completer
+  //----------------------------------------------------------------------
+  class ModuleCompleter : public Completer {
+  public:
+    ModuleCompleter(CommandInterpreter &interpreter, const char *completion_str,
+                    int match_start_point, int max_return_elements,
+                    StringList &matches);
+
+    Searcher::Depth GetDepth() override;
+
+    Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+                                            SymbolContext &context,
+                                            Address *addr,
+                                            bool complete) override;
+
+    size_t DoCompletion(SearchFilter *filter) override;
+
+  private:
+    const char *m_file_name;
+    const char *m_dir_name;
+
+    DISALLOW_COPY_AND_ASSIGN(ModuleCompleter);
+  };
+
+  //----------------------------------------------------------------------
+  // SymbolCompleter implements the symbol completer
+  //----------------------------------------------------------------------
+  class SymbolCompleter : public Completer {
+  public:
+    SymbolCompleter(CommandInterpreter &interpreter, const char *completion_str,
+                    int match_start_point, int max_return_elements,
+                    StringList &matches);
+
+    Searcher::Depth GetDepth() override;
+
+    Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+                                            SymbolContext &context,
+                                            Address *addr,
+                                            bool complete) override;
+
+    size_t DoCompletion(SearchFilter *filter) override;
+
+  private:
+    //        struct NameCmp {
+    //            bool operator() (const ConstString& lhs, const ConstString&
+    //            rhs) const
+    //            {
+    //                return lhs < rhs;
+    //            }
+    //        };
+
+    RegularExpression m_regex;
+    typedef std::set<ConstString> collection;
+    collection m_match_set;
 
-        DISALLOW_COPY_AND_ASSIGN(SymbolCompleter);
-    };
+    DISALLOW_COPY_AND_ASSIGN(SymbolCompleter);
+  };
 
 private:
-    static CommonCompletionElement g_common_completions[];
+  static CommonCompletionElement g_common_completions[];
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Interpreter/CommandHistory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandHistory.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandHistory.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandHistory.h Tue Sep  6 15:57:50 2016
@@ -18,58 +18,46 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Core/Stream.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
-    
-class CommandHistory
-{
+
+class CommandHistory {
 public:
-    CommandHistory ();
-    
-    ~CommandHistory ();
-    
-    size_t
-    GetSize () const;
-    
-    bool
-    IsEmpty () const;
-    
-    const char*
-    FindString (const char* input_str) const;
-    
-    const char*
-    GetStringAtIndex (size_t idx) const;
-    
-    const char*
-    operator [] (size_t idx) const;
-    
-    const char*
-    GetRecentmostString () const;
-    
-    void
-    AppendString (const std::string& str,
-                  bool reject_if_dupe = true);
-    
-    void
-    Clear ();
-
-    void
-    Dump (Stream& stream,
-          size_t start_idx = 0,
-          size_t stop_idx = SIZE_MAX) const;
-    
-    static const char g_repeat_char = '!';
-    
+  CommandHistory();
+
+  ~CommandHistory();
+
+  size_t GetSize() const;
+
+  bool IsEmpty() const;
+
+  const char *FindString(const char *input_str) const;
+
+  const char *GetStringAtIndex(size_t idx) const;
+
+  const char *operator[](size_t idx) const;
+
+  const char *GetRecentmostString() const;
+
+  void AppendString(const std::string &str, bool reject_if_dupe = true);
+
+  void Clear();
+
+  void Dump(Stream &stream, size_t start_idx = 0,
+            size_t stop_idx = SIZE_MAX) const;
+
+  static const char g_repeat_char = '!';
+
 private:
-    DISALLOW_COPY_AND_ASSIGN(CommandHistory);
-    
-    typedef std::vector<std::string> History;
-    mutable std::recursive_mutex m_mutex;
-    History m_history;
+  DISALLOW_COPY_AND_ASSIGN(CommandHistory);
+
+  typedef std::vector<std::string> History;
+  mutable std::recursive_mutex m_mutex;
+  History m_history;
 };
 
 } // namespace lldb_private
 
-#endif  // liblldb_CommandHistory_h_
+#endif // liblldb_CommandHistory_h_

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Tue Sep  6 15:57:50 2016
@@ -14,697 +14,547 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-forward.h"
-#include "lldb/lldb-private.h"
 #include "lldb/Core/Broadcaster.h"
 #include "lldb/Core/Debugger.h"
+#include "lldb/Core/Event.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Core/Log.h"
+#include "lldb/Core/StringList.h"
+#include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandAlias.h"
 #include "lldb/Interpreter/CommandHistory.h"
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Core/Event.h"
-#include "lldb/Interpreter/Args.h"
-#include "lldb/Core/StringList.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
 
-class CommandInterpreterRunOptions
-{
+class CommandInterpreterRunOptions {
 public:
-    //------------------------------------------------------------------
-    /// Construct a CommandInterpreterRunOptions object.
-    /// This class is used to control all the instances where we run multiple commands, e.g.
-    /// HandleCommands, HandleCommandsFromFile, RunCommandInterpreter.
-    /// The meanings of the options in this object are:
-    ///
-    /// @param[in] stop_on_continue
-    ///    If \b true execution will end on the first command that causes the process in the
-    ///    execution context to continue.  If \false, we won't check the execution status.
-    /// @param[in] stop_on_error 
-    ///    If \b true execution will end on the first command that causes an error.
-    /// @param[in] stop_on_crash
-    ///    If \b true when a command causes the target to run, and the end of the run is a
-    ///    signal or exception, stop executing the commands.
-    /// @param[in] echo_commands
-    ///    If \b true echo the command before executing it.  If \false, execute silently.
-    /// @param[in] print_results
-    ///    If \b true print the results of the command after executing it.  If \false, execute silently.
-    /// @param[in] add_to_history
-    ///    If \b true add the commands to the command history.  If \false, don't add them.
-    //------------------------------------------------------------------
-    CommandInterpreterRunOptions (LazyBool stop_on_continue,
-                                  LazyBool stop_on_error,
-                                  LazyBool stop_on_crash,
-                                  LazyBool echo_commands,
-                                  LazyBool print_results,
-                                  LazyBool add_to_history) :
-        m_stop_on_continue(stop_on_continue),
-        m_stop_on_error(stop_on_error),
-        m_stop_on_crash(stop_on_crash),
-        m_echo_commands(echo_commands),
-        m_print_results(print_results),
-        m_add_to_history(add_to_history)
-    {}
+  //------------------------------------------------------------------
+  /// Construct a CommandInterpreterRunOptions object.
+  /// This class is used to control all the instances where we run multiple
+  /// commands, e.g.
+  /// HandleCommands, HandleCommandsFromFile, RunCommandInterpreter.
+  /// The meanings of the options in this object are:
+  ///
+  /// @param[in] stop_on_continue
+  ///    If \b true execution will end on the first command that causes the
+  ///    process in the
+  ///    execution context to continue.  If \false, we won't check the execution
+  ///    status.
+  /// @param[in] stop_on_error
+  ///    If \b true execution will end on the first command that causes an
+  ///    error.
+  /// @param[in] stop_on_crash
+  ///    If \b true when a command causes the target to run, and the end of the
+  ///    run is a
+  ///    signal or exception, stop executing the commands.
+  /// @param[in] echo_commands
+  ///    If \b true echo the command before executing it.  If \false, execute
+  ///    silently.
+  /// @param[in] print_results
+  ///    If \b true print the results of the command after executing it.  If
+  ///    \false, execute silently.
+  /// @param[in] add_to_history
+  ///    If \b true add the commands to the command history.  If \false, don't
+  ///    add them.
+  //------------------------------------------------------------------
+  CommandInterpreterRunOptions(LazyBool stop_on_continue,
+                               LazyBool stop_on_error, LazyBool stop_on_crash,
+                               LazyBool echo_commands, LazyBool print_results,
+                               LazyBool add_to_history)
+      : m_stop_on_continue(stop_on_continue), m_stop_on_error(stop_on_error),
+        m_stop_on_crash(stop_on_crash), m_echo_commands(echo_commands),
+        m_print_results(print_results), m_add_to_history(add_to_history) {}
 
-    CommandInterpreterRunOptions () :
-        m_stop_on_continue(eLazyBoolCalculate),
+  CommandInterpreterRunOptions()
+      : m_stop_on_continue(eLazyBoolCalculate),
         m_stop_on_error(eLazyBoolCalculate),
         m_stop_on_crash(eLazyBoolCalculate),
         m_echo_commands(eLazyBoolCalculate),
         m_print_results(eLazyBoolCalculate),
-        m_add_to_history(eLazyBoolCalculate)
-    {}
-
-    void
-    SetSilent (bool silent)
-    {
-        LazyBool value = silent ? eLazyBoolNo : eLazyBoolYes;
-
-        m_echo_commands = value;
-        m_print_results = value;
-        m_add_to_history = value;
-    }
-    // These return the default behaviors if the behavior is not eLazyBoolCalculate.
-    // But I've also left the ivars public since for different ways of running the
-    // interpreter you might want to force different defaults...  In that case, just grab
-    // the LazyBool ivars directly and do what you want with eLazyBoolCalculate.
-    bool
-    GetStopOnContinue () const
-    {
-        return DefaultToNo (m_stop_on_continue);
-    }
-
-    void
-    SetStopOnContinue (bool stop_on_continue)
-    {
-        m_stop_on_continue = stop_on_continue ? eLazyBoolYes : eLazyBoolNo;
-    }
-
-    bool
-    GetStopOnError () const
-    {
-        return DefaultToNo (m_stop_on_continue);
-    }
-
-    void
-    SetStopOnError (bool stop_on_error)
-    {
-        m_stop_on_error = stop_on_error ? eLazyBoolYes : eLazyBoolNo;
-    }
-
-    bool
-    GetStopOnCrash () const
-    {
-        return DefaultToNo (m_stop_on_crash);
-    }
-
-    void
-    SetStopOnCrash (bool stop_on_crash)
-    {
-        m_stop_on_crash = stop_on_crash ? eLazyBoolYes : eLazyBoolNo;
-    }
-
-    bool
-    GetEchoCommands () const
-    {
-        return DefaultToYes (m_echo_commands);
-    }
-
-    void
-    SetEchoCommands (bool echo_commands)
-    {
-        m_echo_commands = echo_commands ? eLazyBoolYes : eLazyBoolNo;
-    }
-
-    bool
-    GetPrintResults () const
-    {
-        return DefaultToYes (m_print_results);
-    }
-
-    void
-    SetPrintResults (bool print_results)
-    {
-        m_print_results = print_results ? eLazyBoolYes : eLazyBoolNo;
-    }
-
-    bool
-    GetAddToHistory () const
-    {
-        return DefaultToYes (m_add_to_history);
-    }
+        m_add_to_history(eLazyBoolCalculate) {}
 
-    void
-    SetAddToHistory (bool add_to_history)
-    {
-        m_add_to_history = add_to_history ? eLazyBoolYes : eLazyBoolNo;
-    }
+  void SetSilent(bool silent) {
+    LazyBool value = silent ? eLazyBoolNo : eLazyBoolYes;
 
-    LazyBool m_stop_on_continue;
-    LazyBool m_stop_on_error;
-    LazyBool m_stop_on_crash;
-    LazyBool m_echo_commands;
-    LazyBool m_print_results;
-    LazyBool m_add_to_history;
-
-    private:
-    static bool
-    DefaultToYes (LazyBool flag)
-    {
-        switch (flag)
-        {
-            case eLazyBoolNo:
-                return false;
-            default:
-                return true;
-        }
-    }
+    m_echo_commands = value;
+    m_print_results = value;
+    m_add_to_history = value;
+  }
+  // These return the default behaviors if the behavior is not
+  // eLazyBoolCalculate.
+  // But I've also left the ivars public since for different ways of running the
+  // interpreter you might want to force different defaults...  In that case,
+  // just grab
+  // the LazyBool ivars directly and do what you want with eLazyBoolCalculate.
+  bool GetStopOnContinue() const { return DefaultToNo(m_stop_on_continue); }
+
+  void SetStopOnContinue(bool stop_on_continue) {
+    m_stop_on_continue = stop_on_continue ? eLazyBoolYes : eLazyBoolNo;
+  }
+
+  bool GetStopOnError() const { return DefaultToNo(m_stop_on_continue); }
+
+  void SetStopOnError(bool stop_on_error) {
+    m_stop_on_error = stop_on_error ? eLazyBoolYes : eLazyBoolNo;
+  }
+
+  bool GetStopOnCrash() const { return DefaultToNo(m_stop_on_crash); }
+
+  void SetStopOnCrash(bool stop_on_crash) {
+    m_stop_on_crash = stop_on_crash ? eLazyBoolYes : eLazyBoolNo;
+  }
+
+  bool GetEchoCommands() const { return DefaultToYes(m_echo_commands); }
+
+  void SetEchoCommands(bool echo_commands) {
+    m_echo_commands = echo_commands ? eLazyBoolYes : eLazyBoolNo;
+  }
+
+  bool GetPrintResults() const { return DefaultToYes(m_print_results); }
+
+  void SetPrintResults(bool print_results) {
+    m_print_results = print_results ? eLazyBoolYes : eLazyBoolNo;
+  }
+
+  bool GetAddToHistory() const { return DefaultToYes(m_add_to_history); }
+
+  void SetAddToHistory(bool add_to_history) {
+    m_add_to_history = add_to_history ? eLazyBoolYes : eLazyBoolNo;
+  }
+
+  LazyBool m_stop_on_continue;
+  LazyBool m_stop_on_error;
+  LazyBool m_stop_on_crash;
+  LazyBool m_echo_commands;
+  LazyBool m_print_results;
+  LazyBool m_add_to_history;
 
-    static bool
-    DefaultToNo (LazyBool flag)
-    {
-        switch (flag)
-        {
-            case eLazyBoolYes:
-                return true;
-            default:
-                return false;
-        }
+private:
+  static bool DefaultToYes(LazyBool flag) {
+    switch (flag) {
+    case eLazyBoolNo:
+      return false;
+    default:
+      return true;
+    }
+  }
+
+  static bool DefaultToNo(LazyBool flag) {
+    switch (flag) {
+    case eLazyBoolYes:
+      return true;
+    default:
+      return false;
     }
+  }
 };
 
-class CommandInterpreter :
-    public Broadcaster,
-    public Properties,
-    public IOHandlerDelegate
-{
+class CommandInterpreter : public Broadcaster,
+                           public Properties,
+                           public IOHandlerDelegate {
 public:
-    enum
-    {
-        eBroadcastBitThreadShouldExit       = (1 << 0),
-        eBroadcastBitResetPrompt            = (1 << 1),
-        eBroadcastBitQuitCommandReceived    = (1 << 2),   // User entered quit
-        eBroadcastBitAsynchronousOutputData = (1 << 3),
-        eBroadcastBitAsynchronousErrorData  = (1 << 4)
-    };
-    
-    enum ChildrenTruncatedWarningStatus // tristate boolean to manage children truncation warning
-    {
-        eNoTruncation = 0, // never truncated
-        eUnwarnedTruncation = 1, // truncated but did not notify
-        eWarnedTruncation = 2 // truncated and notified
-    };
-    
-    enum CommandTypes
-    {
-        eCommandTypesBuiltin = 0x0001,  // native commands such as "frame"
-        eCommandTypesUserDef = 0x0002,  // scripted commands
-        eCommandTypesAliases = 0x0004,  // aliases such as "po"
-        eCommandTypesHidden  = 0x0008,  // commands prefixed with an underscore
-        eCommandTypesAllThem = 0xFFFF   // all commands
-    };
-
-    CommandInterpreter(Debugger &debugger,
-                       lldb::ScriptLanguage script_language,
-                       bool synchronous_execution);
-
-    ~CommandInterpreter() override;
-
-    // These two functions fill out the Broadcaster interface:
-    
-    static ConstString &GetStaticBroadcasterClass ();
-
-    ConstString &GetBroadcasterClass() const override
-    {
-        return GetStaticBroadcasterClass();
-    }
+  enum {
+    eBroadcastBitThreadShouldExit = (1 << 0),
+    eBroadcastBitResetPrompt = (1 << 1),
+    eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit
+    eBroadcastBitAsynchronousOutputData = (1 << 3),
+    eBroadcastBitAsynchronousErrorData = (1 << 4)
+  };
+
+  enum ChildrenTruncatedWarningStatus // tristate boolean to manage children
+                                      // truncation warning
+  { eNoTruncation = 0,                // never truncated
+    eUnwarnedTruncation = 1,          // truncated but did not notify
+    eWarnedTruncation = 2             // truncated and notified
+  };
+
+  enum CommandTypes {
+    eCommandTypesBuiltin = 0x0001, // native commands such as "frame"
+    eCommandTypesUserDef = 0x0002, // scripted commands
+    eCommandTypesAliases = 0x0004, // aliases such as "po"
+    eCommandTypesHidden = 0x0008,  // commands prefixed with an underscore
+    eCommandTypesAllThem = 0xFFFF  // all commands
+  };
+
+  CommandInterpreter(Debugger &debugger, lldb::ScriptLanguage script_language,
+                     bool synchronous_execution);
+
+  ~CommandInterpreter() override;
+
+  // These two functions fill out the Broadcaster interface:
+
+  static ConstString &GetStaticBroadcasterClass();
+
+  ConstString &GetBroadcasterClass() const override {
+    return GetStaticBroadcasterClass();
+  }
+
+  void SourceInitFile(bool in_cwd, CommandReturnObject &result);
+
+  bool AddCommand(const char *name, const lldb::CommandObjectSP &cmd_sp,
+                  bool can_replace);
+
+  bool AddUserCommand(std::string name, const lldb::CommandObjectSP &cmd_sp,
+                      bool can_replace);
+
+  lldb::CommandObjectSP GetCommandSPExact(const char *cmd,
+                                          bool include_aliases);
+
+  CommandObject *GetCommandObjectExact(const char *cmd_cstr,
+                                       bool include_aliases);
+
+  CommandObject *GetCommandObject(const char *cmd,
+                                  StringList *matches = nullptr);
+
+  bool CommandExists(const char *cmd);
+
+  bool AliasExists(const char *cmd);
+
+  bool UserCommandExists(const char *cmd);
+
+  CommandAlias *AddAlias(const char *alias_name,
+                         lldb::CommandObjectSP &command_obj_sp,
+                         const char *args_string = nullptr);
+
+  // Remove a command if it is removable (python or regex command)
+  bool RemoveCommand(const char *cmd);
+
+  bool RemoveAlias(const char *alias_name);
+
+  bool GetAliasFullName(const char *cmd, std::string &full_name);
+
+  bool RemoveUser(const char *alias_name);
+
+  void RemoveAllUser() { m_user_dict.clear(); }
+
+  CommandAlias *GetAlias(const char *alias_name);
+
+  CommandObject *BuildAliasResult(const char *alias_name,
+                                  std::string &raw_input_string,
+                                  std::string &alias_result,
+                                  CommandReturnObject &result);
+
+  bool HandleCommand(const char *command_line, LazyBool add_to_history,
+                     CommandReturnObject &result,
+                     ExecutionContext *override_context = nullptr,
+                     bool repeat_on_empty_command = true,
+                     bool no_context_switching = false);
+
+  //------------------------------------------------------------------
+  /// Execute a list of commands in sequence.
+  ///
+  /// @param[in] commands
+  ///    The list of commands to execute.
+  /// @param[in,out] context
+  ///    The execution context in which to run the commands. Can be nullptr in
+  ///    which case the default
+  ///    context will be used.
+  /// @param[in] options
+  ///    This object holds the options used to control when to stop, whether to
+  ///    execute commands,
+  ///    etc.
+  /// @param[out] result
+  ///    This is marked as succeeding with no output if all commands execute
+  ///    safely,
+  ///    and failed with some explanation if we aborted executing the commands
+  ///    at some point.
+  //------------------------------------------------------------------
+  void HandleCommands(const StringList &commands, ExecutionContext *context,
+                      CommandInterpreterRunOptions &options,
+                      CommandReturnObject &result);
 
-    void
-    SourceInitFile (bool in_cwd, 
-                    CommandReturnObject &result);
-
-    bool
-    AddCommand (const char *name, 
-                const lldb::CommandObjectSP &cmd_sp,
-                bool can_replace);
-    
-    bool
-    AddUserCommand (std::string name, 
-                    const lldb::CommandObjectSP &cmd_sp,
-                    bool can_replace);
-    
-    lldb::CommandObjectSP
-    GetCommandSPExact (const char *cmd, 
-                       bool include_aliases);
-
-    CommandObject *
-    GetCommandObjectExact (const char *cmd_cstr, 
-                           bool include_aliases);
-
-    CommandObject *
-    GetCommandObject(const char *cmd,
-                     StringList *matches = nullptr);
-
-    bool
-    CommandExists (const char *cmd);
-
-    bool
-    AliasExists (const char *cmd);
-
-    bool
-    UserCommandExists (const char *cmd);
-
-    CommandAlias*
-    AddAlias (const char *alias_name,
-              lldb::CommandObjectSP& command_obj_sp,
-              const char *args_string = nullptr);
-    
-    // Remove a command if it is removable (python or regex command)
-    bool
-    RemoveCommand (const char *cmd);
-
-    bool
-    RemoveAlias (const char *alias_name);
-    
-    bool
-    GetAliasFullName (const char *cmd, std::string &full_name);
-
-    bool
-    RemoveUser (const char *alias_name);
-    
-    void
-    RemoveAllUser ()
-    {
-        m_user_dict.clear();
-    }
+  //------------------------------------------------------------------
+  /// Execute a list of commands from a file.
+  ///
+  /// @param[in] file
+  ///    The file from which to read in commands.
+  /// @param[in,out] context
+  ///    The execution context in which to run the commands. Can be nullptr in
+  ///    which case the default
+  ///    context will be used.
+  /// @param[in] options
+  ///    This object holds the options used to control when to stop, whether to
+  ///    execute commands,
+  ///    etc.
+  /// @param[out] result
+  ///    This is marked as succeeding with no output if all commands execute
+  ///    safely,
+  ///    and failed with some explanation if we aborted executing the commands
+  ///    at some point.
+  //------------------------------------------------------------------
+  void HandleCommandsFromFile(FileSpec &file, ExecutionContext *context,
+                              CommandInterpreterRunOptions &options,
+                              CommandReturnObject &result);
+
+  CommandObject *GetCommandObjectForCommand(std::string &command_line);
+
+  // This handles command line completion.  You are given a pointer to the
+  // command string buffer, to the current cursor,
+  // and to the end of the string (in case it is not NULL terminated).
+  // You also passed in an StringList object to fill with the returns.
+  // The first element of the array will be filled with the string that you
+  // would need to insert at
+  // the cursor point to complete the cursor point to the longest common
+  // matching prefix.
+  // If you want to limit the number of elements returned, set
+  // max_return_elements to the number of elements
+  // you want returned.  Otherwise set max_return_elements to -1.
+  // If you want to start some way into the match list, then set
+  // match_start_point to the desired start
+  // point.
+  // Returns:
+  // -1 if the completion character should be inserted
+  // -2 if the entire command line should be deleted and replaced with
+  // matches.GetStringAtIndex(0)
+  // INT_MAX if the number of matches is > max_return_elements, but it is
+  // expensive to compute.
+  // Otherwise, returns the number of matches.
+  //
+  // FIXME: Only max_return_elements == -1 is supported at present.
+  int HandleCompletion(const char *current_line, const char *cursor,
+                       const char *last_char, int match_start_point,
+                       int max_return_elements, StringList &matches);
+
+  // This version just returns matches, and doesn't compute the substring.  It
+  // is here so the
+  // Help command can call it for the first argument.
+  // word_complete tells whether the completions are considered a "complete"
+  // response (so the
+  // completer should complete the quote & put a space after the word.
+  int HandleCompletionMatches(Args &input, int &cursor_index,
+                              int &cursor_char_position, int match_start_point,
+                              int max_return_elements, bool &word_complete,
+                              StringList &matches);
+
+  int GetCommandNamesMatchingPartialString(const char *cmd_cstr,
+                                           bool include_aliases,
+                                           StringList &matches);
+
+  void GetHelp(CommandReturnObject &result,
+               uint32_t types = eCommandTypesAllThem);
+
+  void GetAliasHelp(const char *alias_name, StreamString &help_string);
+
+  void OutputFormattedHelpText(Stream &strm, const char *prefix,
+                               const char *help_text);
+
+  void OutputFormattedHelpText(Stream &stream, const char *command_word,
+                               const char *separator, const char *help_text,
+                               size_t max_word_len);
+
+  // this mimics OutputFormattedHelpText but it does perform a much simpler
+  // formatting, basically ensuring line alignment. This is only good if you
+  // have
+  // some complicated layout for your help text and want as little help as
+  // reasonable
+  // in properly displaying it. Most of the times, you simply want to type some
+  // text
+  // and have it printed in a reasonable way on screen. If so, use
+  // OutputFormattedHelpText
+  void OutputHelpText(Stream &stream, const char *command_word,
+                      const char *separator, const char *help_text,
+                      uint32_t max_word_len);
+
+  Debugger &GetDebugger() { return m_debugger; }
+
+  ExecutionContext GetExecutionContext() {
+    const bool thread_and_frame_only_if_stopped = true;
+    return m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped);
+  }
+
+  void UpdateExecutionContext(ExecutionContext *override_context);
+
+  lldb::PlatformSP GetPlatform(bool prefer_target_platform);
+
+  const char *ProcessEmbeddedScriptCommands(const char *arg);
+
+  void UpdatePrompt(const char *);
+
+  bool Confirm(const char *message, bool default_answer);
+
+  void LoadCommandDictionary();
+
+  void Initialize();
+
+  void Clear();
+
+  void SetScriptLanguage(lldb::ScriptLanguage lang);
+
+  bool HasCommands();
+
+  bool HasAliases();
+
+  bool HasUserCommands();
+
+  bool HasAliasOptions();
+
+  void BuildAliasCommandArgs(CommandObject *alias_cmd_obj,
+                             const char *alias_name, Args &cmd_args,
+                             std::string &raw_input_string,
+                             CommandReturnObject &result);
+
+  int GetOptionArgumentPosition(const char *in_string);
+
+  ScriptInterpreter *GetScriptInterpreter(bool can_create = true);
+
+  void SetScriptInterpreter();
+
+  void SkipLLDBInitFiles(bool skip_lldbinit_files) {
+    m_skip_lldbinit_files = skip_lldbinit_files;
+  }
+
+  void SkipAppInitFiles(bool skip_app_init_files) {
+    m_skip_app_init_files = m_skip_lldbinit_files;
+  }
+
+  bool GetSynchronous();
+
+  void FindCommandsForApropos(const char *word, StringList &commands_found,
+                              StringList &commands_help,
+                              bool search_builtin_commands,
+                              bool search_user_commands,
+                              bool search_alias_commands);
+
+  bool GetBatchCommandMode() { return m_batch_command_mode; }
+
+  bool SetBatchCommandMode(bool value) {
+    const bool old_value = m_batch_command_mode;
+    m_batch_command_mode = value;
+    return old_value;
+  }
+
+  void ChildrenTruncated() {
+    if (m_truncation_warning == eNoTruncation)
+      m_truncation_warning = eUnwarnedTruncation;
+  }
+
+  bool TruncationWarningNecessary() {
+    return (m_truncation_warning == eUnwarnedTruncation);
+  }
+
+  void TruncationWarningGiven() { m_truncation_warning = eWarnedTruncation; }
+
+  const char *TruncationWarningText() {
+    return "*** Some of your variables have more members than the debugger "
+           "will show by default. To show all of them, you can either use the "
+           "--show-all-children option to %s or raise the limit by changing "
+           "the target.max-children-count setting.\n";
+  }
+
+  const CommandHistory &GetCommandHistory() const { return m_command_history; }
+
+  CommandHistory &GetCommandHistory() { return m_command_history; }
+
+  bool IsActive();
+
+  void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread,
+                             CommandInterpreterRunOptions &options);
+  void GetLLDBCommandsFromIOHandler(const char *prompt,
+                                    IOHandlerDelegate &delegate,
+                                    bool asynchronously, void *baton);
 
-    CommandAlias*
-    GetAlias (const char *alias_name);
+  void GetPythonCommandsFromIOHandler(const char *prompt,
+                                      IOHandlerDelegate &delegate,
+                                      bool asynchronously, void *baton);
 
-    CommandObject *
-    BuildAliasResult (const char *alias_name, 
-                      std::string &raw_input_string, 
-                      std::string &alias_result, 
-                      CommandReturnObject &result);
+  const char *GetCommandPrefix();
 
-    bool
-    HandleCommand(const char *command_line,
-                  LazyBool add_to_history,
-                  CommandReturnObject &result,
-                  ExecutionContext *override_context = nullptr,
-                  bool repeat_on_empty_command = true,
-                  bool no_context_switching = false);
-    
-    //------------------------------------------------------------------
-    /// Execute a list of commands in sequence.
-    ///
-    /// @param[in] commands
-    ///    The list of commands to execute.
-    /// @param[in,out] context
-    ///    The execution context in which to run the commands. Can be nullptr in which case the default
-    ///    context will be used.
-    /// @param[in] options
-    ///    This object holds the options used to control when to stop, whether to execute commands,
-    ///    etc.
-    /// @param[out] result
-    ///    This is marked as succeeding with no output if all commands execute safely,
-    ///    and failed with some explanation if we aborted executing the commands at some point.
-    //------------------------------------------------------------------
-    void
-    HandleCommands (const StringList &commands, 
-                    ExecutionContext *context,
-                    CommandInterpreterRunOptions &options,
-                    CommandReturnObject &result);
-
-    //------------------------------------------------------------------
-    /// Execute a list of commands from a file.
-    ///
-    /// @param[in] file
-    ///    The file from which to read in commands.
-    /// @param[in,out] context
-    ///    The execution context in which to run the commands. Can be nullptr in which case the default
-    ///    context will be used.
-    /// @param[in] options
-    ///    This object holds the options used to control when to stop, whether to execute commands,
-    ///    etc.
-    /// @param[out] result
-    ///    This is marked as succeeding with no output if all commands execute safely,
-    ///    and failed with some explanation if we aborted executing the commands at some point.
-    //------------------------------------------------------------------
-    void
-    HandleCommandsFromFile (FileSpec &file, 
-                            ExecutionContext *context,
-                            CommandInterpreterRunOptions &options,
-                            CommandReturnObject &result);
-
-    CommandObject *
-    GetCommandObjectForCommand (std::string &command_line);
-
-    // This handles command line completion.  You are given a pointer to the command string buffer, to the current cursor,
-    // and to the end of the string (in case it is not NULL terminated).
-    // You also passed in an StringList object to fill with the returns.
-    // The first element of the array will be filled with the string that you would need to insert at
-    // the cursor point to complete the cursor point to the longest common matching prefix.
-    // If you want to limit the number of elements returned, set max_return_elements to the number of elements
-    // you want returned.  Otherwise set max_return_elements to -1.
-    // If you want to start some way into the match list, then set match_start_point to the desired start
-    // point.
-    // Returns:
-    // -1 if the completion character should be inserted
-    // -2 if the entire command line should be deleted and replaced with matches.GetStringAtIndex(0)
-    // INT_MAX if the number of matches is > max_return_elements, but it is expensive to compute.
-    // Otherwise, returns the number of matches.
-    //
-    // FIXME: Only max_return_elements == -1 is supported at present.
-    int
-    HandleCompletion (const char *current_line,
-                      const char *cursor,
-                      const char *last_char,
-                      int match_start_point,
-                      int max_return_elements,
-                      StringList &matches);
-
-    // This version just returns matches, and doesn't compute the substring.  It is here so the
-    // Help command can call it for the first argument.
-    // word_complete tells whether the completions are considered a "complete" response (so the
-    // completer should complete the quote & put a space after the word.
-    int
-    HandleCompletionMatches (Args &input,
-                             int &cursor_index,
-                             int &cursor_char_position,
-                             int match_start_point,
-                             int max_return_elements,
-                             bool &word_complete,
-                             StringList &matches);
-
-    int
-    GetCommandNamesMatchingPartialString (const char *cmd_cstr, 
-                                          bool include_aliases, 
-                                          StringList &matches);
-
-    void
-    GetHelp (CommandReturnObject &result,
-             uint32_t types = eCommandTypesAllThem);
-
-    void
-    GetAliasHelp (const char *alias_name, 
-                  StreamString &help_string);
-
-    void
-    OutputFormattedHelpText (Stream &strm,
-                             const char *prefix,
-                             const char *help_text);
-
-    void
-    OutputFormattedHelpText (Stream &stream,
-                             const char *command_word,
-                             const char *separator,
-                             const char *help_text,
-                             size_t max_word_len);
-    
-    // this mimics OutputFormattedHelpText but it does perform a much simpler
-    // formatting, basically ensuring line alignment. This is only good if you have
-    // some complicated layout for your help text and want as little help as reasonable
-    // in properly displaying it. Most of the times, you simply want to type some text
-    // and have it printed in a reasonable way on screen. If so, use OutputFormattedHelpText 
-    void
-    OutputHelpText (Stream &stream,
-                    const char *command_word,
-                    const char *separator,
-                    const char *help_text,
-                    uint32_t max_word_len);
-
-    Debugger &
-    GetDebugger ()
-    {
-        return m_debugger;
-    }
-    
-    ExecutionContext
-    GetExecutionContext()
-    {
-        const bool thread_and_frame_only_if_stopped = true;
-        return m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped);
-    }
-    
-    void
-    UpdateExecutionContext (ExecutionContext *override_context);
-
-    lldb::PlatformSP
-    GetPlatform (bool prefer_target_platform);
-
-    const char *
-    ProcessEmbeddedScriptCommands (const char *arg);
-
-    void
-    UpdatePrompt (const char *);
-    
-    bool
-    Confirm (const char *message,
-             bool default_answer);
-    
-    void
-    LoadCommandDictionary ();
-
-    void
-    Initialize ();
-    
-    void
-    Clear ();
-
-    void
-    SetScriptLanguage (lldb::ScriptLanguage lang);
-
-    bool
-    HasCommands ();
-
-    bool
-    HasAliases ();
-
-    bool
-    HasUserCommands ();
-
-    bool
-    HasAliasOptions ();
-
-    void
-    BuildAliasCommandArgs (CommandObject *alias_cmd_obj, 
-                           const char *alias_name, 
-                           Args &cmd_args, 
-                           std::string &raw_input_string, 
-                           CommandReturnObject &result);
-
-    int
-    GetOptionArgumentPosition (const char *in_string);
-
-    ScriptInterpreter *
-    GetScriptInterpreter(bool can_create = true);
-
-    void
-    SetScriptInterpreter();
-
-    void
-    SkipLLDBInitFiles (bool skip_lldbinit_files)
-    {
-        m_skip_lldbinit_files = skip_lldbinit_files;
-    }
+  //------------------------------------------------------------------
+  // Properties
+  //------------------------------------------------------------------
+  bool GetExpandRegexAliases() const;
 
-    void
-    SkipAppInitFiles (bool skip_app_init_files)
-    {
-        m_skip_app_init_files = m_skip_lldbinit_files;
-    }
+  bool GetPromptOnQuit() const;
 
-    bool
-    GetSynchronous ();
-    
-    void
-    FindCommandsForApropos (const char *word, 
-                            StringList &commands_found, 
-                            StringList &commands_help,
-                            bool search_builtin_commands,
-                            bool search_user_commands,
-                            bool search_alias_commands);
-                           
-    bool
-    GetBatchCommandMode () { return m_batch_command_mode; }
-    
-    bool
-    SetBatchCommandMode (bool value) {
-        const bool old_value = m_batch_command_mode;
-        m_batch_command_mode = value;
-        return old_value;
-    }
-    
-    void
-    ChildrenTruncated ()
-    {
-        if (m_truncation_warning == eNoTruncation)
-            m_truncation_warning = eUnwarnedTruncation;
-    }
-    
-    bool
-    TruncationWarningNecessary ()
-    {
-        return (m_truncation_warning == eUnwarnedTruncation);
-    }
-    
-    void
-    TruncationWarningGiven ()
-    {
-        m_truncation_warning = eWarnedTruncation;
-    }
-    
-    const char *
-    TruncationWarningText ()
-    {
-        return "*** Some of your variables have more members than the debugger will show by default. To show all of them, you can either use the --show-all-children option to %s or raise the limit by changing the target.max-children-count setting.\n";
-    }
-    
-    const CommandHistory&
-    GetCommandHistory () const
-    {
-        return m_command_history;
-    }
-    
-    CommandHistory&
-    GetCommandHistory ()
-    {
-        return m_command_history;
-    }
-    
-    bool
-    IsActive ();
-
-    void
-    RunCommandInterpreter (bool auto_handle_events,
-                           bool spawn_thread,
-                           CommandInterpreterRunOptions &options);
-    void
-    GetLLDBCommandsFromIOHandler (const char *prompt,
-                                  IOHandlerDelegate &delegate,
-                                  bool asynchronously,
-                                  void *baton);
+  void SetPromptOnQuit(bool b);
 
-    void
-    GetPythonCommandsFromIOHandler (const char *prompt,
-                                    IOHandlerDelegate &delegate,
-                                    bool asynchronously,
-                                    void *baton);
+  void ResolveCommand(const char *command_line, CommandReturnObject &result);
 
-    const char *
-    GetCommandPrefix ();
+  bool GetStopCmdSourceOnError() const;
 
-    //------------------------------------------------------------------
-    // Properties
-    //------------------------------------------------------------------
-    bool
-    GetExpandRegexAliases () const;
-    
-    bool
-    GetPromptOnQuit () const;
-
-    void
-    SetPromptOnQuit (bool b);
-
-    void
-    ResolveCommand(const char *command_line, CommandReturnObject &result);
-
-    bool
-    GetStopCmdSourceOnError () const;
-
-    uint32_t
-    GetNumErrors() const
-    {
-        return m_num_errors;
-    }
+  uint32_t GetNumErrors() const { return m_num_errors; }
 
-    bool
-    GetQuitRequested () const
-    {
-        return m_quit_requested;
-    }
+  bool GetQuitRequested() const { return m_quit_requested; }
 
-    lldb::IOHandlerSP
-    GetIOHandler(bool force_create = false, CommandInterpreterRunOptions *options = nullptr);
+  lldb::IOHandlerSP
+  GetIOHandler(bool force_create = false,
+               CommandInterpreterRunOptions *options = nullptr);
+
+  bool GetStoppedForCrash() const { return m_stopped_for_crash; }
+
+  bool GetSpaceReplPrompts() const;
 
-    bool
-    GetStoppedForCrash () const
-    {
-        return m_stopped_for_crash;
-    }
-    
-    bool
-    GetSpaceReplPrompts () const;
-    
 protected:
-    friend class Debugger;
+  friend class Debugger;
+
+  //------------------------------------------------------------------
+  // IOHandlerDelegate functions
+  //------------------------------------------------------------------
+  void IOHandlerInputComplete(IOHandler &io_handler,
+                              std::string &line) override;
+
+  ConstString IOHandlerGetControlSequence(char ch) override {
+    if (ch == 'd')
+      return ConstString("quit\n");
+    return ConstString();
+  }
+
+  bool IOHandlerInterrupt(IOHandler &io_handler) override;
+
+  size_t GetProcessOutput();
+
+  void SetSynchronous(bool value);
+
+  lldb::CommandObjectSP GetCommandSP(const char *cmd,
+                                     bool include_aliases = true,
+                                     bool exact = true,
+                                     StringList *matches = nullptr);
 
-    //------------------------------------------------------------------
-    // IOHandlerDelegate functions
-    //------------------------------------------------------------------
-    void
-    IOHandlerInputComplete(IOHandler &io_handler,
-                           std::string &line) override;
-
-    ConstString
-    IOHandlerGetControlSequence(char ch) override
-    {
-        if (ch == 'd')
-            return ConstString("quit\n");
-        return ConstString();
-    }
-    
-    bool
-    IOHandlerInterrupt(IOHandler &io_handler) override;
-
-    size_t
-    GetProcessOutput ();
-
-    void
-    SetSynchronous (bool value);
-
-    lldb::CommandObjectSP
-    GetCommandSP(const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = nullptr);
-    
 private:
-    Error
-    PreprocessCommand (std::string &command);
+  Error PreprocessCommand(std::string &command);
 
-    // Completely resolves aliases and abbreviations, returning a pointer to the
-    // final command object and updating command_line to the fully substituted
-    // and translated command.
-    CommandObject *
-    ResolveCommandImpl(std::string &command_line, CommandReturnObject &result);
-
-    void
-    FindCommandsForApropos (const char *word,
-                            StringList &commands_found,
-                            StringList &commands_help,
-                            CommandObject::CommandMap &command_map);
-    
-    Debugger &m_debugger;                       // The debugger session that this interpreter is associated with
-    ExecutionContextRef m_exe_ctx_ref;          // The current execution context to use when handling commands
-    bool m_synchronous_execution;
-    bool m_skip_lldbinit_files;
-    bool m_skip_app_init_files;
-    CommandObject::CommandMap m_command_dict;   // Stores basic built-in commands (they cannot be deleted, removed or overwritten).
-    CommandObject::CommandMap m_alias_dict;     // Stores user aliases/abbreviations for commands
-    CommandObject::CommandMap m_user_dict;      // Stores user-defined commands
-    CommandHistory m_command_history;
-    std::string m_repeat_command;               // Stores the command that will be executed for an empty command string.
-    lldb::ScriptInterpreterSP m_script_interpreter_sp;
-    lldb::IOHandlerSP m_command_io_handler_sp;
-    char m_comment_char;
-    bool m_batch_command_mode;
-    ChildrenTruncatedWarningStatus m_truncation_warning;    // Whether we truncated children and whether the user has been told
-    uint32_t m_command_source_depth;
-    std::vector<uint32_t> m_command_source_flags;
-    uint32_t m_num_errors;
-    bool m_quit_requested;
-    bool m_stopped_for_crash;
+  // Completely resolves aliases and abbreviations, returning a pointer to the
+  // final command object and updating command_line to the fully substituted
+  // and translated command.
+  CommandObject *ResolveCommandImpl(std::string &command_line,
+                                    CommandReturnObject &result);
+
+  void FindCommandsForApropos(const char *word, StringList &commands_found,
+                              StringList &commands_help,
+                              CommandObject::CommandMap &command_map);
+
+  Debugger &m_debugger; // The debugger session that this interpreter is
+                        // associated with
+  ExecutionContextRef m_exe_ctx_ref; // The current execution context to use
+                                     // when handling commands
+  bool m_synchronous_execution;
+  bool m_skip_lldbinit_files;
+  bool m_skip_app_init_files;
+  CommandObject::CommandMap m_command_dict; // Stores basic built-in commands
+                                            // (they cannot be deleted, removed
+                                            // or overwritten).
+  CommandObject::CommandMap
+      m_alias_dict; // Stores user aliases/abbreviations for commands
+  CommandObject::CommandMap m_user_dict; // Stores user-defined commands
+  CommandHistory m_command_history;
+  std::string m_repeat_command; // Stores the command that will be executed for
+                                // an empty command string.
+  lldb::ScriptInterpreterSP m_script_interpreter_sp;
+  lldb::IOHandlerSP m_command_io_handler_sp;
+  char m_comment_char;
+  bool m_batch_command_mode;
+  ChildrenTruncatedWarningStatus m_truncation_warning; // Whether we truncated
+                                                       // children and whether
+                                                       // the user has been told
+  uint32_t m_command_source_depth;
+  std::vector<uint32_t> m_command_source_flags;
+  uint32_t m_num_errors;
+  bool m_quit_requested;
+  bool m_stopped_for_crash;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Tue Sep  6 15:57:50 2016
@@ -18,572 +18,482 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
+#include "lldb/Core/Flags.h"
+#include "lldb/Core/StringList.h"
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandCompletions.h"
-#include "lldb/Core/StringList.h"
-#include "lldb/Core/Flags.h"
 #include "lldb/Target/ExecutionContext.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
 
 // This function really deals with CommandObjectLists, but we didn't make a
 // CommandObjectList class, so I'm sticking it here.  But we really should have
-// such a class.  Anyway, it looks up the commands in the map that match the partial
-// string cmd_str, inserts the matches into matches, and returns the number added.
+// such a class.  Anyway, it looks up the commands in the map that match the
+// partial
+// string cmd_str, inserts the matches into matches, and returns the number
+// added.
 
 template <typename ValueType>
-int
-AddNamesMatchingPartialString (std::map<std::string,ValueType> &in_map, const char *cmd_str, StringList &matches)
-{
-    int number_added = 0;
-    
-    const bool add_all = ((cmd_str == nullptr) || (cmd_str[0] == 0));
-    
-    for (auto iter = in_map.begin(), end = in_map.end();
-         iter != end;
-         iter++)
-    {
-        if (add_all ||
-            (iter->first.find(cmd_str,0) == 0))
-        {
-            ++number_added;
-            matches.AppendString(iter->first.c_str());
-        }
+int AddNamesMatchingPartialString(std::map<std::string, ValueType> &in_map,
+                                  const char *cmd_str, StringList &matches) {
+  int number_added = 0;
+
+  const bool add_all = ((cmd_str == nullptr) || (cmd_str[0] == 0));
+
+  for (auto iter = in_map.begin(), end = in_map.end(); iter != end; iter++) {
+    if (add_all || (iter->first.find(cmd_str, 0) == 0)) {
+      ++number_added;
+      matches.AppendString(iter->first.c_str());
     }
-    
-    return number_added;
+  }
+
+  return number_added;
 }
 
 template <typename ValueType>
-size_t
-FindLongestCommandWord (std::map<std::string,ValueType> &dict)
-{
-    auto end = dict.end();
-    size_t max_len = 0;
-    
-    for (auto pos = dict.begin(); pos != end; ++pos)
-    {
-        size_t len = pos->first.size();
-        if (max_len < len)
-            max_len = len;
-    }
-    return max_len;
+size_t FindLongestCommandWord(std::map<std::string, ValueType> &dict) {
+  auto end = dict.end();
+  size_t max_len = 0;
+
+  for (auto pos = dict.begin(); pos != end; ++pos) {
+    size_t len = pos->first.size();
+    if (max_len < len)
+      max_len = len;
+  }
+  return max_len;
 }
 
-class CommandObject
-{
+class CommandObject {
 public:
-    typedef const char *(ArgumentHelpCallbackFunction) ();
-    
-    struct ArgumentHelpCallback
-    {
-        ArgumentHelpCallbackFunction  *help_callback;
-        bool                           self_formatting;
-        
-        const char*
-        operator () () const
-        {
-            return (*help_callback)();
-        }
-        
-        explicit operator bool() const
-        {
-            return (help_callback != nullptr);
-        }
-    };
-    
-    struct ArgumentTableEntry  // Entries in the main argument information table
-    {
-        lldb::CommandArgumentType  arg_type;
-        const char *arg_name;
-        CommandCompletions::CommonCompletionTypes completion_type;
-        ArgumentHelpCallback  help_function;
-        const char *help_text;
-    };
-    
-    struct CommandArgumentData  // Used to build individual command argument lists
-    {
-        lldb::CommandArgumentType arg_type;
-        ArgumentRepetitionType arg_repetition;
-        uint32_t arg_opt_set_association; // This arg might be associated only with some particular option set(s).
-        CommandArgumentData():
-            arg_type(lldb::eArgTypeNone),
-            arg_repetition(eArgRepeatPlain),
-            arg_opt_set_association(LLDB_OPT_SET_ALL) // By default, the arg associates to all option sets.
-        {}
-    };
-    
-    typedef std::vector<CommandArgumentData> CommandArgumentEntry; // Used to build individual command argument lists
-
-    static ArgumentTableEntry g_arguments_data[lldb::eArgTypeLastArg];   // Main argument information table
-
-    typedef std::map<std::string, lldb::CommandObjectSP> CommandMap;
-
-    CommandObject(CommandInterpreter &interpreter,
-                  const char *name,
-                  const char *help = nullptr,
-                  const char *syntax = nullptr,
-                  uint32_t flags = 0);
-
-    virtual
-    ~CommandObject ();
-
-    static const char * 
-    GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type);
-    
-    static const char * 
-    GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type);
-
-    CommandInterpreter &
-    GetCommandInterpreter ()
-    {
-        return m_interpreter;
-    }
+  typedef const char *(ArgumentHelpCallbackFunction)();
 
-    virtual const char *
-    GetHelp ();
+  struct ArgumentHelpCallback {
+    ArgumentHelpCallbackFunction *help_callback;
+    bool self_formatting;
+
+    const char *operator()() const { return (*help_callback)(); }
+
+    explicit operator bool() const { return (help_callback != nullptr); }
+  };
+
+  struct ArgumentTableEntry // Entries in the main argument information table
+  {
+    lldb::CommandArgumentType arg_type;
+    const char *arg_name;
+    CommandCompletions::CommonCompletionTypes completion_type;
+    ArgumentHelpCallback help_function;
+    const char *help_text;
+  };
+
+  struct CommandArgumentData // Used to build individual command argument lists
+  {
+    lldb::CommandArgumentType arg_type;
+    ArgumentRepetitionType arg_repetition;
+    uint32_t arg_opt_set_association; // This arg might be associated only with
+                                      // some particular option set(s).
+    CommandArgumentData()
+        : arg_type(lldb::eArgTypeNone), arg_repetition(eArgRepeatPlain),
+          arg_opt_set_association(LLDB_OPT_SET_ALL) // By default, the arg
+                                                    // associates to all option
+                                                    // sets.
+    {}
+  };
+
+  typedef std::vector<CommandArgumentData>
+      CommandArgumentEntry; // Used to build individual command argument lists
+
+  static ArgumentTableEntry g_arguments_data
+      [lldb::eArgTypeLastArg]; // Main argument information table
+
+  typedef std::map<std::string, lldb::CommandObjectSP> CommandMap;
+
+  CommandObject(CommandInterpreter &interpreter, const char *name,
+                const char *help = nullptr, const char *syntax = nullptr,
+                uint32_t flags = 0);
+
+  virtual ~CommandObject();
+
+  static const char *
+  GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type);
+
+  static const char *
+  GetArgumentDescriptionAsCString(const lldb::CommandArgumentType arg_type);
+
+  CommandInterpreter &GetCommandInterpreter() { return m_interpreter; }
+
+  virtual const char *GetHelp();
+
+  virtual const char *GetHelpLong();
+
+  virtual const char *GetSyntax();
+
+  const char *GetCommandName();
+
+  virtual void SetHelp(const char *str);
+
+  virtual void SetHelpLong(const char *str);
+
+  void SetSyntax(const char *str);
+
+  // override this to return true if you want to enable the user to delete
+  // the Command object from the Command dictionary (aliases have their own
+  // deletion scheme, so they do not need to care about this)
+  virtual bool IsRemovable() const { return false; }
+
+  virtual bool IsMultiwordObject() { return false; }
+
+  virtual CommandObjectMultiword *GetAsMultiwordCommand() { return nullptr; }
+
+  virtual bool IsAlias() { return false; }
+
+  // override this to return true if your command is somehow a "dash-dash"
+  // form of some other command (e.g. po is expr -O --); this is a powerful
+  // hint to the help system that one cannot pass options to this command
+  virtual bool IsDashDashCommand() { return false; }
+
+  virtual lldb::CommandObjectSP GetSubcommandSP(const char *sub_cmd,
+                                                StringList *matches = nullptr) {
+    return lldb::CommandObjectSP();
+  }
+
+  virtual CommandObject *GetSubcommandObject(const char *sub_cmd,
+                                             StringList *matches = nullptr) {
+    return nullptr;
+  }
+
+  virtual void AproposAllSubCommands(const char *prefix,
+                                     const char *search_word,
+                                     StringList &commands_found,
+                                     StringList &commands_help) {}
+
+  void FormatLongHelpText(Stream &output_strm, const char *long_help);
+
+  void GenerateHelpText(CommandReturnObject &result);
+
+  virtual void GenerateHelpText(Stream &result);
+
+  // this is needed in order to allow the SBCommand class to
+  // transparently try and load subcommands - it will fail on
+  // anything but a multiword command, but it avoids us doing
+  // type checkings and casts
+  virtual bool LoadSubCommand(const char *cmd_name,
+                              const lldb::CommandObjectSP &command_obj) {
+    return false;
+  }
+
+  virtual bool WantsRawCommandString() = 0;
+
+  // By default, WantsCompletion = !WantsRawCommandString.
+  // Subclasses who want raw command string but desire, for example,
+  // argument completion should override this method to return true.
+  virtual bool WantsCompletion() { return !WantsRawCommandString(); }
+
+  virtual Options *GetOptions();
+
+  static const ArgumentTableEntry *GetArgumentTable();
+
+  static lldb::CommandArgumentType LookupArgumentName(const char *arg_name);
+
+  static const ArgumentTableEntry *
+  FindArgumentDataByType(lldb::CommandArgumentType arg_type);
+
+  int GetNumArgumentEntries();
+
+  CommandArgumentEntry *GetArgumentEntryAtIndex(int idx);
+
+  static void GetArgumentHelp(Stream &str, lldb::CommandArgumentType arg_type,
+                              CommandInterpreter &interpreter);
+
+  static const char *GetArgumentName(lldb::CommandArgumentType arg_type);
+
+  // Generates a nicely formatted command args string for help command output.
+  // By default, all possible args are taken into account, for example,
+  // '<expr | variable-name>'.  This can be refined by passing a second arg
+  // specifying which option set(s) we are interested, which could then, for
+  // example, produce either '<expr>' or '<variable-name>'.
+  void GetFormattedCommandArguments(Stream &str,
+                                    uint32_t opt_set_mask = LLDB_OPT_SET_ALL);
+
+  bool IsPairType(ArgumentRepetitionType arg_repeat_type);
+
+  bool ParseOptions(Args &args, CommandReturnObject &result);
+
+  void SetCommandName(const char *name);
+
+  //------------------------------------------------------------------
+  /// The input array contains a parsed version of the line.  The insertion
+  /// point is given by cursor_index (the index in input of the word containing
+  /// the cursor) and cursor_char_position (the position of the cursor in that
+  /// word.)
+  /// This default version handles calling option argument completions and then
+  /// calls
+  /// HandleArgumentCompletion if the cursor is on an argument, not an option.
+  /// Don't override this method, override HandleArgumentCompletion instead
+  /// unless
+  /// you have special reasons.
+  ///
+  /// @param[in] interpreter
+  ///    The command interpreter doing the completion.
+  ///
+  /// @param[in] input
+  ///    The command line parsed into words
+  ///
+  /// @param[in] cursor_index
+  ///     The index in \ainput of the word in which the cursor lies.
+  ///
+  /// @param[in] cursor_char_pos
+  ///     The character position of the cursor in its argument word.
+  ///
+  /// @param[in] match_start_point
+  /// @param[in] match_return_elements
+  ///     FIXME: Not yet implemented...  If there is a match that is expensive
+  ///     to compute, these are
+  ///     here to allow you to compute the completions in batches.  Start the
+  ///     completion from \amatch_start_point,
+  ///     and return \amatch_return_elements elements.
+  ///
+  /// @param[out] word_complete
+  ///     \btrue if this is a complete option value (a space will be inserted
+  ///     after the
+  ///     completion.)  \bfalse otherwise.
+  ///
+  /// @param[out] matches
+  ///     The array of matches returned.
+  ///
+  /// FIXME: This is the wrong return value, since we also need to make a
+  /// distinction between
+  /// total number of matches, and the window the user wants returned.
+  ///
+  /// @return
+  ///     \btrue if we were in an option, \bfalse otherwise.
+  //------------------------------------------------------------------
+  virtual int HandleCompletion(Args &input, int &cursor_index,
+                               int &cursor_char_position, int match_start_point,
+                               int max_return_elements, bool &word_complete,
+                               StringList &matches);
+
+  //------------------------------------------------------------------
+  /// The input array contains a parsed version of the line.  The insertion
+  /// point is given by cursor_index (the index in input of the word containing
+  /// the cursor) and cursor_char_position (the position of the cursor in that
+  /// word.)
+  /// We've constructed the map of options and their arguments as well if that
+  /// is
+  /// helpful for the completion.
+  ///
+  /// @param[in] interpreter
+  ///    The command interpreter doing the completion.
+  ///
+  /// @param[in] input
+  ///    The command line parsed into words
+  ///
+  /// @param[in] cursor_index
+  ///     The index in \ainput of the word in which the cursor lies.
+  ///
+  /// @param[in] cursor_char_pos
+  ///     The character position of the cursor in its argument word.
+  ///
+  /// @param[in] opt_element_vector
+  ///     The results of the options parse of \a input.
+  ///
+  /// @param[in] match_start_point
+  /// @param[in] match_return_elements
+  ///     See CommandObject::HandleCompletions for a description of how these
+  ///     work.
+  ///
+  /// @param[out] word_complete
+  ///     \btrue if this is a complete option value (a space will be inserted
+  ///     after the
+  ///     completion.)  \bfalse otherwise.
+  ///
+  /// @param[out] matches
+  ///     The array of matches returned.
+  ///
+  /// FIXME: This is the wrong return value, since we also need to make a
+  /// distinction between
+  /// total number of matches, and the window the user wants returned.
+  ///
+  /// @return
+  ///     The number of completions.
+  //------------------------------------------------------------------
+  virtual int HandleArgumentCompletion(
+      Args &input, int &cursor_index, int &cursor_char_position,
+      OptionElementVector &opt_element_vector, int match_start_point,
+      int max_return_elements, bool &word_complete, StringList &matches) {
+    return 0;
+  }
+
+  bool HelpTextContainsWord(const char *search_word,
+                            bool search_short_help = true,
+                            bool search_long_help = true,
+                            bool search_syntax = true,
+                            bool search_options = true);
+
+  //------------------------------------------------------------------
+  /// The flags accessor.
+  ///
+  /// @return
+  ///     A reference to the Flags member variable.
+  //------------------------------------------------------------------
+  Flags &GetFlags() { return m_flags; }
+
+  //------------------------------------------------------------------
+  /// The flags const accessor.
+  ///
+  /// @return
+  ///     A const reference to the Flags member variable.
+  //------------------------------------------------------------------
+  const Flags &GetFlags() const { return m_flags; }
+
+  //------------------------------------------------------------------
+  /// Get the command that appropriate for a "repeat" of the current command.
+  ///
+  /// @param[in] current_command_line
+  ///    The complete current command line.
+  ///
+  /// @return
+  ///     nullptr if there is no special repeat command - it will use the
+  ///     current command line.
+  ///     Otherwise a pointer to the command to be repeated.
+  ///     If the returned string is the empty string, the command won't be
+  ///     repeated.
+  //------------------------------------------------------------------
+  virtual const char *GetRepeatCommand(Args &current_command_args,
+                                       uint32_t index) {
+    return nullptr;
+  }
+
+  bool HasOverrideCallback() const {
+    return m_command_override_callback ||
+           m_deprecated_command_override_callback;
+  }
+
+  void SetOverrideCallback(lldb::CommandOverrideCallback callback,
+                           void *baton) {
+    m_deprecated_command_override_callback = callback;
+    m_command_override_baton = baton;
+  }
+
+  void SetOverrideCallback(lldb::CommandOverrideCallbackWithResult callback,
+                           void *baton) {
+    m_command_override_callback = callback;
+    m_command_override_baton = baton;
+  }
+
+  bool InvokeOverrideCallback(const char **argv, CommandReturnObject &result) {
+    if (m_command_override_callback)
+      return m_command_override_callback(m_command_override_baton, argv,
+                                         result);
+    else if (m_deprecated_command_override_callback)
+      return m_deprecated_command_override_callback(m_command_override_baton,
+                                                    argv);
+    else
+      return false;
+  }
 
-    virtual const char *
-    GetHelpLong ();
+  virtual bool Execute(const char *args_string,
+                       CommandReturnObject &result) = 0;
 
-    virtual const char *
-    GetSyntax ();
-
-    const char *
-    GetCommandName ();
-
-    virtual void
-    SetHelp (const char * str);
-
-    virtual void
-    SetHelpLong (const char * str);
-
-    void
-    SetSyntax (const char *str);
-    
-    // override this to return true if you want to enable the user to delete
-    // the Command object from the Command dictionary (aliases have their own
-    // deletion scheme, so they do not need to care about this)
-    virtual bool
-    IsRemovable () const { return false; }
-    
-    virtual bool
-    IsMultiwordObject () { return false; }
-    
-    virtual CommandObjectMultiword*
-    GetAsMultiwordCommand () { return nullptr; }
-
-    virtual bool
-    IsAlias () { return false; }
-    
-    // override this to return true if your command is somehow a "dash-dash"
-    // form of some other command (e.g. po is expr -O --); this is a powerful
-    // hint to the help system that one cannot pass options to this command
-    virtual bool
-    IsDashDashCommand () { return false; }
-
-    virtual lldb::CommandObjectSP
-    GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr)
-    {
-        return lldb::CommandObjectSP();
-    }
-    
-    virtual CommandObject *
-    GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr)
-    {
-        return nullptr;
-    }
-    
-    virtual void
-    AproposAllSubCommands (const char *prefix,
-                           const char *search_word,
-                           StringList &commands_found,
-                           StringList &commands_help)
-    {
-    }
-
-    void
-    FormatLongHelpText (Stream &output_strm, const char *long_help);
-
-    void
-    GenerateHelpText (CommandReturnObject &result);
-
-    virtual void
-    GenerateHelpText (Stream &result);
+protected:
+  virtual const char *GetInvalidTargetDescription() {
+    return "invalid target, create a target using the 'target create' command";
+  }
+
+  virtual const char *GetInvalidProcessDescription() {
+    return "invalid process";
+  }
+
+  virtual const char *GetInvalidThreadDescription() { return "invalid thread"; }
+
+  virtual const char *GetInvalidFrameDescription() { return "invalid frame"; }
+
+  virtual const char *GetInvalidRegContextDescription() {
+    return "invalid frame, no registers";
+  }
+
+  // This is for use in the command interpreter, when you either want the
+  // selected target, or if no target
+  // is present you want to prime the dummy target with entities that will be
+  // copied over to new targets.
+  Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
+  Target *GetDummyTarget();
+
+  // If a command needs to use the "current" thread, use this call.
+  // Command objects will have an ExecutionContext to use, and that may or may
+  // not have a thread in it.  If it
+  // does, you should use that by default, if not, then use the
+  // ExecutionContext's target's selected thread, etc...
+  // This call insulates you from the details of this calculation.
+  Thread *GetDefaultThread();
+
+  //------------------------------------------------------------------
+  /// Check the command to make sure anything required by this
+  /// command is available.
+  ///
+  /// @param[out] result
+  ///     A command result object, if it is not okay to run the command
+  ///     this will be filled in with a suitable error.
+  ///
+  /// @return
+  ///     \b true if it is okay to run this command, \b false otherwise.
+  //------------------------------------------------------------------
+  bool CheckRequirements(CommandReturnObject &result);
+
+  void Cleanup();
+
+  CommandInterpreter &m_interpreter;
+  ExecutionContext m_exe_ctx;
+  std::unique_lock<std::recursive_mutex> m_api_locker;
+  std::string m_cmd_name;
+  std::string m_cmd_help_short;
+  std::string m_cmd_help_long;
+  std::string m_cmd_syntax;
+  Flags m_flags;
+  std::vector<CommandArgumentEntry> m_arguments;
+  lldb::CommandOverrideCallback m_deprecated_command_override_callback;
+  lldb::CommandOverrideCallbackWithResult m_command_override_callback;
+  void *m_command_override_baton;
+
+  // Helper function to populate IDs or ID ranges as the command argument data
+  // to the specified command argument entry.
+  static void AddIDsArgumentData(CommandArgumentEntry &arg,
+                                 lldb::CommandArgumentType ID,
+                                 lldb::CommandArgumentType IDRange);
+};
 
-    // this is needed in order to allow the SBCommand class to
-    // transparently try and load subcommands - it will fail on
-    // anything but a multiword command, but it avoids us doing
-    // type checkings and casts
-    virtual bool
-    LoadSubCommand (const char *cmd_name,
-                    const lldb::CommandObjectSP& command_obj)
-    {
-        return false;
-    }
-    
-    virtual bool
-    WantsRawCommandString() = 0;
-
-    // By default, WantsCompletion = !WantsRawCommandString.
-    // Subclasses who want raw command string but desire, for example,
-    // argument completion should override this method to return true.
-    virtual bool
-    WantsCompletion() { return !WantsRawCommandString(); }
-
-    virtual Options *
-    GetOptions ();
-
-    static const ArgumentTableEntry*
-    GetArgumentTable ();
-
-    static lldb::CommandArgumentType
-    LookupArgumentName (const char *arg_name);
-
-    static const ArgumentTableEntry *
-    FindArgumentDataByType (lldb::CommandArgumentType arg_type);
-
-    int
-    GetNumArgumentEntries ();
-
-    CommandArgumentEntry *
-    GetArgumentEntryAtIndex (int idx);
-
-    static void
-    GetArgumentHelp (Stream &str, lldb::CommandArgumentType arg_type, CommandInterpreter &interpreter);
-
-    static const char *
-    GetArgumentName (lldb::CommandArgumentType arg_type);
-
-    // Generates a nicely formatted command args string for help command output.
-    // By default, all possible args are taken into account, for example,
-    // '<expr | variable-name>'.  This can be refined by passing a second arg
-    // specifying which option set(s) we are interested, which could then, for
-    // example, produce either '<expr>' or '<variable-name>'.
-    void
-    GetFormattedCommandArguments (Stream &str, uint32_t opt_set_mask = LLDB_OPT_SET_ALL);
-    
-    bool
-    IsPairType (ArgumentRepetitionType arg_repeat_type);
-
-    bool
-    ParseOptions (Args& args, CommandReturnObject &result);
-
-    void
-    SetCommandName (const char *name);
-
-    //------------------------------------------------------------------
-    /// The input array contains a parsed version of the line.  The insertion
-    /// point is given by cursor_index (the index in input of the word containing
-    /// the cursor) and cursor_char_position (the position of the cursor in that word.)
-    /// This default version handles calling option argument completions and then calls
-    /// HandleArgumentCompletion if the cursor is on an argument, not an option.
-    /// Don't override this method, override HandleArgumentCompletion instead unless
-    /// you have special reasons.
-    ///
-    /// @param[in] interpreter
-    ///    The command interpreter doing the completion.
-    ///
-    /// @param[in] input
-    ///    The command line parsed into words
-    ///
-    /// @param[in] cursor_index
-    ///     The index in \ainput of the word in which the cursor lies.
-    ///
-    /// @param[in] cursor_char_pos
-    ///     The character position of the cursor in its argument word.
-    ///
-    /// @param[in] match_start_point
-    /// @param[in] match_return_elements
-    ///     FIXME: Not yet implemented...  If there is a match that is expensive to compute, these are
-    ///     here to allow you to compute the completions in batches.  Start the completion from \amatch_start_point,
-    ///     and return \amatch_return_elements elements.
-    ///
-    /// @param[out] word_complete
-    ///     \btrue if this is a complete option value (a space will be inserted after the
-    ///     completion.)  \bfalse otherwise.
-    ///
-    /// @param[out] matches
-    ///     The array of matches returned.
-    ///
-    /// FIXME: This is the wrong return value, since we also need to make a distinction between
-    /// total number of matches, and the window the user wants returned.
-    ///
-    /// @return
-    ///     \btrue if we were in an option, \bfalse otherwise.
-    //------------------------------------------------------------------
-    virtual int
-    HandleCompletion (Args &input,
-                      int &cursor_index,
-                      int &cursor_char_position,
-                      int match_start_point,
-                      int max_return_elements,
-                      bool &word_complete,
-                      StringList &matches);
-
-    //------------------------------------------------------------------
-    /// The input array contains a parsed version of the line.  The insertion
-    /// point is given by cursor_index (the index in input of the word containing
-    /// the cursor) and cursor_char_position (the position of the cursor in that word.)
-    /// We've constructed the map of options and their arguments as well if that is
-    /// helpful for the completion.
-    ///
-    /// @param[in] interpreter
-    ///    The command interpreter doing the completion.
-    ///
-    /// @param[in] input
-    ///    The command line parsed into words
-    ///
-    /// @param[in] cursor_index
-    ///     The index in \ainput of the word in which the cursor lies.
-    ///
-    /// @param[in] cursor_char_pos
-    ///     The character position of the cursor in its argument word.
-    ///
-    /// @param[in] opt_element_vector
-    ///     The results of the options parse of \a input.
-    ///
-    /// @param[in] match_start_point
-    /// @param[in] match_return_elements
-    ///     See CommandObject::HandleCompletions for a description of how these work.
-    ///
-    /// @param[out] word_complete
-    ///     \btrue if this is a complete option value (a space will be inserted after the
-    ///     completion.)  \bfalse otherwise.
-    ///
-    /// @param[out] matches
-    ///     The array of matches returned.
-    ///
-    /// FIXME: This is the wrong return value, since we also need to make a distinction between
-    /// total number of matches, and the window the user wants returned.
-    ///
-    /// @return
-    ///     The number of completions.
-    //------------------------------------------------------------------
-    virtual int
-    HandleArgumentCompletion (Args &input,
-                              int &cursor_index,
-                              int &cursor_char_position,
-                              OptionElementVector &opt_element_vector,
-                              int match_start_point,
-                              int max_return_elements,
-                              bool &word_complete,
-                              StringList &matches)
-    {
-        return 0;
-    }
-    
-    bool
-    HelpTextContainsWord (const char *search_word,
-                          bool search_short_help = true,
-                          bool search_long_help = true,
-                          bool search_syntax = true,
-                          bool search_options = true);
-
-    //------------------------------------------------------------------
-    /// The flags accessor.
-    ///
-    /// @return
-    ///     A reference to the Flags member variable.
-    //------------------------------------------------------------------
-    Flags&
-    GetFlags()
-    {
-        return m_flags;
-    }
+class CommandObjectParsed : public CommandObject {
+public:
+  CommandObjectParsed(CommandInterpreter &interpreter, const char *name,
+                      const char *help = nullptr, const char *syntax = nullptr,
+                      uint32_t flags = 0)
+      : CommandObject(interpreter, name, help, syntax, flags) {}
 
-    //------------------------------------------------------------------
-    /// The flags const accessor.
-    ///
-    /// @return
-    ///     A const reference to the Flags member variable.
-    //------------------------------------------------------------------
-    const Flags&
-    GetFlags() const
-    {
-        return m_flags;
-    }
-    
-    //------------------------------------------------------------------
-    /// Get the command that appropriate for a "repeat" of the current command.
-    ///
-    /// @param[in] current_command_line
-    ///    The complete current command line.
-    ///
-    /// @return
-    ///     nullptr if there is no special repeat command - it will use the current command line.
-    ///     Otherwise a pointer to the command to be repeated.
-    ///     If the returned string is the empty string, the command won't be repeated.    
-    //------------------------------------------------------------------
-    virtual const char *GetRepeatCommand (Args &current_command_args, uint32_t index)
-    {
-        return nullptr;
-    }
+  ~CommandObjectParsed() override = default;
 
-    bool
-    HasOverrideCallback () const
-    {
-        return m_command_override_callback || m_deprecated_command_override_callback;
-    }
-    
-    void
-    SetOverrideCallback (lldb::CommandOverrideCallback callback, void *baton)
-    {
-        m_deprecated_command_override_callback = callback;
-        m_command_override_baton = baton;
-    }
-    
-    void
-    SetOverrideCallback (lldb::CommandOverrideCallbackWithResult callback, void *baton)
-    {
-        m_command_override_callback = callback;
-        m_command_override_baton = baton;
-    }
-    
-    bool
-    InvokeOverrideCallback (const char **argv, CommandReturnObject &result)
-    {
-        if (m_command_override_callback)
-            return m_command_override_callback(m_command_override_baton, argv, result);
-        else if (m_deprecated_command_override_callback)
-            return m_deprecated_command_override_callback(m_command_override_baton, argv);
-        else
-            return false;
-    }
-    
-    virtual bool
-    Execute (const char *args_string, CommandReturnObject &result) = 0;
+  bool Execute(const char *args_string, CommandReturnObject &result) override;
 
 protected:
-    virtual const char *
-    GetInvalidTargetDescription()
-    {
-        return "invalid target, create a target using the 'target create' command";
-    }
-
-    virtual const char *
-    GetInvalidProcessDescription()
-    {
-        return "invalid process";
-    }
+  virtual bool DoExecute(Args &command, CommandReturnObject &result) = 0;
 
-    virtual const char *
-    GetInvalidThreadDescription()
-    {
-        return "invalid thread";
-    }
-    
-    virtual const char *
-    GetInvalidFrameDescription()
-    {
-        return "invalid frame";
-    }
-    
-    virtual const char *
-    GetInvalidRegContextDescription ()
-    {
-        return "invalid frame, no registers";
-    }
-
-    // This is for use in the command interpreter, when you either want the selected target, or if no target
-    // is present you want to prime the dummy target with entities that will be copied over to new targets.
-    Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
-    Target *GetDummyTarget();
-    
-    // If a command needs to use the "current" thread, use this call.
-    // Command objects will have an ExecutionContext to use, and that may or may not have a thread in it.  If it
-    // does, you should use that by default, if not, then use the ExecutionContext's target's selected thread, etc...
-    // This call insulates you from the details of this calculation.
-    Thread *GetDefaultThread();
-
-    //------------------------------------------------------------------
-    /// Check the command to make sure anything required by this
-    /// command is available.
-    ///
-    /// @param[out] result
-    ///     A command result object, if it is not okay to run the command
-    ///     this will be filled in with a suitable error.
-    ///
-    /// @return
-    ///     \b true if it is okay to run this command, \b false otherwise.
-    //------------------------------------------------------------------
-    bool
-    CheckRequirements (CommandReturnObject &result);
-    
-    void
-    Cleanup ();
-
-    CommandInterpreter &m_interpreter;
-    ExecutionContext m_exe_ctx;
-    std::unique_lock<std::recursive_mutex> m_api_locker;
-    std::string m_cmd_name;
-    std::string m_cmd_help_short;
-    std::string m_cmd_help_long;
-    std::string m_cmd_syntax;
-    Flags m_flags;
-    std::vector<CommandArgumentEntry> m_arguments;
-    lldb::CommandOverrideCallback m_deprecated_command_override_callback;
-    lldb::CommandOverrideCallbackWithResult m_command_override_callback;
-    void * m_command_override_baton;
-    
-    // Helper function to populate IDs or ID ranges as the command argument data
-    // to the specified command argument entry.
-    static void
-    AddIDsArgumentData(CommandArgumentEntry &arg, lldb::CommandArgumentType ID, lldb::CommandArgumentType IDRange);
+  bool WantsRawCommandString() override { return false; }
 };
 
-class CommandObjectParsed : public CommandObject
-{
+class CommandObjectRaw : public CommandObject {
 public:
-    CommandObjectParsed(CommandInterpreter &interpreter,
-                        const char *name,
-                        const char *help = nullptr,
-                        const char *syntax = nullptr,
-                        uint32_t flags = 0) :
-        CommandObject (interpreter, name, help, syntax, flags) {}
-
-    ~CommandObjectParsed() override = default;
-    
-    bool
-    Execute(const char *args_string, CommandReturnObject &result) override;
-    
+  CommandObjectRaw(CommandInterpreter &interpreter, const char *name,
+                   const char *help = nullptr, const char *syntax = nullptr,
+                   uint32_t flags = 0)
+      : CommandObject(interpreter, name, help, syntax, flags) {}
+
+  ~CommandObjectRaw() override = default;
+
+  bool Execute(const char *args_string, CommandReturnObject &result) override;
+
 protected:
-    virtual bool
-    DoExecute (Args& command,
-             CommandReturnObject &result) = 0;
-    
-    bool
-    WantsRawCommandString() override
-    {
-        return false;
-    }
-};
+  virtual bool DoExecute(const char *command, CommandReturnObject &result) = 0;
 
-class CommandObjectRaw : public CommandObject
-{
-public:
-    CommandObjectRaw(CommandInterpreter &interpreter,
-                     const char *name,
-                     const char *help = nullptr,
-                     const char *syntax = nullptr,
-                     uint32_t flags = 0) :
-        CommandObject (interpreter, name, help, syntax, flags) {}
-
-    ~CommandObjectRaw() override = default;
-    
-    bool
-    Execute(const char *args_string, CommandReturnObject &result) override;
-
-protected:    
-    virtual bool
-    DoExecute (const char *command, CommandReturnObject &result) = 0;
-
-    bool
-    WantsRawCommandString() override
-    {
-        return true;
-    }
+  bool WantsRawCommandString() override { return true; }
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h Tue Sep  6 15:57:50 2016
@@ -22,183 +22,124 @@ namespace lldb_private {
 // CommandObjectMultiword
 //-------------------------------------------------------------------------
 
-class CommandObjectMultiword : public CommandObject
-{
-// These two want to iterate over the subcommand dictionary.
-friend class CommandInterpreter;
-friend class CommandObjectSyntax;
+class CommandObjectMultiword : public CommandObject {
+  // These two want to iterate over the subcommand dictionary.
+  friend class CommandInterpreter;
+  friend class CommandObjectSyntax;
+
 public:
-    CommandObjectMultiword(CommandInterpreter &interpreter,
-                           const char *name,
-                           const char *help = nullptr,
-                           const char *syntax = nullptr,
-                           uint32_t flags = 0);
-    
-    ~CommandObjectMultiword() override;
-
-    bool
-    IsMultiwordObject() override
-    {
-        return true;
-    }
-    
-    CommandObjectMultiword*
-    GetAsMultiwordCommand () override
-    {
-        return this;
-    }
-
-    bool
-    LoadSubCommand(const char *cmd_name,
-                   const lldb::CommandObjectSP& command_obj) override;
-
-    void
-    GenerateHelpText(Stream &output_stream) override;
-
-    lldb::CommandObjectSP
-    GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override;
-
-    CommandObject *
-    GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override;
-
-    void
-    AproposAllSubCommands(const char *prefix,
-                          const char *search_word,
-                          StringList &commands_found,
-                          StringList &commands_help) override;
-
-    bool
-    WantsRawCommandString() override
-    {
-        return false;
-    }
-
-    int
-    HandleCompletion(Args &input,
-                     int &cursor_index,
-                     int &cursor_char_position,
-                     int match_start_point,
-                     int max_return_elements,
-                     bool &word_complete,
-                     StringList &matches) override;
-
-    const char *
-    GetRepeatCommand (Args &current_command_args, uint32_t index) override;
-
-    bool
-    Execute(const char *args_string,
-            CommandReturnObject &result) override;
-    
-    bool
-    IsRemovable() const override
-    {
-        return m_can_be_removed;
-    }
-    
-    void
-    SetRemovable (bool removable)
-    {
-        m_can_be_removed = removable;
-    }
-    
+  CommandObjectMultiword(CommandInterpreter &interpreter, const char *name,
+                         const char *help = nullptr,
+                         const char *syntax = nullptr, uint32_t flags = 0);
+
+  ~CommandObjectMultiword() override;
+
+  bool IsMultiwordObject() override { return true; }
+
+  CommandObjectMultiword *GetAsMultiwordCommand() override { return this; }
+
+  bool LoadSubCommand(const char *cmd_name,
+                      const lldb::CommandObjectSP &command_obj) override;
+
+  void GenerateHelpText(Stream &output_stream) override;
+
+  lldb::CommandObjectSP GetSubcommandSP(const char *sub_cmd,
+                                        StringList *matches = nullptr) override;
+
+  CommandObject *GetSubcommandObject(const char *sub_cmd,
+                                     StringList *matches = nullptr) override;
+
+  void AproposAllSubCommands(const char *prefix, const char *search_word,
+                             StringList &commands_found,
+                             StringList &commands_help) override;
+
+  bool WantsRawCommandString() override { return false; }
+
+  int HandleCompletion(Args &input, int &cursor_index,
+                       int &cursor_char_position, int match_start_point,
+                       int max_return_elements, bool &word_complete,
+                       StringList &matches) override;
+
+  const char *GetRepeatCommand(Args &current_command_args,
+                               uint32_t index) override;
+
+  bool Execute(const char *args_string, CommandReturnObject &result) override;
+
+  bool IsRemovable() const override { return m_can_be_removed; }
+
+  void SetRemovable(bool removable) { m_can_be_removed = removable; }
+
 protected:
-    CommandObject::CommandMap&
-    GetSubcommandDictionary ()
-    {
-        return m_subcommand_dict;
-    }
+  CommandObject::CommandMap &GetSubcommandDictionary() {
+    return m_subcommand_dict;
+  }
 
-    CommandObject::CommandMap m_subcommand_dict;
-    bool m_can_be_removed;
+  CommandObject::CommandMap m_subcommand_dict;
+  bool m_can_be_removed;
 };
-    
-class CommandObjectProxy : public CommandObject
-{
+
+class CommandObjectProxy : public CommandObject {
 public:
-    CommandObjectProxy(CommandInterpreter &interpreter,
-                       const char *name,
-                       const char *help = nullptr,
-                       const char *syntax = nullptr,
-                       uint32_t flags = 0);
-    
-    ~CommandObjectProxy() override;
-    
-    // Subclasses must provide a command object that will be transparently
-    // used for this object.
-    virtual CommandObject *
-    GetProxyCommandObject() = 0;
-
-    const char *
-    GetHelpLong() override;
-    
-    bool
-    IsRemovable() const override;
-
-    bool
-    IsMultiwordObject() override;
-    
-    CommandObjectMultiword*
-    GetAsMultiwordCommand () override;
-    
-    void
-    GenerateHelpText (Stream &result) override;
-    
-    lldb::CommandObjectSP
-    GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override;
-    
-    CommandObject *
-    GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override;
-    
-    void
-    AproposAllSubCommands(const char *prefix,
-                          const char *search_word,
-                          StringList &commands_found,
-                          StringList &commands_help) override;
-
-    bool
-    LoadSubCommand(const char *cmd_name,
-                   const lldb::CommandObjectSP& command_obj) override;
-    
-    bool
-    WantsRawCommandString() override;
-    
-    bool
-    WantsCompletion() override;
-    
-    Options *
-    GetOptions() override;
-
-    int
-    HandleCompletion(Args &input,
-                     int &cursor_index,
-                     int &cursor_char_position,
-                     int match_start_point,
-                     int max_return_elements,
-                     bool &word_complete,
-                     StringList &matches) override;
-
-    int
-    HandleArgumentCompletion(Args &input,
-                             int &cursor_index,
-                             int &cursor_char_position,
-                             OptionElementVector &opt_element_vector,
-                             int match_start_point,
-                             int max_return_elements,
-                             bool &word_complete,
-                             StringList &matches) override;
-
-    const char *
-    GetRepeatCommand(Args &current_command_args,
-                     uint32_t index) override;
-
-    bool
-    Execute(const char *args_string,
-            CommandReturnObject &result) override;
+  CommandObjectProxy(CommandInterpreter &interpreter, const char *name,
+                     const char *help = nullptr, const char *syntax = nullptr,
+                     uint32_t flags = 0);
+
+  ~CommandObjectProxy() override;
+
+  // Subclasses must provide a command object that will be transparently
+  // used for this object.
+  virtual CommandObject *GetProxyCommandObject() = 0;
+
+  const char *GetHelpLong() override;
+
+  bool IsRemovable() const override;
+
+  bool IsMultiwordObject() override;
+
+  CommandObjectMultiword *GetAsMultiwordCommand() override;
+
+  void GenerateHelpText(Stream &result) override;
+
+  lldb::CommandObjectSP GetSubcommandSP(const char *sub_cmd,
+                                        StringList *matches = nullptr) override;
+
+  CommandObject *GetSubcommandObject(const char *sub_cmd,
+                                     StringList *matches = nullptr) override;
+
+  void AproposAllSubCommands(const char *prefix, const char *search_word,
+                             StringList &commands_found,
+                             StringList &commands_help) override;
+
+  bool LoadSubCommand(const char *cmd_name,
+                      const lldb::CommandObjectSP &command_obj) override;
+
+  bool WantsRawCommandString() override;
+
+  bool WantsCompletion() override;
+
+  Options *GetOptions() override;
+
+  int HandleCompletion(Args &input, int &cursor_index,
+                       int &cursor_char_position, int match_start_point,
+                       int max_return_elements, bool &word_complete,
+                       StringList &matches) override;
+
+  int HandleArgumentCompletion(Args &input, int &cursor_index,
+                               int &cursor_char_position,
+                               OptionElementVector &opt_element_vector,
+                               int match_start_point, int max_return_elements,
+                               bool &word_complete,
+                               StringList &matches) override;
+
+  const char *GetRepeatCommand(Args &current_command_args,
+                               uint32_t index) override;
+
+  bool Execute(const char *args_string, CommandReturnObject &result) override;
 
 protected:
-    // These two want to iterate over the subcommand dictionary.
-    friend class CommandInterpreter;
-    friend class CommandObjectSyntax;
+  // These two want to iterate over the subcommand dictionary.
+  friend class CommandInterpreter;
+  friend class CommandObjectSyntax;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h Tue Sep  6 15:57:50 2016
@@ -25,58 +25,42 @@ namespace lldb_private {
 // CommandObjectRegexCommand
 //-------------------------------------------------------------------------
 
-class CommandObjectRegexCommand : public CommandObjectRaw
-{
+class CommandObjectRegexCommand : public CommandObjectRaw {
 public:
-    CommandObjectRegexCommand (CommandInterpreter &interpreter,
-                               const char *name, 
-                               const char *help, 
-                               const char *syntax, 
-                               uint32_t max_matches,
-                               uint32_t completion_type_mask,
-                               bool is_removable);
-    
-    ~CommandObjectRegexCommand() override;
-
-    bool
-    IsRemovable () const override { return m_is_removable; }
-
-    bool
-    AddRegexCommand (const char *re_cstr, const char *command_cstr);
-
-    bool
-    HasRegexEntries () const
-    {
-        return !m_entries.empty();
-    }
-    
-    int
-    HandleCompletion (Args &input,
-                      int &cursor_index,
-                      int &cursor_char_position,
-                      int match_start_point,
-                      int max_return_elements,
-                      bool &word_complete,
-                      StringList &matches) override;
+  CommandObjectRegexCommand(CommandInterpreter &interpreter, const char *name,
+                            const char *help, const char *syntax,
+                            uint32_t max_matches, uint32_t completion_type_mask,
+                            bool is_removable);
+
+  ~CommandObjectRegexCommand() override;
+
+  bool IsRemovable() const override { return m_is_removable; }
+
+  bool AddRegexCommand(const char *re_cstr, const char *command_cstr);
+
+  bool HasRegexEntries() const { return !m_entries.empty(); }
+
+  int HandleCompletion(Args &input, int &cursor_index,
+                       int &cursor_char_position, int match_start_point,
+                       int max_return_elements, bool &word_complete,
+                       StringList &matches) override;
 
 protected:
-    bool
-    DoExecute (const char *command, CommandReturnObject &result) override;
+  bool DoExecute(const char *command, CommandReturnObject &result) override;
 
-    struct Entry
-    {
-        RegularExpression regex;
-        std::string command;
-    };
-
-    typedef std::list<Entry> EntryCollection;
-    const uint32_t m_max_matches;
-    const uint32_t m_completion_type_mask;
-    EntryCollection m_entries;
-    bool m_is_removable;
+  struct Entry {
+    RegularExpression regex;
+    std::string command;
+  };
+
+  typedef std::list<Entry> EntryCollection;
+  const uint32_t m_max_matches;
+  const uint32_t m_completion_type_mask;
+  EntryCollection m_entries;
+  bool m_is_removable;
 
 private:
-    DISALLOW_COPY_AND_ASSIGN (CommandObjectRegexCommand);
+  DISALLOW_COPY_AND_ASSIGN(CommandObjectRegexCommand);
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Interpreter/CommandOptionValidators.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandOptionValidators.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandOptionValidators.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandOptionValidators.h Tue Sep  6 15:57:50 2016
@@ -21,11 +21,11 @@ namespace lldb_private {
 class Platform;
 class ExecutionContext;
 
-class PosixPlatformCommandOptionValidator : public OptionValidator
-{
-    bool IsValid(Platform &platform, const ExecutionContext &target) const override;
-    const char* ShortConditionString() const override;
-    const char* LongConditionString() const override;
+class PosixPlatformCommandOptionValidator : public OptionValidator {
+  bool IsValid(Platform &platform,
+               const ExecutionContext &target) const override;
+  const char *ShortConditionString() const override;
+  const char *LongConditionString() const override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h Tue Sep  6 15:57:50 2016
@@ -14,193 +14,148 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Core/STLUtils.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/StreamTee.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
 
-class CommandReturnObject
-{
+class CommandReturnObject {
 public:
-    CommandReturnObject ();
-    
-    ~CommandReturnObject ();
-
-    const char *
-    GetOutputData ()
-    {
-        lldb::StreamSP stream_sp (m_out_stream.GetStreamAtIndex (eStreamStringIndex));
-        if (stream_sp)
-            return static_cast<StreamString *>(stream_sp.get())->GetData();
-        return "";
-    }
+  CommandReturnObject();
 
-    const char *
-    GetErrorData ()
-    {
-        lldb::StreamSP stream_sp (m_err_stream.GetStreamAtIndex (eStreamStringIndex));
-        if (stream_sp)
-            return static_cast<StreamString *>(stream_sp.get())->GetData();
-        else
-            return "";
-    }
+  ~CommandReturnObject();
 
-    Stream &
-    GetOutputStream ()
-    {
-        // Make sure we at least have our normal string stream output stream
-        lldb::StreamSP stream_sp (m_out_stream.GetStreamAtIndex (eStreamStringIndex));
-        if (!stream_sp)
-        {
-            stream_sp.reset (new StreamString());
-            m_out_stream.SetStreamAtIndex (eStreamStringIndex, stream_sp);
-        }   
-        return m_out_stream;
-    }
+  const char *GetOutputData() {
+    lldb::StreamSP stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex));
+    if (stream_sp)
+      return static_cast<StreamString *>(stream_sp.get())->GetData();
+    return "";
+  }
 
-    Stream &
-    GetErrorStream ()
-    {
-        // Make sure we at least have our normal string stream output stream
-        lldb::StreamSP stream_sp (m_err_stream.GetStreamAtIndex (eStreamStringIndex));
-        if (!stream_sp)
-        {
-            stream_sp.reset (new StreamString());
-            m_err_stream.SetStreamAtIndex (eStreamStringIndex, stream_sp);
-        }   
-        return m_err_stream;
-    }
+  const char *GetErrorData() {
+    lldb::StreamSP stream_sp(m_err_stream.GetStreamAtIndex(eStreamStringIndex));
+    if (stream_sp)
+      return static_cast<StreamString *>(stream_sp.get())->GetData();
+    else
+      return "";
+  }
 
-    void
-    SetImmediateOutputFile (FILE *fh, bool transfer_fh_ownership = false)
-    {
-        lldb::StreamSP stream_sp (new StreamFile (fh, transfer_fh_ownership));
-        m_out_stream.SetStreamAtIndex (eImmediateStreamIndex, stream_sp);
-    }
-    
-    void
-    SetImmediateErrorFile (FILE *fh, bool transfer_fh_ownership = false)
-    {
-        lldb::StreamSP stream_sp (new StreamFile (fh, transfer_fh_ownership));
-        m_err_stream.SetStreamAtIndex (eImmediateStreamIndex, stream_sp);
+  Stream &GetOutputStream() {
+    // Make sure we at least have our normal string stream output stream
+    lldb::StreamSP stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex));
+    if (!stream_sp) {
+      stream_sp.reset(new StreamString());
+      m_out_stream.SetStreamAtIndex(eStreamStringIndex, stream_sp);
     }
-    
-    void
-    SetImmediateOutputStream (const lldb::StreamSP &stream_sp)
-    {
-        m_out_stream.SetStreamAtIndex (eImmediateStreamIndex, stream_sp);
-    }
-    
-    void
-    SetImmediateErrorStream (const lldb::StreamSP &stream_sp)
-    {
-        m_err_stream.SetStreamAtIndex (eImmediateStreamIndex, stream_sp);
-    }
-    
-    lldb::StreamSP
-    GetImmediateOutputStream ()
-    {
-        return m_out_stream.GetStreamAtIndex (eImmediateStreamIndex);
-    }
-    
-    lldb::StreamSP
-    GetImmediateErrorStream ()
-    {
-        return m_err_stream.GetStreamAtIndex (eImmediateStreamIndex);
+    return m_out_stream;
+  }
+
+  Stream &GetErrorStream() {
+    // Make sure we at least have our normal string stream output stream
+    lldb::StreamSP stream_sp(m_err_stream.GetStreamAtIndex(eStreamStringIndex));
+    if (!stream_sp) {
+      stream_sp.reset(new StreamString());
+      m_err_stream.SetStreamAtIndex(eStreamStringIndex, stream_sp);
     }
-    
-    void
-    Clear();
+    return m_err_stream;
+  }
 
-    void
-    AppendMessage (const char *in_string);
+  void SetImmediateOutputFile(FILE *fh, bool transfer_fh_ownership = false) {
+    lldb::StreamSP stream_sp(new StreamFile(fh, transfer_fh_ownership));
+    m_out_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
+  }
 
-    void
-    AppendMessageWithFormat (const char *format, ...)  __attribute__ ((format (printf, 2, 3)));
+  void SetImmediateErrorFile(FILE *fh, bool transfer_fh_ownership = false) {
+    lldb::StreamSP stream_sp(new StreamFile(fh, transfer_fh_ownership));
+    m_err_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
+  }
 
-    void
-    AppendRawWarning (const char *in_string);
+  void SetImmediateOutputStream(const lldb::StreamSP &stream_sp) {
+    m_out_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
+  }
 
-    void
-    AppendWarning (const char *in_string);
+  void SetImmediateErrorStream(const lldb::StreamSP &stream_sp) {
+    m_err_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
+  }
 
-    void
-    AppendWarningWithFormat (const char *format, ...)  __attribute__ ((format (printf, 2, 3)));
+  lldb::StreamSP GetImmediateOutputStream() {
+    return m_out_stream.GetStreamAtIndex(eImmediateStreamIndex);
+  }
 
-    void
-    AppendError (const char *in_string);
+  lldb::StreamSP GetImmediateErrorStream() {
+    return m_err_stream.GetStreamAtIndex(eImmediateStreamIndex);
+  }
 
-    void
-    AppendRawError (const char *in_string);
+  void Clear();
 
-    void
-    AppendErrorWithFormat (const char *format, ...)  __attribute__ ((format (printf, 2, 3)));
+  void AppendMessage(const char *in_string);
 
-    void
-    SetError(const Error &error,
-             const char *fallback_error_cstr = nullptr);
-    
-    void
-    SetError (const char *error_cstr);
+  void AppendMessageWithFormat(const char *format, ...)
+      __attribute__((format(printf, 2, 3)));
 
-    lldb::ReturnStatus
-    GetStatus();
+  void AppendRawWarning(const char *in_string);
 
-    void
-    SetStatus (lldb::ReturnStatus status);
+  void AppendWarning(const char *in_string);
 
-    bool
-    Succeeded ();
+  void AppendWarningWithFormat(const char *format, ...)
+      __attribute__((format(printf, 2, 3)));
 
-    bool
-    HasResult ();
+  void AppendError(const char *in_string);
 
-    bool
-    GetDidChangeProcessState ();
+  void AppendRawError(const char *in_string);
 
-    void
-    SetDidChangeProcessState (bool b);
+  void AppendErrorWithFormat(const char *format, ...)
+      __attribute__((format(printf, 2, 3)));
 
-    bool
-    GetInteractive () const;
-    
-    void
-    SetInteractive (bool b);
-    
-    bool
-    GetAbnormalStopWasExpected() const
-    {
-        return m_abnormal_stop_was_expected;
-    }
-    
-    void
-    SetAbnormalStopWasExpected(bool signal_was_expected)
-    {
-        m_abnormal_stop_was_expected = signal_was_expected;
-    }
+  void SetError(const Error &error, const char *fallback_error_cstr = nullptr);
+
+  void SetError(const char *error_cstr);
+
+  lldb::ReturnStatus GetStatus();
+
+  void SetStatus(lldb::ReturnStatus status);
+
+  bool Succeeded();
+
+  bool HasResult();
+
+  bool GetDidChangeProcessState();
+
+  void SetDidChangeProcessState(bool b);
+
+  bool GetInteractive() const;
+
+  void SetInteractive(bool b);
+
+  bool GetAbnormalStopWasExpected() const {
+    return m_abnormal_stop_was_expected;
+  }
+
+  void SetAbnormalStopWasExpected(bool signal_was_expected) {
+    m_abnormal_stop_was_expected = signal_was_expected;
+  }
 
 private:
-    enum 
-    {
-        eStreamStringIndex = 0,
-        eImmediateStreamIndex = 1
-    };
-    
-    StreamTee    m_out_stream;
-    StreamTee    m_err_stream;
-    
-    lldb::ReturnStatus m_status;
-    bool m_did_change_process_state;
-    bool m_interactive;          // If true, then the input handle from the debugger will be hooked up
-    bool m_abnormal_stop_was_expected;  // This is to support eHandleCommandFlagStopOnCrash vrs. attach.
-                                        // The attach command often ends up with the process stopped due to a signal.
-                                        // Normally that would mean stop on crash should halt batch execution, but we
-                                        // obviously don't want that for attach.  Using this flag, the attach command
-                                        // (and anything else for which this is relevant) can say that the signal is
-                                        // expected, and batch command execution can continue.
+  enum { eStreamStringIndex = 0, eImmediateStreamIndex = 1 };
+
+  StreamTee m_out_stream;
+  StreamTee m_err_stream;
+
+  lldb::ReturnStatus m_status;
+  bool m_did_change_process_state;
+  bool m_interactive; // If true, then the input handle from the debugger will
+                      // be hooked up
+  bool m_abnormal_stop_was_expected; // This is to support
+                                     // eHandleCommandFlagStopOnCrash vrs.
+                                     // attach.
+  // The attach command often ends up with the process stopped due to a signal.
+  // Normally that would mean stop on crash should halt batch execution, but we
+  // obviously don't want that for attach.  Using this flag, the attach command
+  // (and anything else for which this is relevant) can say that the signal is
+  // expected, and batch command execution can continue.
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h Tue Sep  6 15:57:50 2016
@@ -14,8 +14,8 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Interpreter/Options.h"
 #include "lldb/Core/ArchSpec.h"
+#include "lldb/Interpreter/Options.h"
 
 namespace lldb_private {
 
@@ -23,44 +23,32 @@ namespace lldb_private {
 // OptionGroupArchitecture
 //-------------------------------------------------------------------------
 
-class OptionGroupArchitecture : public OptionGroup
-{
+class OptionGroupArchitecture : public OptionGroup {
 public:
-    OptionGroupArchitecture ();
-    
-    ~OptionGroupArchitecture() override;
-
-    uint32_t
-    GetNumDefinitions() override;
-    
-    const OptionDefinition*
-    GetDefinitions() override;
-    
-    Error
-    SetOptionValue(uint32_t option_idx,
-                   const char *option_value,
-                   ExecutionContext *execution_context) override;
-    
-    void
-    OptionParsingStarting(ExecutionContext *execution_context) override;
-    
-    bool
-    GetArchitecture (Platform *platform, ArchSpec &arch);
-
-    bool
-    ArchitectureWasSpecified () const
-    {
-        return !m_arch_str.empty();
-    }
-
-    const char *
-    GetArchitectureName()
-    {
-        return (m_arch_str.empty() ? nullptr : m_arch_str.c_str());
-    }
+  OptionGroupArchitecture();
+
+  ~OptionGroupArchitecture() override;
+
+  uint32_t GetNumDefinitions() override;
+
+  const OptionDefinition *GetDefinitions() override;
+
+  Error SetOptionValue(uint32_t option_idx, const char *option_value,
+                       ExecutionContext *execution_context) override;
+
+  void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+  bool GetArchitecture(Platform *platform, ArchSpec &arch);
+
+  bool ArchitectureWasSpecified() const { return !m_arch_str.empty(); }
+
+  const char *GetArchitectureName() {
+    return (m_arch_str.empty() ? nullptr : m_arch_str.c_str());
+  }
 
 protected:
-    std::string m_arch_str; // Save the arch triple in case a platform is specified after the architecture
+  std::string m_arch_str; // Save the arch triple in case a platform is
+                          // specified after the architecture
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h Tue Sep  6 15:57:50 2016
@@ -14,66 +14,45 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Interpreter/Options.h"
 #include "lldb/Interpreter/OptionValueBoolean.h"
+#include "lldb/Interpreter/Options.h"
 
 namespace lldb_private {
-    //-------------------------------------------------------------------------
-    // OptionGroupBoolean
-    //-------------------------------------------------------------------------
-    
-    class OptionGroupBoolean : public OptionGroup
-    {
-    public:
-         // When 'no_argument_toggle_default' is true, then setting the option
-         // value does NOT require an argument, it sets the boolean value to the
-         // inverse of the default value
-        OptionGroupBoolean (uint32_t usage_mask,
-                            bool required,
-                            const char *long_option, 
-                            int short_option,
-                            const char *usage_text,
-                            bool default_value,
-                            bool no_argument_toggle_default);
-        
-        ~OptionGroupBoolean() override;
-
-        uint32_t
-        GetNumDefinitions() override
-        {
-            return 1;
-        }
-        
-        const OptionDefinition*
-        GetDefinitions() override
-        {
-            return &m_option_definition;
-        }
-        
-        Error
-        SetOptionValue(uint32_t option_idx,
-                       const char *option_value,
+//-------------------------------------------------------------------------
+// OptionGroupBoolean
+//-------------------------------------------------------------------------
+
+class OptionGroupBoolean : public OptionGroup {
+public:
+  // When 'no_argument_toggle_default' is true, then setting the option
+  // value does NOT require an argument, it sets the boolean value to the
+  // inverse of the default value
+  OptionGroupBoolean(uint32_t usage_mask, bool required,
+                     const char *long_option, int short_option,
+                     const char *usage_text, bool default_value,
+                     bool no_argument_toggle_default);
+
+  ~OptionGroupBoolean() override;
+
+  uint32_t GetNumDefinitions() override { return 1; }
+
+  const OptionDefinition *GetDefinitions() override {
+    return &m_option_definition;
+  }
+
+  Error SetOptionValue(uint32_t option_idx, const char *option_value,
                        ExecutionContext *execution_context) override;
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override;
-        
-        OptionValueBoolean &
-        GetOptionValue ()
-        {
-            return m_value;
-        }
-        
-        const OptionValueBoolean &
-        GetOptionValue () const
-        {
-            return m_value;
-        }
-        
-    protected:
-        OptionValueBoolean m_value;
-        OptionDefinition m_option_definition;
-    };
+
+  void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+  OptionValueBoolean &GetOptionValue() { return m_value; }
+
+  const OptionValueBoolean &GetOptionValue() const { return m_value; }
+
+protected:
+  OptionValueBoolean m_value;
+  OptionDefinition m_option_definition;
+};
 
 } // namespace lldb_private
 




More information about the lldb-commits mailing list