[all-commits] [llvm/llvm-project] e74a7a: cc1: Report an error for multiple actions unless s...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue May 7 09:16:14 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e74a7a9fd79a74073277471243a44527c71eb4a9
      https://github.com/llvm/llvm-project/commit/e74a7a9fd79a74073277471243a44527c71eb4a9
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-05-07 (Tue, 07 May 2024)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticFrontendKinds.td
    M clang/lib/Frontend/CompilerInvocation.cpp
    A clang/test/Frontend/multiple-actions.c

  Log Message:
  -----------
  cc1: Report an error for multiple actions unless separated by -main-file-name (#91140)

When multiple actions are specified, the last one is used and others are
overridden. This might lead to confusion if the user is used to driver's
`-S -emit-llvm` behavior.

```
%clang_cc1 -S -emit-llvm a.c     # -S is overridden
%clang_cc1 -emit-llvm -S a.c     # -emit-llvm is overridden
%clang_cc1 -fsyntax-only -S a.c  # -fsyntax-only is overridden
```

However, we want to continue supporting overriding the driver action
with -Xclang:

* `clang -c -Xclang -ast-dump a.c` (`%clang -cc1 -emit-obj ...
-main-file-name a.c ... -ast-dump`)
* `clang -c -xc++ -Xclang -emit-module stl.modulemap`

As an exception, we allow -ast-dump* options to be composed together
(e.g. `-ast-dump -ast-dump-lookups` in AST/ast-dump-lookups.cpp).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list