aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/DriverOptions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Driver/DriverOptions.cpp')
-rw-r--r--lib/Driver/DriverOptions.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Driver/DriverOptions.cpp b/lib/Driver/DriverOptions.cpp
index 1ad188838eda..67d4198d222a 100644
--- a/lib/Driver/DriverOptions.cpp
+++ b/lib/Driver/DriverOptions.cpp
@@ -39,14 +39,17 @@ public:
}
-std::unique_ptr<OptTable> clang::driver::createDriverOptTable() {
- auto Result = llvm::make_unique<DriverOptTable>();
- // Options.inc is included in DriverOptions.cpp, and calls OptTable's
- // addValues function.
- // Opt is a variable used in the code fragment in Options.inc.
- OptTable &Opt = *Result;
+const llvm::opt::OptTable &clang::driver::getDriverOptTable() {
+ static const DriverOptTable *Table = []() {
+ auto Result = std::make_unique<DriverOptTable>();
+ // Options.inc is included in DriverOptions.cpp, and calls OptTable's
+ // addValues function.
+ // Opt is a variable used in the code fragment in Options.inc.
+ OptTable &Opt = *Result;
#define OPTTABLE_ARG_INIT
#include "clang/Driver/Options.inc"
#undef OPTTABLE_ARG_INIT
- return std::move(Result);
+ return Result.release();
+ }();
+ return *Table;
}