35 std::vector<const FunctionDefinition*> addedBuiltins;
38 size_t numBuiltinsAtStart = addedBuiltins.size();
39 for (
const auto& [symbol,
count] :
usage->fCallCounts) {
54 if (
std::find(addedBuiltins.begin(), addedBuiltins.end(), builtinDef) ==
55 addedBuiltins.end()) {
56 addedBuiltins.push_back(builtinDef);
61 if (addedBuiltins.size() == numBuiltinsAtStart) {
69 std::sort(addedBuiltins.begin() + numBuiltinsAtStart,
72 const FunctionDeclaration& a = aDefinition->declaration();
73 const FunctionDeclaration& b = bDefinition->declaration();
74 if (a.name() != b.name()) {
75 return a.name() > b.name();
77 return a.description() >
b.description();
81 int usageCallCounts =
usage->fCallCounts.count();
83 for (
size_t index = numBuiltinsAtStart; index < addedBuiltins.size(); ++index) {
84 usage->add(*addedBuiltins[index]);
87 if (
usage->fCallCounts.count() == usageCallCounts) {
95 program.fSharedElements.insert(program.fSharedElements.begin(),
96 addedBuiltins.rbegin(), addedBuiltins.rend());
static std::vector< SkPDFIndirectReference > sort(const THashSet< SkPDFIndirectReference > &src)
int find(T *array, int N, T item)
const FunctionDefinition * definition() const
IntrinsicKind intrinsicKind() const
static void usage(char *argv0)
ProgramSettings fSettings
std::shared_ptr< Context > fContext
std::unique_ptr< ProgramUsage > fUsage
ProgramInterface fInterface