Lines Matching refs:std

42 using namespace std::string_literals;
79 std::string arch_visibility_str; in calculateRequiredGuard()
84 arch_visibility_str += std::to_string(arch_visibility[arch]); in calculateRequiredGuard()
112 static std::deque<std::string> readFileLines(const std::string& path) { in readFileLines()
113 std::ifstream is(path.c_str()); in readFileLines()
114 std::deque<std::string> result; in readFileLines()
115 std::string line; in readFileLines()
117 while (std::getline(is, line)) { in readFileLines()
118 result.push_back(std::move(line)); in readFileLines()
124 static void writeFileLines(const std::string& path, const std::deque<std::string>& lines) { in writeFileLines()
129 std::ofstream os(path.c_str(), std::ios_base::out | std::ios_base::trunc); in writeFileLines()
131 for (const std::string& line : lines) { in writeFileLines()
136 using GuardMap = std::map<Location, DeclarationAvailability>;
138 static std::string generateGuardCondition(const DeclarationAvailability& avail) { in generateGuardCondition()
140 std::vector<std::string> expressions; in generateGuardCondition()
141 static const std::vector<std::pair<std::string, std::set<Arch>>> arch_sets = { in generateGuardCondition()
146 std::map<Arch, std::string> individual_archs = { in generateGuardCondition()
153 auto generate_guard = [](const std::string& arch_expr, int min_version) { in generateGuardCondition()
157 return arch_expr + " && __ANDROID_API__ >= " + std::to_string(min_version); in generateGuardCondition()
179 return "__ANDROID_API__ >= "s + std::to_string(avail.global_availability.introduced); in generateGuardCondition()
183 const std::string& arch_expr = it.first; in generateGuardCondition()
184 const std::set<Arch>& archs = it.second; in generateGuardCondition()
222 const std::string& arch_expr = it.second; in generateGuardCondition()
241 static FileLocation findNextSemicolon(const std::deque<std::string>& lines, FileLocation start) { in findNextSemicolon()
247 if (result != std::string::npos) { in findNextSemicolon()
264 static void mergeGuards(std::deque<std::string>& file_lines, GuardMap& guard_map) { in mergeGuards()
304 const std::string& line = file_lines[current_location.line - 1]; in mergeGuards()
309 if (pos == std::string::npos) { in mergeGuards()
322 if (pos == std::string::npos) { in mergeGuards()
377 std::tie(current, unused) = guard_map.insert(std::make_pair(merged, avail)); in mergeGuards()
383 static void rewriteFile(const std::string& output_path, std::deque<std::string>& file_lines, in rewriteFile()
389 std::string condition = generateGuardCondition(avail); in rewriteFile()
394 std::string prologue = "\n#if "s + condition + "\n"; in rewriteFile()
395 std::string epilogue = "\n#endif /* " + condition + " */\n"; in rewriteFile()
407 bool preprocessHeaders(const std::string& dst_dir, const std::string& src_dir, in preprocessHeaders()
409 std::unordered_map<std::string, GuardMap> guards; in preprocessHeaders()
410 std::unordered_map<std::string, std::deque<std::string>> file_lines; in preprocessHeaders()
433 std::unique_ptr<FTS, decltype(&fts_close)> fts(fts_open(fts_paths, FTS_LOGICAL, nullptr), in preprocessHeaders()
449 std::string rel_path = path.substr(src_dir.length() + 1).str(); in preprocessHeaders()
450 std::string dst_path = dst_dir + "/" + rel_path; in preprocessHeaders()
488 std::string output_path = (llvm::Twine(dst_dir) + rel_path).str(); in preprocessHeaders()