r279485 - Module debug info: Don't assert when encountering an incomplete definition

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 22 15:23:58 PDT 2016


Author: adrian
Date: Mon Aug 22 17:23:58 2016
New Revision: 279485

URL: http://llvm.org/viewvc/llvm-project?rev=279485&view=rev
Log:
Module debug info: Don't assert when encountering an incomplete definition
in isDefinedInClangModule() and assume that the incomplete definition
is not defined in the module.

This broke the -gmodules self host recently.
rdar://problem/27894367

Added:
    cfe/trunk/test/Modules/Inputs/DebugNestedA.h
    cfe/trunk/test/Modules/Inputs/DebugNestedB.h
Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/test/Modules/Inputs/module.map

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=279485&r1=279484&r2=279485&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Aug 22 17:23:58 2016
@@ -1655,7 +1655,8 @@ static bool isDefinedInClangModule(const
   if (!RD->isExternallyVisible() && RD->getName().empty())
     return false;
   if (auto *CXXDecl = dyn_cast<CXXRecordDecl>(RD)) {
-    assert(CXXDecl->isCompleteDefinition() && "incomplete record definition");
+    if (!CXXDecl->isCompleteDefinition())
+      return false;
     auto TemplateKind = CXXDecl->getTemplateSpecializationKind();
     if (TemplateKind != TSK_Undeclared) {
       // This is a template, check the origin of the first member.

Added: cfe/trunk/test/Modules/Inputs/DebugNestedA.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugNestedA.h?rev=279485&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/DebugNestedA.h (added)
+++ cfe/trunk/test/Modules/Inputs/DebugNestedA.h Mon Aug 22 17:23:58 2016
@@ -0,0 +1,8 @@
+/* -*- C++ -*- */
+template <typename T> class Base {};
+template <typename T> struct A : public Base<A<T>> {
+  void f();
+};
+
+class F {};
+typedef A<F> AF;

Added: cfe/trunk/test/Modules/Inputs/DebugNestedB.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/DebugNestedB.h?rev=279485&view=auto
==============================================================================
--- cfe/trunk/test/Modules/Inputs/DebugNestedB.h (added)
+++ cfe/trunk/test/Modules/Inputs/DebugNestedB.h Mon Aug 22 17:23:58 2016
@@ -0,0 +1,7 @@
+/* -*- C++ -*- */
+#include "DebugNestedA.h"
+class C {
+  void run(AF &af) {
+    af.f();
+  }
+};

Modified: cfe/trunk/test/Modules/Inputs/module.map
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/module.map?rev=279485&r1=279484&r2=279485&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/module.map (original)
+++ cfe/trunk/test/Modules/Inputs/module.map Mon Aug 22 17:23:58 2016
@@ -422,3 +422,13 @@ module MacroFabs1 {
 module DiagOutOfDate {
   header "DiagOutOfDate.h"
 }
+
+module DebugNestedA {
+  header "DebugNestedA.h"
+  export *
+}
+
+module DebugNestedB {
+  header "DebugNestedB.h"
+  export *
+}




More information about the cfe-commits mailing list