r184473 - Debug Info: Attempt to resolve forward declarations if we are not emitting

Adrian Prantl aprantl at apple.com
Thu Jun 20 16:43:53 PDT 2013


> Here's what I had in mind:
> 
> diff --git lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.cpp
> index 8240c08..8a1b1c8 100644
> --- lib/CodeGen/CGDebugInfo.cpp
> +++ lib/CodeGen/CGDebugInfo.cpp
> @@ -1938,8 +1938,15 @@ llvm::DIType
> CGDebugInfo::getOrCreateType(QualType Ty, llvm::DIFile Unit,
> 
>   llvm::DIType T = getCompletedTypeOrNull(Ty);
> 
> -  if (T.Verify())
> +  if (T.Verify()) {
> +    // If we're looking for a definition, make sure we have definitions of any
> +    // underlying types.
> +    if (const TypedefType* TTy = dyn_cast<TypedefType>(Ty))
> +      getOrCreateType(TTy->getDecl()->getUnderlyingType(), Unit, Declaration);
> +    if (Ty.hasLocalQualifiers())
> +      getOrCreateType(QualType(Ty.getTypePtr(), 0), Unit, Declaration);
>     return T;
> +  }
> 
>   // Otherwise create the type.
>   llvm::DIType Res = CreateTypeNode(Ty, Unit, Declaration);

Oh, that’s actually not all that different from my (original) patch, just that you regenerate the underlying types for all TypedefTypes instead of only those that typedef’d to a forward declaration. I don’t have any strong feelings about my implementation.. so, if that also works with my two test cases, feel free to do something like this instead of my patch.

cheers,
adrian



More information about the cfe-commits mailing list