Skip to content

Commit 44a1fe8

Browse files
committed
[NFC] Include SmallVector.h for Clang <= 5
Clang 5 (possibly earlier) has a bug where it does not merge default template arguments properly for forwarded declarations. Include `SmallVector.h` directly in this case. This will slightly increase compile times, but only for very old compilers and only for files that don't already include `SmallVector.h` (of which there's currently only 23).
1 parent 0b32290 commit 44a1fe8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/swift/Basic/LLVM.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
// None.h includes an enumerator that is desired & cannot be forward declared
2626
// without a definition of NoneType.
2727
#include "llvm/ADT/None.h"
28+
#if defined(__clang_major__) && __clang_major__ < 6
29+
// Add this header as a workaround to prevent `too few template arguments for
30+
// class template 'SmallVector'` on the buggy Clang 5 compiler (it doesn't
31+
// merge template arguments correctly). Remove once the CentOS 7 job is
32+
// replaced.
33+
// rdar://98218902
34+
#include "llvm/ADT/SmallVector.h"
35+
#endif
2836

2937
// Don't pre-declare certain LLVM types in the runtime, which must
3038
// not put things in namespace llvm for ODR reasons.

0 commit comments

Comments
 (0)