r188739 - Revert "Revert "Revert "Revert "DebugInfo: Omit debug info for dynamic classes in TUs that do not have the vtable for that class""""

Eric Christopher echristo at gmail.com
Mon Aug 19 21:28:37 PDT 2013


>    if (const RecordDecl *RD = dyn_cast<RecordDecl>(Context)) {
>      if (!RD->isDependentType()) {
> -      llvm::DIType Ty = getOrCreateLimitedType(
> -          CGM.getContext().getRecordType(RD)->castAs<RecordType>(), getOrCreateMainFile());
> +      llvm::DICompositeType T(getTypeOrNull(CGM.getContext().getRecordType(RD)));
> +      llvm::DICompositeType Ty(getOrCreateLimitedType(
> +          CGM.getContext().getRecordType(RD)->castAs<RecordType>(),
> +          getOrCreateMainFile()));
> +      if (!Ty.getTypeArray().getNumElements()) {
> +        if (T) {
> +          llvm::DIArray PrevMem = T.getTypeArray();
> +          unsigned NumElements = PrevMem.getNumElements();
> +          if (NumElements == 1 && !PrevMem.getElement(0))
> +            NumElements = 0;
> +          SmallVector<llvm::Value *, 16> EltTys;
> +          EltTys.reserve(NumElements);
> +          for (unsigned i = 0; i != NumElements; ++i)
> +            EltTys.push_back(PrevMem.getElement(i));
> +          llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys);
> +          Ty.setTypeArray(Elements);
> +        }
> +      }

This could really use some descriptive comments :)

>
> -    if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D))
> -      EltTys.push_back(CreateCXXMemberFunction(Method, Unit, RecordTy));
> +    if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D)) {
> +      llvm::DenseMap<const FunctionDecl *, llvm::WeakVH>::iterator MI =
> +          SPCache.find(Method->getCanonicalDecl());
> +      if (MI == SPCache.end())
> +        EltTys.push_back(CreateCXXMemberFunction(Method, Unit, RecordTy));
> +      else
> +        EltTys.push_back(MI->second);
> +    }

Ditto here :)

Thanks!

-eric



More information about the cfe-commits mailing list