[Lldb-commits] [PATCH] Fix resolution of certain recursive types.

Stephane Sezer sas at cd80.net
Tue Mar 24 15:23:42 PDT 2015


================
Comment at: source/Symbol/ClangASTImporter.cpp:289-296
@@ -288,2 +288,10 @@
     {
-        return CompleteTagDecl(tag_type->getDecl());
+        auto tag_decl = tag_type->getDecl();
+        if (tag_decl->getDefinition() || tag_decl->isBeingDefined())
+        {
+            return true;
+        }
+        tag_decl->startDefinition();
+        bool result = CompleteTagDecl(tag_decl);
+        tag_decl->setCompleteDefinition(true);
+        return result;
----------------
clayborg wrote:
> Do we always want to set this to true? If we really just have a forward declaration in the DWARF "result" might be false. If we set this to true, it means anytime we have a forward declaration to a class, we might start and complete the class definition and say that is is a complete class that contains nothing. Then in another ClangASTContext we might have a full definition of the type, then we try to import both types into an expression ClangASTContext and it will fail saying there are two definitions. You should add any needed smarts to ComplateTagDecl() and not do anything inline like this.
This code follows what we have at lines 202-207 so I'm not sure if we're doing something wrong.

I'll factor the code in CompleteTagDecl as you suggested and let Sean comment on what's the right thing to do here.

http://reviews.llvm.org/D8561

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list