mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 13:50:11 +00:00
3e67cf21a1
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
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
// RUN: %clang_cc1 -load %llvmshlibdir/CallSuperAttr%pluginext -fsyntax-only -verify=callsuper %s
|
|
// RUN: %clang_cc1 -load %llvmshlibdir/CallSuperAttr%pluginext -DBAD_CALLSUPER -fsyntax-only -verify=badcallsuper %s
|
|
// REQUIRES: plugins, examples
|
|
|
|
// callsuper-no-diagnostics
|
|
struct Base1 {
|
|
[[clang::call_super]] virtual void Test() {}
|
|
};
|
|
struct Base2 {
|
|
[[clang::call_super]] virtual void Test() {}
|
|
};
|
|
struct Derive : public Base1, public Base2 {
|
|
#ifndef BAD_CALLSUPER
|
|
void Test() override;
|
|
#else
|
|
[[clang::call_super]] virtual void Test() override final;
|
|
// badcallsuper-warning@16 {{'call_super' attribute marked on a final method}}
|
|
#endif
|
|
};
|
|
void Derive::Test() {
|
|
Base1::Test();
|
|
#ifndef BAD_CALLSUPER
|
|
Base2::Test();
|
|
#else
|
|
// badcallsuper-warning@20 {{virtual function 'Base2::Test' is marked as 'call_super' but this overriding method does not call the base version}}
|
|
// badcallsuper-note@10 {{function marked 'call_super' here}}
|
|
#endif
|
|
}
|
|
struct Derive2 : public Base1, public Base2 {
|
|
void Test() override {
|
|
Base1::Test();
|
|
Base2::Test();
|
|
}
|
|
};
|