[PATCH] D149074: [NFC][clang] Fix Coverity bugs with AUTO_CAUSES_COPY

Tom Honermann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 24 13:13:47 PDT 2023


tahonermann accepted this revision.
tahonermann added a comment.
This revision is now accepted and ready to land.

Looks good to me, thanks @Manna!



================
Comment at: clang/utils/TableGen/NeonEmitter.cpp:392
 
-    for (auto Type : Types) {
+    for (const auto &Type : Types) {
       // If this builtin takes an immediate argument, we need to #define it rather
----------------
Manna wrote:
> tahonermann wrote:
> > The element type is `Type` (`clang/utils/TableGen/NeonEmitter.cpp`). It holds a `TypeSpec`, an `enum` value, 5 `bool` values, and 3 `unsigned` values. I'm ambivalent.
> Thanks @tahonermann for reviews and feedbacks. 
> 
> >>The element type is Type (clang/utils/TableGen/NeonEmitter.cpp). It holds a TypeSpec, an enum value, 5 bool values, and 3 unsigned values.
> 
> Yes, I had mixed feeling about this one too. 
> 
> Line 362 in clang/utils/TableGen/NeonEmitter.cpp, we are passing it as a reference. 
> 
>  for (const auto &T : Types){
>       if (T.isVector() && T.getNumElements() > 1)
>         return false;
>     }
>     return true;
>   }
> 
Consistency is good then.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149074/new/

https://reviews.llvm.org/D149074



More information about the cfe-commits mailing list