aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-01-29 17:28:51 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-01-29 17:28:51 +0000
commit073971b2435687727787675b55cf78655425311d (patch)
tree069c78db7254b13a8fb492dadf73bcd1fc1211c0 /llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
parent7e86d0595073734d79004049064f444e77958c3b (diff)
downloadllvm-073971b2435687727787675b55cf78655425311d.zip
llvm-073971b2435687727787675b55cf78655425311d.tar.gz
llvm-073971b2435687727787675b55cf78655425311d.tar.bz2
[AccelTable] Workaround for MSVC bug
Microsoft Visual Studio rejects the static constexpr static list of atoms even though it's valid C++. This provides a workaround to unbreak the bots. llvm-svn: 323667
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp37
1 files changed, 32 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
index 597c2e7..abbb1b5 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
@@ -70,11 +70,6 @@ void AppleAccelTableHeader::setBucketAndHashCount(uint32_t HashCount) {
Header.HashCount = HashCount;
}
-constexpr const AppleAccelTableHeader::Atom AppleAccelTableTypeData::Atoms[];
-constexpr const AppleAccelTableHeader::Atom AppleAccelTableOffsetData::Atoms[];
-constexpr const AppleAccelTableHeader::Atom AppleAccelTableStaticOffsetData::Atoms[];
-constexpr const AppleAccelTableHeader::Atom AppleAccelTableStaticTypeData::Atoms[];
-
void AppleAccelTableBase::emitHeader(AsmPrinter *Asm) { Header.emit(Asm); }
void AppleAccelTableBase::emitBuckets(AsmPrinter *Asm) {
@@ -233,3 +228,35 @@ void AppleAccelTableStaticTypeData::emit(AsmPrinter *Asm) const {
: 0);
Asm->EmitInt32(QualifiedNameHash);
}
+
+#ifndef _MSC_VER
+// The lines below are rejected by older versions (TBD) of MSVC.
+constexpr AppleAccelTableHeader::Atom AppleAccelTableTypeData::Atoms[];
+constexpr AppleAccelTableHeader::Atom AppleAccelTableOffsetData::Atoms[];
+constexpr AppleAccelTableHeader::Atom AppleAccelTableStaticOffsetData::Atoms[];
+constexpr AppleAccelTableHeader::Atom AppleAccelTableStaticTypeData::Atoms[];
+#else
+// FIXME: Erase this path once the minimum MSCV version has been bumped.
+const SmallVector<AppleAccelTableHeader::Atom, 4>
+ AppleAccelTableOffsetData::Atoms = {AppleAccelTableHeader::Atom(
+ dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4)};
+const SmallVector<AppleAccelTableHeader::Atom, 4>
+ AppleAccelTableTypeData::Atoms = {
+ AppleAccelTableHeader::Atom(dwarf::DW_ATOM_die_offset,
+ dwarf::DW_FORM_data4),
+ AppleAccelTableHeader::Atom(dwarf::DW_ATOM_die_tag,
+ dwarf::DW_FORM_data2),
+ AppleAccelTableHeader::Atom(dwarf::DW_ATOM_type_flags,
+ dwarf::DW_FORM_data1)};
+const SmallVector<AppleAccelTableHeader::Atom, 4>
+ AppleAccelTableStaticOffsetData::Atoms = {AppleAccelTableHeader::Atom(
+ dwarf::DW_ATOM_die_offset, dwarf::DW_FORM_data4)};
+const SmallVector<AppleAccelTableHeader::Atom, 4>
+ AppleAccelTableStaticTypeData::Atoms = {
+ AppleAccelTableHeader::Atom(dwarf::DW_ATOM_die_offset,
+ dwarf::DW_FORM_data4),
+ AppleAccelTableHeader::Atom(dwarf::DW_ATOM_die_tag,
+ dwarf::DW_FORM_data2),
+ AppleAccelTableHeader::Atom(5, dwarf::DW_FORM_data1),
+ AppleAccelTableHeader::Atom(6, dwarf::DW_FORM_data4)};
+#endif