[TypeID] Use .def files to introduce TypeID specializations.

Simplify the static registration of types for use with TypeID by introducing
a more declarative approach. Each zone provides a .def file listing the
types and templates defined by that zone. The .def file is processed by
include/swift/Basic/DefineTypeIDZone.h with its zone number, which assigns
values to each of the types/templates and introduces the TypeID
specializations.
This commit is contained in:
Doug Gregor
2018-04-24 06:47:51 -07:00
parent 4b9e3ea84b
commit cbc6289962
5 changed files with 141 additions and 49 deletions

View File

@@ -169,10 +169,11 @@ struct ExternallyCachedEvaluationRule :
: EvaluationRule{expr} { }
};
// Define the arithmetic evaluator's zone.
namespace swift {
SWIFT_TYPEID(UnitTests, UncachedEvaluationRule, 1);
SWIFT_TYPEID(UnitTests, InternallyCachedEvaluationRule, 2);
SWIFT_TYPEID(UnitTests, ExternallyCachedEvaluationRule, 3);
#define SWIFT_TYPEID_ZONE 255
#define SWIFT_TYPEID_HEADER "ArithmeticEvaluatorTypeIDZone.def"
#include "swift/Basic/DefineTypeIDZone.h"
}
TEST(ArithmeticEvaluator, Simple) {