Skip to content

Commit

Permalink
Merge pull request #16372 from bob-wilson/fix-typerefs
Browse files Browse the repository at this point in the history
[Reflection] Remove DEPENDENT_TEMPLATE2 macro
  • Loading branch information
bob-wilson authored May 4, 2018
2 parents 0c0219c + 62b9375 commit 61412a7
Showing 1 changed file with 5 additions and 18 deletions.
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

0 comments on commit 61412a7

Please sign in to comment.