[clang] ffb8434 - [clang] Prevent unnecessary copies in `SymbolGraphSerializer` (NFC)

Antonio Frighetto via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 8 08:19:32 PDT 2023


Author: Antonio Frighetto
Date: 2023-09-08T17:19:06+02:00
New Revision: ffb8434f6a514fb3c06e0bdaff6d4ee410924ff6

URL: https://github.com/llvm/llvm-project/commit/ffb8434f6a514fb3c06e0bdaff6d4ee410924ff6
DIFF: https://github.com/llvm/llvm-project/commit/ffb8434f6a514fb3c06e0bdaff6d4ee410924ff6.diff

LOG: [clang] Prevent unnecessary copies in `SymbolGraphSerializer` (NFC)

Added: 
    

Modified: 
    clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index 229bf04c77fae44..6ee6e72d99ec57b 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -597,7 +597,7 @@ std::optional<Object> serializeTemplateMixinImpl(const RecordTy &Record,
 
   Object Generics;
   Array GenericParameters;
-  for (const auto Param : Template.getParameters()) {
+  for (const auto &Param : Template.getParameters()) {
     Object Parameter;
     Parameter["name"] = Param.Name;
     Parameter["index"] = Param.Index;
@@ -608,7 +608,7 @@ std::optional<Object> serializeTemplateMixinImpl(const RecordTy &Record,
     Generics["parameters"] = std::move(GenericParameters);
 
   Array GenericConstraints;
-  for (const auto Constr : Template.getConstraints()) {
+  for (const auto &Constr : Template.getConstraints()) {
     Object Constraint;
     Constraint["kind"] = Constr.Kind;
     Constraint["lhs"] = Constr.LHS;


        


More information about the cfe-commits mailing list