aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
authorbadumbatish <tanghocle456@gmail.com>2024-07-26 20:26:01 -0700
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-19 15:32:07 +0100
commit6ec82928851302bed173b40fb9f95d4cf53a26e4 (patch)
treecf37b5f3fd16557fb3b21017bbe0a6ed7f3e2350 /gcc/rust/backend
parent1398473b12863138325f2884fa13d77c311fb1db (diff)
downloadgcc-6ec82928851302bed173b40fb9f95d4cf53a26e4.zip
gcc-6ec82928851302bed173b40fb9f95d4cf53a26e4.tar.gz
gcc-6ec82928851302bed173b40fb9f95d4cf53a26e4.tar.bz2
gccrs: Move strip double quotes, add scaffold expand
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (strip_double_quotes): Move strip double quotes to parse phase (CompileAsm::asm_construct_string_tree): Likewise * backend/rust-compile-asm.h (strip_double_quotes): Likewise * expand/rust-macro-builtins-asm.cc (strip_double_quotes): Likewise (expand_inline_asm): Renamed to expand_inline_asm_strings (expand_inline_asm_strings): Renamed from expand_inline_asm (parse_asm): Move strip double quotes to parse phase (parse_format_strings): Likewise * expand/rust-macro-builtins-asm.h (strip_double_quotes): Likewise (expand_inline_asm_strings): Inline asm expansion fn (expand_inline_asm_string): Inline asm expansion fn
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile-asm.cc16
-rw-r--r--gcc/rust/backend/rust-compile-asm.h3
2 files changed, 1 insertions, 18 deletions
diff --git a/gcc/rust/backend/rust-compile-asm.cc b/gcc/rust/backend/rust-compile-asm.cc
index 9305a90..30a8cac 100644
--- a/gcc/rust/backend/rust-compile-asm.cc
+++ b/gcc/rust/backend/rust-compile-asm.cc
@@ -1,22 +1,8 @@
#include "rust-compile-asm.h"
-
#include "rust-system.h"
namespace Rust {
namespace Compile {
-std::string
-strip_double_quotes (const std::string &str)
-{
- // Helper function strips the beginning and ending double quotes from a
- // string.
- std::string result = str;
-
- rust_assert (result.size () >= 3);
- result.erase (0, 1);
- result.erase (result.size () - 1, 1);
- return result;
-}
-
CompileAsm::CompileAsm (Context *ctx)
: HIRCompileBase (ctx), translated (error_mark_node)
{}
@@ -86,7 +72,7 @@ CompileAsm::asm_construct_string_tree (HIR::InlineAsm &expr)
// debugging and reading)
std::stringstream ss;
for (const auto &template_str : expr.template_strs)
- ss << strip_double_quotes (template_str.symbol) << "\n\t";
+ ss << template_str.symbol << "\n\t";
std::string result = ss.str ();
return build_string (result.size () + 1, result.c_str ());
diff --git a/gcc/rust/backend/rust-compile-asm.h b/gcc/rust/backend/rust-compile-asm.h
index 8307d89..05bb99a 100644
--- a/gcc/rust/backend/rust-compile-asm.h
+++ b/gcc/rust/backend/rust-compile-asm.h
@@ -26,9 +26,6 @@
namespace Rust {
namespace Compile {
-std::string
-strip_double_quotes (const std::string &);
-
class CompileAsm : private HIRCompileBase, protected HIR::HIRExpressionVisitor
{
private: