[clang] [llvm] [driver] Make --version show if assertions, etc. are enabled (PR #87585)

Cassie Jones via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 4 14:07:52 PDT 2024


================
@@ -2002,6 +2002,44 @@ void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const {
   // Print out the install directory.
   OS << "InstalledDir: " << Dir << '\n';
 
+  // Print out build configuration options that impact the compiler's runtime
+  // behavior. Intended for identifying the source of issues when reproducing
+  // changes.
+  std::vector<std::string> BuildOptions = {
+#if !__OPTIMIZE__
+      "+unoptimized",
+#endif
+#ifndef NDEBUG
+      "+assertions",
+#endif
+#ifdef EXPENSIVE_CHECKS
+      "+expensive-checks",
+#endif
+#if __has_feature(address_sanitizer)
+      "+asan",
+#endif
+#if __has_feature(undefined_behavior_sanitizer)
+      "+ubsan",
+#endif
+#if __has_feature(memory_sanitizer)
+      "+msan",
+#endif
+#if __has_feature(dataflow_sanitizer)
+      "+dfsan",
+#endif
+  };
+  if (!BuildOptions.empty()) {
----------------
porglezomp wrote:

Added this as `LLVM_VERSION_PRINTER_SHOW_BUILD_CONFIG` which defaults on, is there anything I should do to update the release scripts here or is that for someone else to do?

https://github.com/llvm/llvm-project/pull/87585


More information about the cfe-commits mailing list