[llvm] r362360 - [TableGen] Fix std::array initializer to avoid warnings with older tool chains. NFC

Mikael Holmen via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 2 23:38:01 PDT 2019


Author: uabelho
Date: Sun Jun  2 23:38:01 2019
New Revision: 362360

URL: http://llvm.org/viewvc/llvm-project?rev=362360&view=rev
Log:
[TableGen] Fix std::array initializer 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 complain even if leaving out one level of braces.

Modified:
    llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp

Modified: llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp?rev=362360&r1=362359&r2=362360&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Sun Jun  2 23:38:01 2019
@@ -692,7 +692,7 @@ void MatcherGen::EmitResultLeafAsOperand
     }
 
     if (Def->getName() == "undef_tied_input") {
-      std::array<MVT::SimpleValueType, 1> ResultVTs = { N->getSimpleType(0) };
+      std::array<MVT::SimpleValueType, 1> ResultVTs = {{ N->getSimpleType(0) }};
       std::array<unsigned, 0> InstOps;
       auto IDOperandNo = NextRecordedOperandNo++;
       AddMatcher(new EmitNodeMatcher("TargetOpcode::IMPLICIT_DEF",




More information about the llvm-commits mailing list