[clang] [NFC][Clang] Use StringRef instead of string in ClangDiagnosticEmitter (PR #115959)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 22:58:43 PST 2024


================
@@ -117,15 +118,15 @@ namespace {
       return CategoryIDs[CategoryString];
     }
 
-    typedef std::vector<std::string>::const_iterator const_iterator;
+    typedef std::vector<StringRef>::const_iterator const_iterator;
     const_iterator begin() const { return CategoryStrings.begin(); }
     const_iterator end() const { return CategoryStrings.end(); }
   };
 
   struct GroupInfo {
     StringRef GroupName;
     std::vector<const Record*> DiagsInGroup;
-    std::vector<std::string> SubGroups;
+    std::vector<StringRef> SubGroups;
----------------
kazutakahirata wrote:

With another patch of yours, `StringRef` tends to be printed out right away, so I'm not worried about life time issues.  Where are the original strings stored?

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


More information about the cfe-commits mailing list