Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions include/swift/Reflection/TypeRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,20 @@ enum class TypeRefKind {

// MSVC reports an error if we use "template"
// Clang reports an error if we don't use "template"
#if defined(__APPLE_CC__)
#if defined(__clang__) || defined(__GNUC__)
# define DEPENDENT_TEMPLATE template
# if __APPLE_CC__ >= 7000
# define DEPENDENT_TEMPLATE2
# else
# define DEPENDENT_TEMPLATE2 template
# endif
#elif defined(__clang__) || defined(__GNUC__)
# define DEPENDENT_TEMPLATE template
# if __clang_major__ >= 7
# define DEPENDENT_TEMPLATE2
# else
# define DEPENDENT_TEMPLATE2 template
# endif
#else
# define DEPENDENT_TEMPLATE template
# define DEPENDENT_TEMPLATE2
# define DEPENDENT_TEMPLATE
#endif

#define FIND_OR_CREATE_TYPEREF(Allocator, TypeRefTy, ...) \
auto ID = Profile(__VA_ARGS__); \
const auto Entry = Allocator.DEPENDENT_TEMPLATE2 TypeRefTy##s.find(ID); \
if (Entry != Allocator.DEPENDENT_TEMPLATE2 TypeRefTy##s.end()) \
const auto Entry = Allocator.TypeRefTy##s.find(ID); \
if (Entry != Allocator.TypeRefTy##s.end()) \
return Entry->second; \
const auto TR = \
Allocator.DEPENDENT_TEMPLATE makeTypeRef<TypeRefTy>(__VA_ARGS__); \
Allocator.DEPENDENT_TEMPLATE2 TypeRefTy##s.insert({ID, TR}); \
Allocator.TypeRefTy##s.insert({ID, TR}); \
return TR;

/// An identifier containing the unique bit pattern made up of all of the
Expand Down