summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yi Kong <yikong@google.com> 2021-09-11 01:42:49 +0800
committer Yi Kong <yikong@google.com> 2021-09-11 01:50:45 +0800
commit7fae86c62a9ffeb94a7c11f1660c94873368dcec (patch)
tree6b5ff39982b80ea16856ee8bd39132047de4b8ae
parent1c494e36f246a982070e125dec3c1139f9289c6e (diff)
Make sure only comments are stripped
The regex " +#.*" could also match immediates on ARM, e.g. cmp r1, #1234 Fix it by requiring a space after the hash mark. Test: art_compiler_host_tests Change-Id: I3cf038ff6547edad8a417961d8bb2b27c0872f51
-rw-r--r--compiler/utils/assembler_test_base.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/utils/assembler_test_base.h b/compiler/utils/assembler_test_base.h
index 73318639c2..bf73808603 100644
--- a/compiler/utils/assembler_test_base.h
+++ b/compiler/utils/assembler_test_base.h
@@ -252,7 +252,7 @@ class AssemblerTestBase : public testing::Test {
// Remove comments emitted by objdump.
std::string StripComments(const std::string& str) {
- return std::regex_replace(str, std::regex(" +#.*"), "");
+ return std::regex_replace(str, std::regex(" +# .*"), "");
}
std::optional<ScratchDir> scratch_dir_;