r311958 - Revert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags"
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 9 06:03:25 PDT 2018
Yes.
On Mon, Apr 9, 2018 at 9:00 AM, Yuka Takahashi <yukatkh at gmail.com> wrote:
> Hi Nico,
>
> Thanks for your comment!
>
> I do agree that this code is hacky. Do you mean to ask tablegen to
> generate Checkers.inc under Driver so that we can do like this? :
> #define CHECKER(FULLNAME, CLASS, DESCFILE, HT, G, H) FULLNAME ","
> #include "clang/Driver/Checkers.inc"
> #undef GET_CHECKERS
>
> Cheers,
> Yuka
>
> 2018-04-07 4:28 GMT+02:00 Nico Weber <thakis at chromium.org>:
>
>> Hi Yuka,
>>
>> sorry about the late review comment on this. I just happened to see that
>> this lets Driver's Option.inc depend on StaticAnalyzer/Checker's
>> Checker.inc. However, Driver does not depend on StaticAnalyzer/Checker. In
>> practice, it works ok because of all tablegen targets being collected
>> into clang-tablegen-targets and driver depending on that (
>> http://llvm-cs.pcc.me.uk/tools/clang/CMakeLists.txt#442), but it still
>> feels a bit hacky that Driver's tablegen output depends on code generated
>> by StaticAnalyzer/Checker. Maybe we should move Checker.td into Driver now?
>>
>> Nico
>>
>> On Mon, Aug 28, 2017 at 8:09 PM, Yuka Takahashi via cfe-commits <
>> cfe-commits at lists.llvm.org> wrote:
>>
>>> Author: yamaguchi
>>> Date: Mon Aug 28 17:09:31 2017
>>> New Revision: 311958
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=311958&view=rev
>>> Log:
>>> Revert "Revert r311552: [Bash-autocompletion] Add support for static
>>> analyzer flags"
>>>
>>> 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.
>>>
>>> Modified:
>>> cfe/trunk/include/clang/Driver/CC1Options.td
>>> cfe/trunk/lib/Driver/DriverOptions.cpp
>>> cfe/trunk/test/Driver/autocomplete.c
>>>
>>> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/
>>> Driver/CC1Options.td?rev=311958&r1=311957&r2=311958&view=diff
>>> ============================================================
>>> ==================
>>> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
>>> +++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Aug 28 17:09:31
>>> 2017
>>> @@ -99,7 +99,19 @@ def analyzer_stats : Flag<["-"], "analyz
>>> 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>;
>>>
>>>
>>> Modified: cfe/trunk/lib/Driver/DriverOptions.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Dri
>>> verOptions.cpp?rev=311958&r1=311957&r2=311958&view=diff
>>> ============================================================
>>> ==================
>>> --- cfe/trunk/lib/Driver/DriverOptions.cpp (original)
>>> +++ cfe/trunk/lib/Driver/DriverOptions.cpp Mon Aug 28 17:09:31 2017
>>> @@ -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);
>>> }
>>>
>>> Modified: cfe/trunk/test/Driver/autocomplete.c
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/au
>>> tocomplete.c?rev=311958&r1=311957&r2=311958&view=diff
>>> ============================================================
>>> ==================
>>> --- cfe/trunk/test/Driver/autocomplete.c (original)
>>> +++ cfe/trunk/test/Driver/autocomplete.c Mon Aug 28 17:09:31 2017
>>> @@ -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
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180409/7339845d/attachment.html>
More information about the cfe-commits
mailing list