[PATCH] D22069: clang-tidy modernize-loop-convert: preserve type of alias declaration (bug 28341)

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 6 14:26:23 PDT 2016


alexfh added a comment.

Thank you for fixing the bug! One comment below.


================
Comment at: clang-tidy/modernize/LoopConvertCheck.cpp:525
@@ +524,3 @@
+      DeclarationType = DeclarationType.getNonReferenceType();
+    if (Descriptor.ElemType.isNull() || DeclarationType.isNull() ||
+        !Context->hasSameUnqualifiedType(DeclarationType, Descriptor.ElemType))
----------------
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())`.


http://reviews.llvm.org/D22069





More information about the cfe-commits mailing list