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

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 22 23:00:46 PDT 2016


Generally I'd expect a test case to exercise/demonstrate the behavior that
was previously hidden behind an assertion. (put another way: "we expect
something specific to happen, not just for clang not to assert/crash")

On Mon, Aug 22, 2016 at 3:32 PM Adrian Prantl via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> 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 *
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160823/bad0c421/attachment.html>


More information about the cfe-commits mailing list