================
@@ -1539,6 +1541,111 @@ void clang::emitBackendOutput(CompilerInstance &CI, 
CodeGenOptions &CGOpts,
     }
   }
 
+
+  bool EnableDynamicDebugging = CGOpts.DynamicDebugging;
+  // Disable dyndbg if the target isn't available as we're compiling to the
+  // inner module to object regardless of other options. (This may change).
+  if (EnableDynamicDebugging) {
+    std::string Error;
+    const llvm::Target *TheTarget =
+        TargetRegistry::lookupTarget(M->getTargetTriple(), Error);
+    if (!TheTarget) {
+      Diags.Report(diag::warn_dyndbg_unable_to_create_target) << Error;
+      EnableDynamicDebugging = false;
+    }
+
+    // Instrumentation causes issues (parts of LLVM expect certain globals to
+    // have initializers). Intrinsics may already have been added to IR by now,
+    // so we can't just turn it off for the inner module (we'd have to strip
+    // them out / not clone them). TODO: Support instrumentation.
+    if (CGOpts.getProfileInstr() != driver::ProfileInstrKind::ProfileNone) {
+      Diags.Report(diag::err_dyndbg_no_instrumentation);
+      EnableDynamicDebugging = false;
+    }
+  }
+
+  if (EnableDynamicDebugging) {
----------------
OCHyams wrote:

Done, how does this look now?

https://github.com/llvm/llvm-project/pull/194860
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to