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

Rahul Joshi via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 10:16:16 PST 2024


================
@@ -1419,16 +1412,14 @@ void clang::EmitClangDiagsDefs(const RecordKeeper &Records, raw_ostream &OS,
   InferPedantic inferPedantic(DGParentMap, Diags, DiagGroups, DiagsInGroup);
   inferPedantic.compute(&DiagsInPedantic, (RecordVec*)nullptr);
 
-  for (unsigned i = 0, e = Diags.size(); i != e; ++i) {
-    const Record &R = *Diags[i];
-
+  for (const Record *RP : Diags) {
+    const Record &R = *RP;
----------------
jurahul wrote:

I can clean this up in this PR. I was looking into whether LLVM has any iterator adapters for this earlier and could not find one. But looking again, it seems `make_pointee_range` does what we want, so let me try it

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


More information about the cfe-commits mailing list