diff --git a/aot/options.cpp b/aot/options.cpp index 053713541f2bd471ef83574558beb549c8a6fb16..d202f240eb443045e8b784a38d22abdbe70054f3 100644 --- a/aot/options.cpp +++ b/aot/options.cpp @@ -120,12 +120,10 @@ bool Options::Parse(int argc, const char **argv) ss << inputStream.rdbuf(); parserInput_ = ss.str(); - sourceFile_ = BaseName(sourceFile_); - if (!outputFile.GetValue().empty()) { compilerOutput_ = outputFile.GetValue(); } else { - compilerOutput_ = RemoveExtension(sourceFile_).append(".abc"); + compilerOutput_ = RemoveExtension(BaseName(sourceFile_)).append(".abc"); } if (!logLevel.GetValue().empty()) { diff --git a/compiler/core/emitter.cpp b/compiler/core/emitter.cpp index d854586e297d8e57593853f89ed0292b1d04df32..bbb367d6d771f17f6448ae752dffe096b8b6b3f7 100644 --- a/compiler/core/emitter.cpp +++ b/compiler/core/emitter.cpp @@ -168,6 +168,10 @@ static size_t GetIRNodeWholeLength(const IRNode *node) static std::string WholeLine(const util::StringView &source, lexer::SourceRange range) { + if (source.Empty()) { + return {}; + } + ASSERT(range.end.index <= source.Length()); return source.Substr(range.start.index, range.end.index).EscapeSymbol(); } diff --git a/compiler/core/regScope.cpp b/compiler/core/regScope.cpp index 7fe199097ab15f522dc8dd7d5b24edfcbc335717..55e607f353de1bc6c3f8f0bbc8206bd22069208c 100644 --- a/compiler/core/regScope.cpp +++ b/compiler/core/regScope.cpp @@ -59,7 +59,7 @@ LocalRegScope::LocalRegScope(CodeGen *cg, binder::Scope *scope) : RegScope(cg) } } - if (cg_->IsDebug()) { + if (cg_->IsDebug() && !cg_->insns_.empty()) { cg_->scope_->SetScopeStart(cg_->insns_.back()); cg_->debugInfo_.VariableDebugInfo().push_back(cg_->scope_); }