@@ -736,17 +736,6 @@ int emit_llvm(const std::string &infile,
736
736
LCompilers::PythonCompiler fe (compiler_options);
737
737
LCompilers::Result<std::unique_ptr<LCompilers::LLVMModule>>
738
738
res = fe.get_llvm3 (*asr, pass_manager, diagnostics, infile);
739
- if (compiler_options.emit_debug_info ) {
740
- if (!compiler_options.emit_debug_line_column ) {
741
- diagnostics.add (LCompilers::diag::Diagnostic (
742
- " The `emit_debug_line_column` is not enabled; please use the "
743
- " `--debug-with-line-column` option to get the correct "
744
- " location information" ,
745
- LCompilers::diag::Level::Warning,
746
- LCompilers::diag::Stage::Semantic, {})
747
- );
748
- }
749
- }
750
739
std::cerr << diagnostics.render (lm, compiler_options);
751
740
if (!res.ok ) {
752
741
LCOMPILERS_ASSERT (diagnostics.has_error ())
@@ -819,6 +808,18 @@ int compile_python_to_object_file(
819
808
diagnostics.diagnostics .clear ();
820
809
821
810
// ASR -> LLVM
811
+ if (compiler_options.emit_debug_info ) {
812
+ #ifndef HAVE_RUNTIME_STACKTRACE
813
+ diagnostics.add (LCompilers::diag::Diagnostic (
814
+ " The `runtime stacktrace` is not enabled. To get the stacktraces, "
815
+ " re-build LPython with `-DWITH_RUNTIME_STACKTRACE=yes`" ,
816
+ LCompilers::diag::Level::Error,
817
+ LCompilers::diag::Stage::Semantic, {})
818
+ );
819
+ std::cerr << diagnostics.render (lm, compiler_options);
820
+ return 1 ;
821
+ #endif
822
+ }
822
823
LCompilers::PythonCompiler fe (compiler_options);
823
824
LCompilers::LLVMEvaluator e (compiler_options.target );
824
825
std::unique_ptr<LCompilers::LLVMModule> m;
@@ -828,26 +829,6 @@ int compile_python_to_object_file(
828
829
auto asr_to_llvm_end = std::chrono::high_resolution_clock::now ();
829
830
times.push_back (std::make_pair (" ASR to LLVM" , std::chrono::duration<double , std::milli>(asr_to_llvm_end - asr_to_llvm_start).count ()));
830
831
831
- if (compiler_options.emit_debug_info ) {
832
- #ifdef HAVE_RUNTIME_STACKTRACE
833
- if (!compiler_options.emit_debug_line_column ) {
834
- diagnostics.add (LCompilers::diag::Diagnostic (
835
- " The `emit_debug_line_column` is not enabled; please use the "
836
- " `--debug-with-line-column` option to get the correct "
837
- " location information" ,
838
- LCompilers::diag::Level::Warning,
839
- LCompilers::diag::Stage::Semantic, {})
840
- );
841
- }
842
- #else
843
- diagnostics.add (LCompilers::diag::Diagnostic (
844
- " The `runtime stacktrace` is not enabled. To get the stacktraces, "
845
- " re-build LPython with `-DWITH_RUNTIME_STACKTRACE=yes`" ,
846
- LCompilers::diag::Level::Warning,
847
- LCompilers::diag::Stage::Semantic, {})
848
- );
849
- #endif
850
- }
851
832
std::cerr << diagnostics.render (lm, compiler_options);
852
833
if (!res.ok ) {
853
834
LCOMPILERS_ASSERT (diagnostics.has_error ())
0 commit comments