<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Another way to think about this is if you have a SBValue that represents a class instances in an IDE, if no one turns it open to see the children, why do we need to complete the type? We should have to. The type should be able to complete itself if and when we need to know some information. This already works fine for classes, we just need to make it work for enums. Just complete the type before we need access to the enumerators. For a SBValue that contains a enum type:<div class=""><br class=""></div><div class="">SBValue var = frame.FindVariable("myEnumVar");</div><div class=""><br class=""></div><div class="">If I call:</div><div class=""><br class=""></div><div class="">SBType var_type = var.GetType();</div><div class=""><br class=""></div><div class="">"var_type" doesn't need be completed yet. Even:</div><div class=""><br class=""></div><div class="">const char *n = var_type.GetName();</div><div class=""><br class=""></div><div class="">Doesn't require a full type. Now for getting the value:</div><div class=""><br class=""></div><div class="">const char *value = var.GetValue();</div><div class=""><br class=""></div><div class="">We don't need to complete a class type as the class has no value. If this is a pointer to anything (enum, class, struct, union) we don't need to complete the type to show the pointer value. For an enum we do need it. But the type should complete itself in the code that knows it needs to full type.</div><div class=""><br class=""></div><div class="">Asking the type about itself might also cause the type to complete itself:</div><div class=""><br class=""></div><div class=""><div>auto num_fields = var_type.GetNumFields();</div><div><br class=""></div><div>Would cause a class type to complete itself probably down in the TypeSystem class (ClangASTContext).</div><div><br class=""></div><div>So after thinking about this some more, the proposed fix you had was not the right one. We just need to fix the ClangASTContext to complete the type before it tries to use it.</div><div><br class=""></div><div>Question: did you use the clang external AST source like the DWARF plug-in stuff did to complete the types?</div><div><br class=""></div><div><blockquote type="cite" class=""><div class="">On Nov 8, 2018, at 1:40 PM, Greg Clayton <<a href="mailto:clayborg@gmail.com" class="">clayborg@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Looks like this test was testing the functionality that you changed. It it expecting that a type won't be complete until you ask for more info about it (like asking about a child). Since PDB is not completing the type up front, we need to change LLDB or make your previous case work even when handing out a forward type.<div class=""><br class=""></div><div class="">So the question is: do we expect types to be able to complete themselves on the fly anywhere? I believe we should be able to hand out a type as a forward declaration and have it complete itself at any point when it is needed. I know classes already do this when they need to know more. Maybe the AST doesn't treat enums like classes where it will complete the type through the external AST class.</div><div class=""><br class=""></div><div class="">The correct fix is to probably call </div><div class=""><br class=""></div><div class="">bool CompilerType::GetCompleteType() const;</div><div class=""><br class=""></div><div class="">Before you need to access the enumerators in an enumeration.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Nov 8, 2018, at 1:17 PM, Zachary Turner via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div dir="auto" class="">+greg.</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Greg, is the test wrong here or the patch?  If it’s the test let’s just fix the test, otherwise we can revert the patch until we figure it out.</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">It seems related to my change to use the layout type instead of the forward type.</div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Nov 8, 2018 at 1:03 PM Davide Italiano <<a href="mailto:dccitaliano@gmail.com" class="">dccitaliano@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Nov 8, 2018 at 12:59 PM Zachary Turner <<a href="mailto:zturner@google.com" target="_blank" class="">zturner@google.com</a>> wrote:<br class="">
><br class="">
> I’m ooo for at least 2 hours. Is it a test failure or a compilation failure?<br class="">
<br class="">
<br class="">
FAIL: test_with_run_command_gmodules (TestTypeCompletion.TypeCompletionTestCase)<br class="">
<br class="">
   Check that types only get completed when necessary.<br class="">
----------------------------------------------------------------------<br class="">
Traceback (most recent call last):<br class="">
  File "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",<br class="">
line 1744, in test_method<br class="">
    return attrvalue(self)<br class="">
  File "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",<br class="">
line 113, in wrapper<br class="">
    func(*args, **kwargs)<br class="">
  File "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",<br class="">
line 55, in test_with_run_command 'vector<T> complete but it should<br class="">
not be')<br class="">
AssertionError: True is not False : vector<T> complete but it should not be<br class="">
<br class="">
<br class="">
Do you want me to revert this in the meanwhile?<br class="">
<br class="">
--Davide<br class="">
</blockquote></div></div>
_______________________________________________<br class="">lldb-commits mailing list<br class=""><a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>