This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG60854c328d87: Avoid calling ParseCommandLineOptions in BackendUtil if possible (authored by teemperor). Herald added a subscriber: cfe-commits.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99740/new/ https://reviews.llvm.org/D99740 Files: clang/lib/CodeGen/BackendUtil.cpp Index: clang/lib/CodeGen/BackendUtil.cpp =================================================================== --- clang/lib/CodeGen/BackendUtil.cpp +++ clang/lib/CodeGen/BackendUtil.cpp @@ -871,7 +871,15 @@ BackendArgs.push_back("-limit-float-precision"); BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str()); } + // Check for the default "clang" invocation that won't set any cl::opt values. + // Skip trying to parse the command line invocation to avoid the issues + // described below. + if (BackendArgs.size() == 1) + return; BackendArgs.push_back(nullptr); + // FIXME: The command line parser below is not thread-safe and shares a global + // state, so this call might crash or overwrite the options of another Clang + // instance in the same process. llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1, BackendArgs.data()); }
Index: clang/lib/CodeGen/BackendUtil.cpp =================================================================== --- clang/lib/CodeGen/BackendUtil.cpp +++ clang/lib/CodeGen/BackendUtil.cpp @@ -871,7 +871,15 @@ BackendArgs.push_back("-limit-float-precision"); BackendArgs.push_back(CodeGenOpts.LimitFloatPrecision.c_str()); } + // Check for the default "clang" invocation that won't set any cl::opt values. + // Skip trying to parse the command line invocation to avoid the issues + // described below. + if (BackendArgs.size() == 1) + return; BackendArgs.push_back(nullptr); + // FIXME: The command line parser below is not thread-safe and shares a global + // state, so this call might crash or overwrite the options of another Clang + // instance in the same process. llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1, BackendArgs.data()); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits