alexfh requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: clang-tidy/modernize/LoopConvertCheck.cpp:525
@@ +524,3 @@
+      DeclarationType = DeclarationType.getNonReferenceType();
+    if (Descriptor.ElemType.isNull() || DeclarationType.isNull() ||
+        !Context->hasSameUnqualifiedType(DeclarationType, Descriptor.ElemType))
----------------
mgehre wrote:
> alexfh wrote:
> > 1. Can the `AliasVar->getType().isNull()` condition be true?
> > 2. If it can, consider `!Descriptor.ElemType.isNull().isNull()` and 
> > `AliasVar->getType().isNull()`. In this case setting `Descriptor.ElemType` 
> > to `AliasVar->getType()` (which is null) doesn't make much sense.
> > 
> > I'd probably just wrap the added code in `if 
> > (!AliasVar->getType().isNull())`.
> Thanks for you fast review.
> 
> I copied the block from isAliasDecl(). I don't see any reason why the types 
> can be Null, but I'm also not an expert in llvm.
> 
> When would a VarDecl have no type? Maybe I should put an assert instead?
You can try to add an assert and run the check on llvm, for example.

Alternatively, wrap the added code in `if (!AliasVar->getType().isNull())`


http://reviews.llvm.org/D22069



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to