]> granicus.if.org Git - clang/commitdiff
Revert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags"
authorYuka Takahashi <yukatkh@gmail.com>
Tue, 29 Aug 2017 00:09:31 +0000 (00:09 +0000)
committerYuka Takahashi <yukatkh@gmail.com>
Tue, 29 Aug 2017 00:09:31 +0000 (00:09 +0000)
This reverts commit 7c46b80c022e18d43c1fdafb117b0c409c5a6d1e.

r311552 broke lld buildbot because I've changed OptionInfos type from
ArrayRef to vector. However the bug is fixed, so I'll commit this again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311958 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/CC1Options.td
lib/Driver/DriverOptions.cpp
test/Driver/autocomplete.c

index c53d7a9136afc4cf8b6918ed8a328bca941debbe..74e4fb60eef92e7e1b4e9b906f78203f10af5d91 100644 (file)
@@ -99,7 +99,19 @@ def analyzer_stats : Flag<["-"], "analyzer-stats">,
   HelpText<"Print internal analyzer statistics.">;
 
 def analyzer_checker : Separate<["-"], "analyzer-checker">,
-  HelpText<"Choose analyzer checkers to enable">;
+  HelpText<"Choose analyzer checkers to enable">,
+  ValuesCode<[{
+    const char *Values =
+    #define GET_CHECKERS
+    #define CHECKER(FULLNAME, CLASS, DESCFILE, HT, G, H)  FULLNAME ","
+    #include "clang/StaticAnalyzer/Checkers/Checkers.inc"
+    #undef GET_CHECKERS
+    #define GET_PACKAGES
+    #define PACKAGE(FULLNAME, G, D)  FULLNAME ","
+    #include "clang/StaticAnalyzer/Checkers/Checkers.inc"
+    #undef GET_PACKAGES
+    ;
+  }]>;
 def analyzer_checker_EQ : Joined<["-"], "analyzer-checker=">,
   Alias<analyzer_checker>;
 
index ac63b96cf96d1a460a70ece4cb533481a6300ae9..11e7e4c8fe2bd596e971b72b499cc6cadfe00a71 100644 (file)
@@ -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);
 }
index 5680801a64a28fa05a0bc482659df2b68c8bc70f..06e700f1ac887aa772561be61b9281576077792f 100644 (file)
@@ -93,3 +93,5 @@
 // WARNING-NEXT: -Wmax-unsigned-zero
 // RUN: %clang --autocomplete=-Wno-invalid-pp- | FileCheck %s -check-prefix=NOWARNING
 // NOWARNING: -Wno-invalid-pp-token
+// RUN: %clang --autocomplete=-analyzer-checker, | FileCheck %s -check-prefix=ANALYZER
+// ANALYZER: unix.Malloc