[llvm] r361171 - [AMDGPU] Fix std::array initializers to avoid warnings with older tool chains. NFC

Bjorn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 09:41:09 PDT 2019


Author: bjope
Date: Mon May 20 09:41:08 2019
New Revision: 361171

URL: http://llvm.org/viewvc/llvm-project?rev=361171&view=rev
Log:
[AMDGPU] Fix std::array initializers to avoid warnings with older tool chains. NFC

A std::array is implemented as a template with an array
inside a struct. Older versions of clang, like 3.6,
require an extra set of curly braces around std::array
initializations to avoid warnings.

The C++ language was changed regarding this by CWG 1270.
So more modern tool chains does not complaing even if
leaving out one level of braces.

Modified:
    llvm/trunk/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp?rev=361171&r1=361170&r2=361171&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp Mon May 20 09:41:08 2019
@@ -160,7 +160,7 @@ AMDGPURegisterBankInfo::getInstrAlternat
     };
 
     // rsrc, voffset, offset
-    const std::array<unsigned, 3> RegSrcOpIdx = { 2, 3, 4 };
+    const std::array<unsigned, 3> RegSrcOpIdx = { { 2, 3, 4 } };
     return addMappingFromTable<3>(MI, MRI, RegSrcOpIdx, makeArrayRef(Table));
   }
   case Intrinsic::amdgcn_s_buffer_load: {
@@ -179,7 +179,7 @@ AMDGPURegisterBankInfo::getInstrAlternat
     };
 
     // rsrc, offset
-    const std::array<unsigned, 2> RegSrcOpIdx = { 2, 3 };
+    const std::array<unsigned, 2> RegSrcOpIdx = { { 2, 3 } };
     return addMappingFromTable<2>(MI, MRI, RegSrcOpIdx, makeArrayRef(Table));
   }
   default:




More information about the llvm-commits mailing list