I am not done here.
Also, even once I am done, all that you will be able to see here is no 
regressions in existing functionality.

I am plumbing through a set of facilities that I need in order to make certain 
parts of data formatting logic Language-plugin based.

That is required to make it easier to support new source languages in a clean 
fashion.

Since the C++ and ObjC support is already there, there will be no (unintended) 
change in functionality. What you want to see here testing-wise is the lack of 
any regression for existing languages.

The benefits are to be reaped if you were to add support for a new source 
language, which then would require its own testing, ..., but I plan to do no 
such thing at the moment.

tl;dr existing tests cover this already; this is refactoring work

Sent from my iPhone

> On Oct 6, 2015, at 9:20 PM, Zachary Turner <ztur...@google.com> wrote:
> 
> Actually upon further inspection it looks like the test that was updated was 
> not really anything new, but an update of an existing test to pass a new 
> argument through.
> 
> Can you add some tests that test this specific functionality?
> 
>> On Tue, Oct 6, 2015 at 9:09 PM Zachary Turner <ztur...@google.com> wrote:
>> It looks like there's only 1 test added for all of this functionality from 
>> this and the last few commits, and that the test is specific to Objective C. 
>>  The functionality itself seems language agnostic though.  Is there any way 
>> to write a test that does not rely on a particular language?  That would 
>> improve the test coverage of this functionality.
>> 
>>> On Tue, Oct 6, 2015 at 7:38 PM Enrico Granata via lldb-commits 
>>> <lldb-commits@lists.llvm.org> wrote:
>>> Author: enrico
>>> Date: Tue Oct  6 21:36:35 2015
>>> New Revision: 249507
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=249507&view=rev
>>> Log:
>>> Route the preferred-display-language mechanism to the ValueObjectPrinter 
>>> and actually fill in a few gaps for dynamic and synthetic values to be able 
>>> to adopt this in useful ways
>>> 
>>> 
>>> Modified:
>>>     lldb/trunk/include/lldb/Core/ValueObject.h
>>>     lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
>>>     lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
>>>     lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h
>>>     lldb/trunk/source/Commands/CommandObjectExpression.cpp
>>>     lldb/trunk/source/Commands/CommandObjectFrame.cpp
>>>     lldb/trunk/source/Core/ValueObject.cpp
>>>     lldb/trunk/source/Core/ValueObjectConstResult.cpp
>>>     lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
>>>     lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
>>>     lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
>>>     
>>> lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
>>> 
>>> Modified: lldb/trunk/include/lldb/Core/ValueObject.h
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/include/lldb/Core/ValueObject.h (original)
>>> +++ lldb/trunk/include/lldb/Core/ValueObject.h Tue Oct  6 21:36:35 2015
>>> @@ -1242,6 +1242,9 @@ protected:
>>>      bool
>>>      IsChecksumEmpty ();
>>> 
>>> +    void
>>> +    SetPreferredDisplayLanguageIfNeeded (lldb::LanguageType);
>>> +
>>>  private:
>>>      //------------------------------------------------------------------
>>>      // For ValueObject only
>>> 
>>> Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original)
>>> +++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Tue Oct  6 
>>> 21:36:35 2015
>>> @@ -105,6 +105,12 @@ public:
>>>      virtual TypeImpl
>>>      GetTypeImpl ();
>>> 
>>> +    virtual lldb::LanguageType
>>> +    GetPreferredDisplayLanguage ();
>>> +
>>> +    void
>>> +    SetPreferredDisplayLanguage (lldb::LanguageType);
>>> +
>>>      virtual bool
>>>      GetDeclaration (Declaration &decl);
>>> 
>>> 
>>> Modified: lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h (original)
>>> +++ lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h Tue Oct  6 
>>> 21:36:35 2015
>>> @@ -152,6 +152,12 @@ public:
>>>      virtual void
>>>      SetFormat (lldb::Format format);
>>> 
>>> +    virtual lldb::LanguageType
>>> +    GetPreferredDisplayLanguage ();
>>> +
>>> +    void
>>> +    SetPreferredDisplayLanguage (lldb::LanguageType);
>>> +
>>>      virtual bool
>>>      GetDeclaration (Declaration &decl);
>>> 
>>> 
>>> Modified: lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h (original)
>>> +++ lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h Tue Oct  6 
>>> 21:36:35 2015
>>> @@ -61,6 +61,7 @@ struct DumpValueObjectOptions
>>>      lldb::Format m_format = lldb::eFormatDefault;
>>>      lldb::TypeSummaryImplSP m_summary_sp;
>>>      std::string m_root_valobj_name;
>>> +    lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
>>>      PointerDepth m_max_ptr_depth;
>>>      bool m_use_synthetic : 1;
>>>      bool m_scope_already_checked : 1;
>>> @@ -252,6 +253,13 @@ struct DumpValueObjectOptions
>>>          return *this;
>>>      }
>>> 
>>> +    DumpValueObjectOptions&
>>> +    SetVariableFormatDisplayLanguage (lldb::LanguageType lang = 
>>> lldb::eLanguageTypeUnknown)
>>> +    {
>>> +        m_varformat_language = lang;
>>> +        return *this;
>>> +    }
>>> +
>>>      DumpValueObjectOptions&
>>>      SetRunValidator (bool run = true)
>>>      {
>>> 
>>> Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
>>> +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Tue Oct  6 
>>> 21:36:35 2015
>>> @@ -335,6 +335,7 @@ CommandObjectExpression::EvaluateExpress
>>>                          result_valobj_sp->SetFormat (format);
>>> 
>>>                      DumpValueObjectOptions 
>>> options(m_varobj_options.GetAsDumpOptions(m_command_options.m_verbosity,format));
>>> +                    
>>> options.SetVariableFormatDisplayLanguage(result_valobj_sp->GetPreferredDisplayLanguage());
>>> 
>>>                      result_valobj_sp->Dump(*output_stream,options);
>>> 
>>> 
>>> Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
>>> +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Oct  6 21:36:35 
>>> 2015
>>> @@ -500,6 +500,7 @@ protected:
>>>                              }
>>> 
>>>                              options.SetFormat(format);
>>> +                            
>>> options.SetVariableFormatDisplayLanguage(valobj_sp->GetPreferredDisplayLanguage());
>>> 
>>>                              Stream &output_stream = 
>>> result.GetOutputStream();
>>>                              
>>> options.SetRootValueObjectName(valobj_sp->GetParent() ? name_cstr : NULL);
>>> @@ -586,6 +587,7 @@ protected:
>>>                                      }
>>> 
>>>                                      options.SetFormat(format);
>>> +                                    
>>> options.SetVariableFormatDisplayLanguage(valobj_sp->GetPreferredDisplayLanguage());
>>>                                      
>>> options.SetRootValueObjectName(name_cstr);
>>>                                      
>>> valobj_sp->Dump(result.GetOutputStream(),options);
>>>                                  }
>>> 
>>> Modified: lldb/trunk/source/Core/ValueObject.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/source/Core/ValueObject.cpp (original)
>>> +++ lldb/trunk/source/Core/ValueObject.cpp Tue Oct  6 21:36:35 2015
>>> @@ -4259,6 +4259,13 @@ ValueObject::SetPreferredDisplayLanguage
>>>      m_preferred_display_language = lt;
>>>  }
>>> 
>>> +void
>>> +ValueObject::SetPreferredDisplayLanguageIfNeeded (lldb::LanguageType lt)
>>> +{
>>> +    if (m_preferred_display_language == lldb::eLanguageTypeUnknown)
>>> +        SetPreferredDisplayLanguage(lt);
>>> +}
>>> +
>>>  bool
>>>  ValueObject::CanProvideValue ()
>>>  {
>>> 
>>> Modified: lldb/trunk/source/Core/ValueObjectConstResult.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectConstResult.cpp?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/source/Core/ValueObjectConstResult.cpp (original)
>>> +++ lldb/trunk/source/Core/ValueObjectConstResult.cpp Tue Oct  6 21:36:35 
>>> 2015
>>> @@ -374,5 +374,7 @@ ValueObjectConstResult::Cast (const Comp
>>>  lldb::LanguageType
>>>  ValueObjectConstResult::GetPreferredDisplayLanguage ()
>>>  {
>>> -    return lldb::eLanguageTypeUnknown;
>>> +    if (m_preferred_display_language != lldb::eLanguageTypeUnknown)
>>> +        return m_preferred_display_language;
>>> +    return GetCompilerTypeImpl().GetMinimumLanguage();
>>>  }
>>> 
>>> Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
>>> +++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Tue Oct  6 21:36:35 
>>> 2015
>>> @@ -391,6 +391,27 @@ ValueObjectDynamicValue::SetData (DataEx
>>>      return ret_val;
>>>  }
>>> 
>>> +void
>>> +ValueObjectDynamicValue::SetPreferredDisplayLanguage (lldb::LanguageType 
>>> lang)
>>> +{
>>> +    this->ValueObject::SetPreferredDisplayLanguage(lang);
>>> +    if (m_parent)
>>> +        m_parent->SetPreferredDisplayLanguage(lang);
>>> +}
>>> +
>>> +lldb::LanguageType
>>> +ValueObjectDynamicValue::GetPreferredDisplayLanguage ()
>>> +{
>>> +    if (m_preferred_display_language == lldb::eLanguageTypeUnknown)
>>> +    {
>>> +        if (m_parent)
>>> +            return m_parent->GetPreferredDisplayLanguage();
>>> +        return lldb::eLanguageTypeUnknown;
>>> +    }
>>> +    else
>>> +        return m_preferred_display_language;
>>> +}
>>> +
>>>  bool
>>>  ValueObjectDynamicValue::GetDeclaration (Declaration &decl)
>>>  {
>>> 
>>> Modified: lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp (original)
>>> +++ lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp Tue Oct  6 
>>> 21:36:35 2015
>>> @@ -223,6 +223,7 @@ ValueObjectSynthetic::GetChildAtIndex (s
>>>              if (!synth_guy)
>>>                  return synth_guy;
>>>              m_children_byindex.SetValueForKey(idx, synth_guy.get());
>>> +            
>>> synth_guy->SetPreferredDisplayLanguageIfNeeded(GetPreferredDisplayLanguage());
>>>              return synth_guy;
>>>          }
>>>          else
>>> @@ -315,6 +316,27 @@ ValueObjectSynthetic::SetFormat (lldb::F
>>>      this->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
>>>  }
>>> 
>>> +void
>>> +ValueObjectSynthetic::SetPreferredDisplayLanguage (lldb::LanguageType lang)
>>> +{
>>> +    this->ValueObject::SetPreferredDisplayLanguage(lang);
>>> +    if (m_parent)
>>> +        m_parent->SetPreferredDisplayLanguage(lang);
>>> +}
>>> +
>>> +lldb::LanguageType
>>> +ValueObjectSynthetic::GetPreferredDisplayLanguage ()
>>> +{
>>> +    if (m_preferred_display_language == lldb::eLanguageTypeUnknown)
>>> +    {
>>> +        if (m_parent)
>>> +            return m_parent->GetPreferredDisplayLanguage();
>>> +        return lldb::eLanguageTypeUnknown;
>>> +    }
>>> +    else
>>> +        return m_preferred_display_language;
>>> +}
>>> +
>>>  bool
>>>  ValueObjectSynthetic::GetDeclaration (Declaration &decl)
>>>  {
>>> 
>>> Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original)
>>> +++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Tue Oct  6 
>>> 21:36:35 2015
>>> @@ -26,6 +26,7 @@ DumpValueObjectOptions()
>>>  {
>>>      m_use_dynamic = valobj.GetDynamicValueType();
>>>      m_use_synthetic = valobj.IsSynthetic();
>>> +    m_varformat_language = valobj.GetPreferredDisplayLanguage();
>>>  }
>>> 
>>>  ValueObjectPrinter::ValueObjectPrinter (ValueObject* valobj,
>>> @@ -354,10 +355,10 @@ ValueObjectPrinter::GetValueSummaryError
>>>          {
>>>              TypeSummaryImpl* entry = GetSummaryFormatter();
>>>              if (entry)
>>> -                m_valobj->GetSummaryAsCString(entry, summary);
>>> +                m_valobj->GetSummaryAsCString(entry, summary, 
>>> options.m_varformat_language);
>>>              else
>>>              {
>>> -                const char* sum_cstr = m_valobj->GetSummaryAsCString();
>>> +                const char* sum_cstr = 
>>> m_valobj->GetSummaryAsCString(options.m_varformat_language);
>>>                  if (sum_cstr)
>>>                      summary.assign(sum_cstr);
>>>              }
>>> 
>>> Modified: 
>>> lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=249507&r1=249506&r2=249507&view=diff
>>> ==============================================================================
>>> --- 
>>> lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
>>>  (original)
>>> +++ 
>>> lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
>>>  Tue Oct  6 21:36:35 2015
>>> @@ -387,7 +387,6 @@ class ObjCDataFormatterTestCase(TestBase
>>>          self.addTearDownHook(cleanup)
>>> 
>>>          # check formatters for common Objective-C types
>>> -        self.runCmd("log timers enable")
>>>          expect_strings = ['(CFGregorianUnits) cf_greg_units = 1 years, 3 
>>> months, 5 days, 12 hours, 5 minutes 7 seconds',
>>>           '(CFRange) cf_range = location=4 length=4',
>>>           '(NSPoint) ns_point = (x = 4, y = 4)',
>>> @@ -414,7 +413,6 @@ class ObjCDataFormatterTestCase(TestBase
>>> 
>>>          self.expect("frame variable",
>>>               substrs = expect_strings)
>>> -        self.runCmd('log timers dump')
>>> 
>>> 
>>>      def kvo_data_formatter_commands(self):
>>> 
>>> 
>>> _______________________________________________
>>> lldb-commits mailing list
>>> lldb-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to