Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp
Show First 20 Lines • Show All 355 Lines • ▼ Show 20 Lines | int main(int argc, char **argv) { | ||||
Trie T; | Trie T; | ||||
uint32_t NameCount = 0; | uint32_t NameCount = 0; | ||||
std::size_t LongestName = 0; | std::size_t LongestName = 0; | ||||
auto Entries = loadDataFiles(argv[1], argv[2]); | auto Entries = loadDataFiles(argv[1], argv[2]); | ||||
for (const std::pair<const char32_t, std::string> &Entry : Entries) { | for (const std::pair<const char32_t, std::string> &Entry : Entries) { | ||||
char32_t Codepoint = Entry.first; | char32_t Codepoint = Entry.first; | ||||
const std::string &Name = Entry.second; | const std::string &Name = Entry.second; | ||||
// Ignore names which are not valid. | // Ignore names which are not valid. | ||||
if (Name.empty() || !llvm::all_of(Name, [](char C) { | if (Name.empty() || | ||||
return llvm::is_contained(Letters, C); | !llvm::all_of(Name, [](char C) { return Letters.contains(C); })) { | ||||
})) { | |||||
continue; | continue; | ||||
} | } | ||||
printf("%06x: %s\n", static_cast<unsigned int>(Codepoint), Name.c_str()); | printf("%06x: %s\n", static_cast<unsigned int>(Codepoint), Name.c_str()); | ||||
T.insert(Name, Codepoint); | T.insert(Name, Codepoint); | ||||
LongestName = | LongestName = | ||||
std::max(LongestName, std::size_t(llvm::count_if(Name, llvm::isAlnum))); | std::max(LongestName, std::size_t(llvm::count_if(Name, llvm::isAlnum))); | ||||
NameCount++; | NameCount++; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |