[PATCH] D137570: [Clang][Sema] Refactor category declaration under CheckForIncompatibleAttributes. NFC

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 11 09:36:35 PST 2022


shafik added inline comments.


================
Comment at: clang/lib/Sema/SemaStmtAttr.cpp:319
+  };
+  // There are 7 categories of loop hints attributes: vectorize, interleave,
+  // unroll, unroll_and_jam, pipeline, distribute, and vectorize predicate.
----------------
Can you break up this comment, I think it should go above the enum and each one that is specific to an enumerator should go above that enumerator. 


================
Comment at: clang/lib/Sema/SemaStmtAttr.cpp:331-332
     const LoopHintAttr *NumericAttr;
-  } HintAttrs[] = {{nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr},
-                   {nullptr, nullptr}, {nullptr, nullptr}, {nullptr, nullptr},
-                   {nullptr, nullptr}};
+  } HintAttrs[CategoryType::NumberOfCategories];
+  memset(HintAttrs, 0, sizeof(HintAttrs));
 
----------------
You can use `{}` to initialize the array. This will value-initialize each element, which for pointers will set it to zero.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137570



More information about the cfe-commits mailing list