diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index bb6627364442e..5e5e5ce233f31 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -279,6 +279,13 @@ static cl::list PassPlugins("load-pass-plugin", cl::desc("Load passes from plugin library")); +static cl::opt TryUseNewDbgInfoFormat( + "try-experimental-debuginfo-iterators", + cl::desc("Enable debuginfo iterator positions, if they're built in"), + cl::init(false)); + +extern cl::opt UseNewDbgInfoFormat; + //===----------------------------------------------------------------------===// // CodeGen-related helper functions. // @@ -452,6 +459,17 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, "llvm .bc -> .bc modular optimizer and analysis printer\n"); + // RemoveDIs debug-info transition: tests may request that we /try/ to use the + // new debug-info format, if it's built in. +#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS + if (TryUseNewDbgInfoFormat) { + // If LLVM was built with support for this, turn the new debug-info format + // on. + UseNewDbgInfoFormat = true; + } +#endif + (void)TryUseNewDbgInfoFormat; + LLVMContext Context; // TODO: remove shouldForceLegacyPM().