From: Pavel Labath Date: Wed, 21 Mar 2018 12:18:03 +0000 (+0000) Subject: Fix build broken by r328090 X-Git-Tag: llvmorg-7.0.0-rc1~10054 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=646ab4113f0501a0e5da0f4d10c12f3a3048f9a0;p=platform%2Fupstream%2Fllvm.git Fix build broken by r328090 - constexpr is needed for out-of-class definition of the Type static member by some compilers - MSVC is confused by the initialization of the static constexpr char[] member when it happens in a template specialization. Explicitly specifying the length of the array seems to be enough to help it figure things out. llvm-svn: 328093 --- diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.h b/llvm/include/llvm/BinaryFormat/Dwarf.h index 3ba83db..15724a9 100644 --- a/llvm/include/llvm/BinaryFormat/Dwarf.h +++ b/llvm/include/llvm/BinaryFormat/Dwarf.h @@ -578,22 +578,22 @@ private: template struct EnumTraits : public std::false_type {}; template <> struct EnumTraits : public std::true_type { - static constexpr char Type[] = "AT"; + static constexpr char Type[3] = "AT"; static constexpr StringRef (*StringFn)(unsigned) = &AttributeString; }; template <> struct EnumTraits
: public std::true_type { - static constexpr char Type[] = "FORM"; + static constexpr char Type[5] = "FORM"; static constexpr StringRef (*StringFn)(unsigned) = &FormEncodingString; }; template <> struct EnumTraits : public std::true_type { - static constexpr char Type[] = "IDX"; + static constexpr char Type[4] = "IDX"; static constexpr StringRef (*StringFn)(unsigned) = &IndexString; }; template <> struct EnumTraits : public std::true_type { - static constexpr char Type[] = "TAG"; + static constexpr char Type[4] = "TAG"; static constexpr StringRef (*StringFn)(unsigned) = &TagString; }; } // End of namespace dwarf diff --git a/llvm/lib/BinaryFormat/Dwarf.cpp b/llvm/lib/BinaryFormat/Dwarf.cpp index 3a97dde..dd1ecea1 100644 --- a/llvm/lib/BinaryFormat/Dwarf.cpp +++ b/llvm/lib/BinaryFormat/Dwarf.cpp @@ -676,7 +676,7 @@ bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version, return ExtensionsOk; } -const char llvm::dwarf::EnumTraits::Type[]; -const char llvm::dwarf::EnumTraits::Type[]; -const char llvm::dwarf::EnumTraits::Type[]; -const char llvm::dwarf::EnumTraits::Type[]; +constexpr char llvm::dwarf::EnumTraits::Type[]; +constexpr char llvm::dwarf::EnumTraits::Type[]; +constexpr char llvm::dwarf::EnumTraits::Type[]; +constexpr char llvm::dwarf::EnumTraits::Type[];