From 3d97179472b861c6cbc9d0b31b8f4b9cd574f1bb Mon Sep 17 00:00:00 2001 From: luochuhao Date: Thu, 10 Feb 2022 19:31:39 +0800 Subject: [PATCH] Clean codemars problems in OpenHarmony-3.0-LTS branch Change-Id: I7e2ccc7f12aef7988667482dc0d3606b0cf90a9d Signed-off-by: luochuhao --- ecmascript/compiler/llvm_mcjit_compiler.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ecmascript/compiler/llvm_mcjit_compiler.cpp b/ecmascript/compiler/llvm_mcjit_compiler.cpp index 2ad0a094..5927ecae 100644 --- a/ecmascript/compiler/llvm_mcjit_compiler.cpp +++ b/ecmascript/compiler/llvm_mcjit_compiler.cpp @@ -179,7 +179,11 @@ void LLVMMCJITCompiler::Disassemble(std::map addr2name) c while (numBytes != 0) { size_t InstSize = LLVMDisasmInstruction(dcr, byteSp, numBytes, pc, outString, outStringSize); if (InstSize == 0) { - fprintf(stderr, "%08x: %08x maybe constant\n", pc, *reinterpret_cast(byteSp)); + std::cerr.fill('0'); + std::cerr.width(8); // 8:fixed hex print width + std::cerr << std::hex << pc << ":"; + std::cerr.width(8); // 8:fixed hex print width + std::cerr << std::hex << *reinterpret_cast(byteSp) << "maybe constant" << std::endl; pc += 4; // 4 pc length byteSp += 4; // 4 sp offset numBytes -= 4; // 4 num bytes @@ -188,7 +192,11 @@ void LLVMMCJITCompiler::Disassemble(std::map addr2name) c if (addr2name.find(addr) != addr2name.end()) { std::cout << addr2name[addr].c_str() << ":" << std::endl; } - fprintf(stderr, "%08x: %08x %s\n", pc, *reinterpret_cast(byteSp), outString); + std::cerr.fill('0'); + std::cerr.width(8); // 8:fixed hex print width + std::cerr << std::hex << pc << ":"; + std::cerr.width(8); // 8:fixed hex print width + std::cerr << std::hex << *reinterpret_cast(byteSp) << " " << outString << std::endl; pc += InstSize; byteSp += InstSize; numBytes -= InstSize;