From f4cf15a0e11fc22e13b85ace4ea3a80b85b5a26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B9=B4=E8=BD=BB=E4=BA=BA=E5=95=8A=E4=B8=8D=E8=A6=81?= =?UTF-8?q?=E7=86=AC=E5=A4=9C?= <1562021005@qq.com> Date: Mon, 14 Dec 2020 12:19:53 +0800 Subject: [PATCH] Use reference type to prevent copying Loop variable 'kTyIdx' creates a copy from type 'const maple::TyIdx', which will generate compilation errors under [-Werror,-Wrange-loop-construct]. Use reference type 'const maple::TyIdx &' to prevent copying. --- src/mapleall/mpl2mpl/src/reflection_analysis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mapleall/mpl2mpl/src/reflection_analysis.cpp b/src/mapleall/mpl2mpl/src/reflection_analysis.cpp index 4a65fa8c35..753921fed8 100755 --- a/src/mapleall/mpl2mpl/src/reflection_analysis.cpp +++ b/src/mapleall/mpl2mpl/src/reflection_analysis.cpp @@ -1546,7 +1546,7 @@ void ReflectionAnalysis::GenClassMetaData(Klass &klass) { } if (structType->IsMIRClassType()) { MIRClassType *classType = static_cast(structType); - for (TyIdx const kTyIdx : classType->GetInterfaceImplemented()) { + for (TyIdx const& kTyIdx : classType->GetInterfaceImplemented()) { Klass *interface = klassH->GetKlassFromTyIdx(kTyIdx); if (interface == nullptr) { MIRType *type = GlobalTables::GetTypeTable().GetTypeFromTyIdx(kTyIdx); -- Gitee