[llvm] r232833 - DebugInfoFinder: Check for null imported entities

David Blaikie dblaikie at gmail.com
Fri Mar 20 12:55:55 PDT 2015


On Fri, Mar 20, 2015 at 12:13 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

> Author: dexonsmith
> Date: Fri Mar 20 14:13:53 2015
> New Revision: 232833
>
> URL: http://llvm.org/viewvc/llvm-project?rev=232833&view=rev
> Log:
> DebugInfoFinder: Check for null imported entities
>

When do we have null imported entities? Can we just disallow them?

There used to be a lot of conditionals for null DI* across the debug info
handling and in many cases it hid bugs - I've removed any & would like it
if we could continue pushing in that direction, rather than going back to
the way things were.


>
> Don't use the accessors in `DIImportedEntity` on a null pointer.  (A WIP
> patch to make `DIDescriptor` accessors more strict crashes here
> otherwise.)
>
> Modified:
>     llvm/trunk/lib/IR/DebugInfo.cpp
>
> Modified: llvm/trunk/lib/IR/DebugInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=232833&r1=232832&r2=232833&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/IR/DebugInfo.cpp (original)
> +++ llvm/trunk/lib/IR/DebugInfo.cpp Fri Mar 20 14:13:53 2015
> @@ -674,6 +674,8 @@ void DebugInfoFinder::processModule(cons
>        DIArray Imports = CU.getImportedEntities();
>        for (unsigned i = 0, e = Imports.getNumElements(); i != e; ++i) {
>          DIImportedEntity Import = DIImportedEntity(Imports.getElement(i));
> +        if (!Import)
> +          continue;
>          DIDescriptor Entity =
> Import.getEntity().resolve(TypeIdentifierMap);
>          if (Entity.isType())
>            processType(DIType(Entity));
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150320/8c22d563/attachment.html>


More information about the llvm-commits mailing list