[Lldb-commits] [lldb] r238280 - Allow clients to get parsing errors and also fix the ApplePropertyList so it parses the structured data correctly.

Greg Clayton gclayton at apple.com
Tue May 26 20:24:17 PDT 2015


Author: gclayton
Date: Tue May 26 22:24:17 2015
New Revision: 238280

URL: http://llvm.org/viewvc/llvm-project?rev=238280&view=rev
Log:
Allow clients to get parsing errors and also fix the ApplePropertyList so it parses the structured data correctly.


Modified:
    lldb/trunk/include/lldb/Host/XML.h
    lldb/trunk/source/Host/common/XML.cpp

Modified: lldb/trunk/include/lldb/Host/XML.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/XML.h?rev=238280&r1=238279&r2=238280&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/XML.h (original)
+++ lldb/trunk/include/lldb/Host/XML.h Tue May 26 22:24:17 2015
@@ -168,6 +168,9 @@ namespace lldb_private {
         //----------------------------------------------------------------------
         XMLNode
         GetRootElement(const char *required_name = nullptr);
+
+        const std::string &
+        GetErrors() const;
         
         static void
         ErrorCallback (void *ctx, const char *format, ...);
@@ -187,9 +190,14 @@ namespace lldb_private {
 
         ApplePropertyList(const char *path);
 
+        ~ApplePropertyList();
+
         bool
         ParseFile (const char *path);
 
+        const std::string &
+        GetErrors() const;
+        
         explicit operator bool() const
         {
             return IsValid();

Modified: lldb/trunk/source/Host/common/XML.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/XML.cpp?rev=238280&r1=238279&r2=238280&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/XML.cpp (original)
+++ lldb/trunk/source/Host/common/XML.cpp Tue May 26 22:24:17 2015
@@ -105,6 +105,12 @@ XMLDocument::GetRootElement(const char *
     return XMLNode();
 }
 
+const std::string &
+XMLDocument::GetErrors() const
+{
+    return m_errors.GetString();
+}
+
 bool
 XMLDocument::XMLEnabled ()
 {
@@ -504,6 +510,17 @@ ApplePropertyList::ApplePropertyList (co
     ParseFile(path);
 }
 
+ApplePropertyList::~ApplePropertyList()
+{
+}
+
+const std::string &
+ApplePropertyList::GetErrors() const
+{
+    return m_xml_doc.GetErrors();
+}
+
+
 bool
 ApplePropertyList::ParseFile (const char *path)
 {
@@ -619,7 +636,9 @@ namespace {
                     // This is a value node
                     if (key_node)
                     {
-                        dict_sp->AddItem(key_node.GetName(), CreatePlistValue(node));
+                        std::string key_name;
+                        key_node.GetElementText(key_name);
+                        dict_sp->AddItem(key_name, CreatePlistValue(node));
                         key_node.Clear();
                     }
                 }
@@ -639,7 +658,7 @@ namespace {
             node.GetElementTextAsUnsigned(value, 0, 0);
             return StructuredData::ObjectSP(new StructuredData::Integer(value));
         }
-        else if ((element_name == "string") || (element_name == "data"))
+        else if ((element_name == "string") || (element_name == "data") || (element_name == "date"))
         {
             std::string text;
             node.GetElementText(text);





More information about the lldb-commits mailing list