[all-commits] [llvm/llvm-project] 3e67cf: [clang][driver] Add -fplugin-arg- to pass argument...

Timm Bäder via All-commits all-commits at lists.llvm.org
Thu Nov 25 01:54:58 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3e67cf21a19a0e8917bdbab6f0cecd4880f3fbe2
      https://github.com/llvm/llvm-project/commit/3e67cf21a19a0e8917bdbab6f0cecd4880f3fbe2
  Author: Timm Bäder <tbaeder at redhat.com>
  Date:   2021-11-25 (Thu, 25 Nov 2021)

  Changed paths:
    M clang/docs/ClangPlugins.rst
    M clang/docs/ReleaseNotes.rst
    M clang/examples/CallSuperAttribute/CallSuperAttrInfo.cpp
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChains/Clang.cpp
    A clang/test/Driver/plugin-driver-args.cpp
    M clang/test/Frontend/plugin-call-super.cpp

  Log Message:
  -----------
  [clang][driver] Add -fplugin-arg- to pass arguments to plugins

>From GCC's manpage:
-fplugin-arg-name-key=value
   Define an argument called key with a value of value for the
   plugin called name.

Since we don't have a key-value pair similar to gcc's plugin_argument
struct, simply accept key=value here anyway and pass it along as-is to
plugins.

This translates to the already existing '-plugin-arg-pluginname arg'
that clang cc1 accepts.

There is an ambiguity here because in clang, both the plugin name
as well as the option name can contain dashes, so when e.g. passing

 -fplugin-arg-foo-bar-foo

it is not clear whether the plugin is foo-bar and the option is foo,
or the plugin is foo and the option is bar-foo. GCC solves this by
interpreting all dashes as part of the option name. So dashes can't be
part of the plugin name in this case.

Differential Revision: https://reviews.llvm.org/D113250




More information about the All-commits mailing list