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

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri Mar 20 13:09:16 PDT 2015


> On 2015-Mar-20, at 12:55, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> 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?

Probably, soon.

> 
> 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.
>  

Hmm, I don't remember which testcase(s) failed.  I'll dig it up; maybe
I can just fix the testcase instead.

My plan is to add assertions like like this to the Verifier, at which
point it'll be a lot easier to avoid conditionals like this.  Right now
the structure of the debug info part makes that tough though (see
why and a rough plan in r232790).  Once I've fixed the structure, I'll
remove the conditionals from `DebugInfoFinder` (and elsewhere), since we
won't be relying on it for verifying the IR.

> 
> 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
> 





More information about the llvm-commits mailing list