xref: /llvm-project/clang/test/Driver/plugin-driver-args.cpp (revision 4ad3de901e8acfafdeb59406064f24a3c2ea27e8)
1 /// Test passing args to plugins via the clang driver and -fplugin-arg
2 // RUN: %clang -fplugin=%llvmshlibdir/CallSuperAttr%pluginext -fplugin-arg-call_super_plugin-help -fsyntax-only -### %s 2>&1 | FileCheck %s
3 
4 // CHECK: "-load"
5 // CHECK-SAME: CallSuperAttr
6 // CHECK-SAME: "-plugin-arg-call_super_plugin"
7 // CHECK-SAME: "help"
8 
9 /// Check that dashed-args get forwarded like this to the plugin.
10 /// Dashes cannot be part of the plugin name here
11 // RUN: %clang -fplugin=%llvmshlibdir/CallSuperAttr%pluginext -fplugin-arg-call_super_plugin-help-long -fsyntax-only %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CMD
12 // CHECK-CMD: "-plugin-arg-call_super_plugin" "help-long"
13 
14 /// Error handling for -fplugin-arg-
15 // RUN: %clang -fplugin=%llvmshlibdir/CallSuperAttr%pluginext -fplugin-arg- -fsyntax-only %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PLUGIN-NAME
16 // CHECK-NO-PLUGIN-NAME: missing plugin name in -fplugin-arg-
17 
18 // RUN: %clang -fplugin=%llvmshlibdir/CallSuperAttr%pluginext -fplugin-arg-testname -fsyntax-only %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PLUGIN-ARG1
19 // CHECK-NO-PLUGIN-ARG1: missing plugin argument for plugin testname in -fplugin-arg-testname
20 
21 // RUN: %clang -fplugin=%llvmshlibdir/CallSuperAttr%pluginext -fplugin-arg-testname- -fsyntax-only %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PLUGIN-ARG2
22 // CHECK-NO-PLUGIN-ARG2: missing plugin argument for plugin testname in -fplugin-arg-testname-
23 
24 // Plugins are only relevant for the -cc1 phase. No warning should be raised
25 // when only using the assembler. See GH #88173.
26 // RUN: %clang -c -fpass-plugin=bar.so -fplugin=bar.so -fplugin-arg-bar-option -Wunused-command-line-argument -x assembler %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PLUGIN-ASM
27 // CHECK-PLUGIN-ASM-NOT: argument unused during compilation: '-f{{[a-z-]*plugin[^']*}}'
28