[all-commits] [llvm/llvm-project] b4b546: [clang][Driver] Don't overwrite `DiagnosticsEngine...

Volodymyr Sapsai via All-commits all-commits at lists.llvm.org
Fri Dec 2 11:59:43 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b4b54697b7aacda1fabef36d4e74d5ee45641618
      https://github.com/llvm/llvm-project/commit/b4b54697b7aacda1fabef36d4e74d5ee45641618
  Author: Volodymyr Sapsai <vsapsai at apple.com>
  Date:   2022-12-02 (Fri, 02 Dec 2022)

  Changed paths:
    M clang/lib/Driver/Driver.cpp
    M clang/tools/libclang/CIndex.cpp

  Log Message:
  -----------
  [clang][Driver] Don't overwrite `DiagnosticsEngine::IgnoreAllWarnings`, rely on `DiagnosticOptions::IgnoreWarnings` value.

Driver overwrites `DiagnosticsEngine::IgnoreAllWarnings` based on `-w` flag
without taking into account `DiagnosticOptions::IgnoreWarnings` that is
propagated to `DiagnosticsEngine` in `ProcessWarningOptions` (called from
`CompilerInstance::createDiagnostics`). It makes it hard to manipulate
`DiagnosticOptions` directly and pushes towards string-based API.

Most of in-tree tools use `DiagnosticOptions` already, so migrate
`clang_parseTranslationUnit_Impl` to use it too. Don't parse `-w`
directly but rely on
```
def w : Flag<["-"], "w">, HelpText<"Suppress all warnings">, Flags<[CC1Option]>,
  MarshallingInfoFlag<DiagnosticOpts<"IgnoreWarnings">>;
```

Allows to reland D138252.

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




More information about the All-commits mailing list