Skip to content

Commit

Permalink
rewriter: format SourceRewriter.cpp, GenCallAsm.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
kkysen committed Dec 18, 2024
1 parent 0dffc16 commit 0a64bd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tools/rewriter/GenCallAsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ static void emit_switch_stacks(AsmWriter &aw, int old_pkey, int new_pkey, Arch a
add_asm_line(aw, "add x10, x10, x9");
// Tag the pointer with the old pkey
if (old_pkey != 0) {
add_asm_line(aw, llvm::formatv("orr x10, x10, #{0:x}00000000000000", old_pkey));
add_asm_line(aw, llvm::formatv("orr x10, x10, #{0:x}00000000000000", old_pkey));
}
add_comment_line(aw, "Write old stack pointer to memory");
// Keep the old stack pointer in x12
Expand All @@ -370,7 +370,7 @@ static void emit_switch_stacks(AsmWriter &aw, int old_pkey, int new_pkey, Arch a
add_asm_line(aw, "add x10, x10, x9");
// Tag the pointer with the new pkey
if (new_pkey != 0) {
add_asm_line(aw, llvm::formatv("orr x10, x10, #{0:x}00000000000000", new_pkey));
add_asm_line(aw, llvm::formatv("orr x10, x10, #{0:x}00000000000000", new_pkey));
}
add_comment_line(aw, "Read new stack pointer from memory");
add_asm_line(aw, "ldr x11, [x10]");
Expand Down
8 changes: 4 additions & 4 deletions tools/rewriter/SourceRewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct DirectoryParser : public llvm::cl::parser<std::string> {
bool parse(llvm::cl::Option &O, llvm::StringRef ArgName, const llvm::StringRef &ArgValue,
std::string &Value) {
llvm::cl::parser<std::string>::parse(O, ArgName, ArgValue, Value);
llvm::SmallString<PATH_MAX> dir { llvm::StringRef(Value) };
llvm::SmallString<PATH_MAX> dir{llvm::StringRef(Value)};
bool exists = llvm::sys::fs::is_directory(dir);
if (!exists) {
llvm::errs() << "error: directory does not exist: " << dir << "\n";
Expand Down Expand Up @@ -1053,7 +1053,7 @@ std::optional<Pkey> pkey_from_commands(std::function<std::optional<std::vector<C
comp_cmds.resize(1);
}
assert(comp_cmds.size() == 1);

auto cc_cmd = *comp_cmd_with_pkey;

auto pkey_define = std::find_if(cc_cmd.CommandLine.begin(),
Expand Down Expand Up @@ -1163,7 +1163,7 @@ int main(int argc, const char **argv) {
if (!(config_0 || config_1)) {
llvm::errs() << "Error in pkey configuration. The following pkeys were used: [";
bool first = true;
for (const Pkey& pkey : pkeys_used) {
for (const Pkey &pkey : pkeys_used) {
if (!first) {
llvm::errs() << ", ";
}
Expand Down Expand Up @@ -1432,7 +1432,7 @@ int main(int argc, const char **argv) {
// Define wrappers for function pointers (i.e. those referenced by IA2_FN)
for (const auto &[fn_name, opaque] : ptr_expr_pass.addr_taken_fns) {
if (generated_wrappers.contains(fn_name)) {
continue;
continue;
}
llvm::errs() << " inserting " << fn_name << " into set\n";
generated_wrappers.insert(fn_name);
Expand Down

0 comments on commit 0a64bd9

Please sign in to comment.