20
20
using namespace swift ;
21
21
using namespace importer ;
22
22
23
- // / The maximum length of any particular string in the list of known CF types.
24
- const size_t MaxCFTypeNameLength = 38 ;
25
23
namespace {
26
- // FIXME: This is only needed because llvm::StringRef doesn't have a constexpr
27
- // constructor.
28
- struct CFTypeListEntry {
29
- unsigned char Length;
30
- char Data[MaxCFTypeNameLength + 1 ];
31
-
32
- operator StringRef () const { return StringRef (Data, Length); }
33
- };
34
-
35
24
// Quasi-lexicographic order: string length first, then string data.
36
25
// Since we don't care about the actual length, we can use this, which
37
26
// lets us ignore the string data a larger proportion of the time.
@@ -43,16 +32,11 @@ namespace {
43
32
};
44
33
} // end anonymous namespace
45
34
46
- template <size_t Len>
47
- static constexpr size_t string_lengthof (const char (&data)[Len]) {
48
- return Len - 1 ;
49
- }
50
-
51
35
// / The list of known CF types. We use 'constexpr' to verify that this is
52
36
// / emitted as a constant. Note that this is expected to be sorted in
53
37
// / quasi-lexicographic order.
54
- static constexpr const CFTypeListEntry KnownCFTypes[] = {
55
- #define CF_TYPE (NAME ) { string_lengthof ( #NAME), #NAME } ,
38
+ static constexpr const llvm::StringLiteral KnownCFTypes[] = {
39
+ #define CF_TYPE (NAME ) #NAME,
56
40
#define NON_CF_TYPE (NAME )
57
41
#include " SortedCFDatabase.def"
58
42
};
0 commit comments