<div dir="ltr">The problem was actually in the native pdb plugin.  I forgot to call ClangASTContext::SetHasExternalStorage with true on the enum decls when i created it, so it wasn't getting completed.  I submitted a fix in r346517.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 8, 2018 at 2:00 PM Greg Clayton <<a href="mailto:clayborg@gmail.com">clayborg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">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><br></div><div>SBValue var = frame.FindVariable("myEnumVar");</div><div><br></div><div>If I call:</div><div><br></div><div>SBType var_type = var.GetType();</div><div><br></div><div>"var_type" doesn't need be completed yet. Even:</div><div><br></div><div>const char *n = var_type.GetName();</div><div><br></div><div>Doesn't require a full type. Now for getting the value:</div><div><br></div><div>const char *value = var.GetValue();</div><div><br></div><div>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><br></div><div>Asking the type about itself might also cause the type to complete itself:</div><div><br></div><div><div>auto num_fields = var_type.GetNumFields();</div><div><br></div><div>Would cause a class type to complete itself probably down in the TypeSystem class (ClangASTContext).</div><div><br></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></div><div>Question: did you use the clang external AST source like the DWARF plug-in stuff did to complete the types?</div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div><br></div><div><blockquote type="cite"><div>On Nov 8, 2018, at 1:40 PM, Greg Clayton <<a href="mailto:clayborg@gmail.com" target="_blank">clayborg@gmail.com</a>> wrote:</div><br class="m_7656722334939670788Apple-interchange-newline"><div><div style="word-wrap:break-word;line-break:after-white-space">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><br></div><div>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><br></div><div>The correct fix is to probably call </div><div><br></div><div>bool CompilerType::GetCompleteType() const;</div><div><br></div><div>Before you need to access the enumerators in an enumeration.</div><div><br></div><div><br></div><div><div><br><blockquote type="cite"><div>On Nov 8, 2018, at 1:17 PM, Zachary Turner via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:</div><br class="m_7656722334939670788Apple-interchange-newline"><div><div><div dir="auto">+greg.</div><div dir="auto"><br></div><div dir="auto">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"><br></div><div dir="auto">It seems related to my change to use the layout type instead of the forward type.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 8, 2018 at 1:03 PM Davide Italiano <<a href="mailto:dccitaliano@gmail.com" target="_blank">dccitaliano@gmail.com</a>> wrote:<br></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">zturner@google.com</a>> wrote:<br>
><br>
> I’m ooo for at least 2 hours. Is it a test failure or a compilation failure?<br>
<br>
<br>
FAIL: test_with_run_command_gmodules (TestTypeCompletion.TypeCompletionTestCase)<br>
<br>
   Check that types only get completed when necessary.<br>
----------------------------------------------------------------------<br>
Traceback (most recent call last):<br>
  File "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",<br>
line 1744, in test_method<br>
    return attrvalue(self)<br>
  File "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",<br>
line 113, in wrapper<br>
    func(*args, **kwargs)<br>
  File "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",<br>
line 55, in test_with_run_command 'vector<T> complete but it should<br>
not be')<br>
AssertionError: True is not False : vector<T> complete but it should not be<br>
<br>
<br>
Do you want me to revert this in the meanwhile?<br>
<br>
--Davide<br>
</blockquote></div></div>
_______________________________________________<br>lldb-commits mailing list<br><a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br></div></blockquote></div><br></div></div></div></blockquote></div><br></div></div></blockquote></div>