[clang] [Clang] Refactor diagnostics for SME builtins. (PR #78258)

Matthew Devereau via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 09:44:43 PST 2024


================
@@ -1720,21 +1720,29 @@ void SVEEmitter::createBuiltinZAState(raw_ostream &OS) {
   for (auto *R : RV)
     createIntrinsic(R, Defs);
 
-  std::map<bool, std::set<std::string>> DefsZAState;
-
-  uint64_t IsSharedZAFlag = getEnumValueForFlag("IsSharedZA");
+  std::map<std::string, std::set<std::string>> IntrinsicsPerState;
   for (auto &Def : Defs) {
-    bool HasZAState = Def->isFlagSet(IsSharedZAFlag);
-    DefsZAState[HasZAState].insert(Def->getMangledName());
+    std::string Key;
+    auto AddToKey = [&Key](std::string S) -> void {
----------------
MDevereau wrote:

nit: use `const std::string&` to pass string literals/read-only std::strings as parameters in C++ to avoid copying memory

https://github.com/llvm/llvm-project/pull/78258


More information about the cfe-commits mailing list