r350340 - Validate -add-plugin arguments.

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 4 17:14:01 PST 2019


Thanks for the note. 350451 will hopefully help.

On Fri, Jan 4, 2019 at 2:18 PM Galina Kistanova via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Hello Nico,
>
> This commit broke tests on llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast
> builder:
>
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/41673
>
> . . .
> Failing Tests (2):
>     Clang :: CodeGenCXX/debug-info-class-limited-plugin.test
>     Clang :: Frontend/plugin-vs-debug-info.cpp
>
> Please have a look ASAP?
>
> Thanks
>
> Galina
>
> On Thu, Jan 3, 2019 at 10:29 AM Nico Weber via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: nico
>> Date: Thu Jan  3 10:26:06 2019
>> New Revision: 350340
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=350340&view=rev
>> Log:
>> Validate -add-plugin arguments.
>>
>> -plugin already prints an error if the name of an unknown plugin is
>> passed.
>> -add-plugin used to silently ignore that, now it errors too.
>>
>> Differential Revision: https://reviews.llvm.org/D56273
>>
>> Added:
>>     cfe/trunk/test/Frontend/plugin-unknown.c
>> Modified:
>>     cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>>
>> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=350340&r1=350339&r2=350340&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
>> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Jan  3 10:26:06 2019
>> @@ -33,6 +33,7 @@
>>  #include "clang/Frontend/DependencyOutputOptions.h"
>>  #include "clang/Frontend/FrontendDiagnostic.h"
>>  #include "clang/Frontend/FrontendOptions.h"
>> +#include "clang/Frontend/FrontendPluginRegistry.h"
>>  #include "clang/Frontend/LangStandard.h"
>>  #include "clang/Frontend/MigratorOptions.h"
>>  #include "clang/Frontend/PreprocessorOutputOptions.h"
>> @@ -1663,7 +1664,20 @@ static InputKind ParseFrontendArgs(Front
>>      Opts.ProgramAction = frontend::PluginAction;
>>      Opts.ActionName = A->getValue();
>>    }
>> -  Opts.AddPluginActions = Args.getAllArgValues(OPT_add_plugin);
>> +  for (const std::string &Arg : Args.getAllArgValues(OPT_add_plugin)) {
>> +    bool Found = false;
>> +    for (FrontendPluginRegistry::iterator it =
>> FrontendPluginRegistry::begin(),
>> +                                          ie =
>> FrontendPluginRegistry::end();
>> +         it != ie; ++it) {
>> +      if (it->getName() == Arg)
>> +        Found = true;
>> +    }
>> +    if (!Found) {
>> +      Diags.Report(diag::err_fe_invalid_plugin_name) << Arg;
>> +      continue;
>> +    }
>> +    Opts.AddPluginActions.push_back(Arg);
>> +  }
>>    for (const auto *AA : Args.filtered(OPT_plugin_arg))
>>      Opts.PluginArgs[AA->getValue(0)].emplace_back(AA->getValue(1));
>>
>>
>> Added: cfe/trunk/test/Frontend/plugin-unknown.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/plugin-unknown.c?rev=350340&view=auto
>>
>> ==============================================================================
>> --- cfe/trunk/test/Frontend/plugin-unknown.c (added)
>> +++ cfe/trunk/test/Frontend/plugin-unknown.c Thu Jan  3 10:26:06 2019
>> @@ -0,0 +1,5 @@
>> +// RUN: not %clang_cc1 -plugin asdf %s 2>&1 | FileCheck %s
>> +// RUN: not %clang_cc1 -add-plugin asdf %s 2>&1 | FileCheck
>> --check-prefix=ADD %s
>> +
>> +// CHECK: unable to find plugin 'asdf'
>> +// ADD: unable to find plugin 'asdf'
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
> _______________________________________________
> 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/20190104/52021e7e/attachment.html>


More information about the cfe-commits mailing list