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

Greg Clayton clayborg at gmail.com
Mon Mar 23 13:29:50 PDT 2015


See inline comments.

You can easily make a test case with two files, there are many that do it.


================
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;
----------------
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.

http://reviews.llvm.org/D8561

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






More information about the lldb-commits mailing list