diff options
author | Yuka Takahashi <yukatkh@gmail.com> | 2017-08-23 13:39:47 +0000 |
---|---|---|
committer | Yuka Takahashi <yukatkh@gmail.com> | 2017-08-23 13:39:47 +0000 |
commit | ecfb2759da6ef7888552ecd02346a8a05a362fc8 (patch) | |
tree | 6c94e6cb8943a094f5ca583eeb41dac1ca76fb0a /lib | |
parent | ba1ec3c54a66286fe964b2f79286e706e45e7b9e (diff) | |
download | clang-ecfb2759da6ef7888552ecd02346a8a05a362fc8.tar.gz |
[Bash-autocompletion] Add support for static analyzer flags
Summary:
This is a patch for clang autocomplete feature.
It will collect values which -analyzer-checker takes, which is defined in
clang/StaticAnalyzer/Checkers/Checkers.inc, dynamically.
First, from ValuesCode class in Options.td, TableGen will generate C++
code in Options.inc. Options.inc will be included in DriverOptions.cpp, and
calls OptTable's addValues function. addValues function will add second
argument to Option's Values class. Values contains string like "foo,bar,.."
which is handed to Values class
in OptTable.
Reviewers: v.g.vassilev, teemperor, ruiu
Subscribers: hiraditya, cfe-commits
Differential Revision: https://reviews.llvm.org/D36782
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311552 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Driver/DriverOptions.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Driver/DriverOptions.cpp b/lib/Driver/DriverOptions.cpp index ac63b96cf9..11e7e4c8fe 100644 --- a/lib/Driver/DriverOptions.cpp +++ b/lib/Driver/DriverOptions.cpp @@ -11,6 +11,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Option/OptTable.h" #include "llvm/Option/Option.h" +#include <cassert> using namespace clang::driver; using namespace clang::driver::options; @@ -40,5 +41,13 @@ public: } std::unique_ptr<OptTable> clang::driver::createDriverOptTable() { - return llvm::make_unique<DriverOptTable>(); + 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; +#define OPTTABLE_ARG_INIT +#include "clang/Driver/Options.inc" +#undef OPTTABLE_ARG_INIT + return std::move(Result); } |