[all-commits] [llvm/llvm-project] 41e391: [clang] Introduce diagnostics suppression mappings...

kadir çetinkaya via All-commits all-commits at lists.llvm.org
Tue Nov 12 01:54:05 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 41e3919ded78d8870f7c95e9181c7f7e29aa3cc4
      https://github.com/llvm/llvm-project/commit/41e3919ded78d8870f7c95e9181c7f7e29aa3cc4
  Author: kadir çetinkaya <kadircet at google.com>
  Date:   2024-11-12 (Tue, 12 Nov 2024)

  Changed paths:
    M clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
    M clang/docs/ReleaseNotes.rst
    M clang/docs/UsersManual.rst
    A clang/docs/WarningSuppressionMappings.rst
    M clang/docs/index.rst
    M clang/include/clang/Basic/Diagnostic.h
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Basic/DiagnosticOptions.h
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Frontend/CompilerInstance.h
    M clang/lib/Basic/Diagnostic.cpp
    M clang/lib/Basic/DiagnosticIDs.cpp
    M clang/lib/Basic/Warnings.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/ASTUnit.cpp
    M clang/lib/Frontend/CompilerInstance.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/lib/Frontend/PrecompiledPreamble.cpp
    M clang/lib/Interpreter/CodeCompletion.cpp
    M clang/lib/Serialization/ASTReader.cpp
    A clang/test/Misc/Inputs/suppression-mapping.txt
    A clang/test/Misc/warning-suppression-mappings-pragmas.cpp
    A clang/test/Misc/warning-suppression-mappings.cpp
    M clang/tools/driver/cc1gen_reproducer_main.cpp
    M clang/tools/driver/driver.cpp
    M clang/unittests/Basic/DiagnosticTest.cpp
    M clang/unittests/Frontend/CompilerInvocationTest.cpp
    M llvm/include/llvm/Support/SpecialCaseList.h

  Log Message:
  -----------
  [clang] Introduce diagnostics suppression mappings (#112517)

This implements

https://discourse.llvm.org/t/rfc-add-support-for-controlling-diagnostics-severities-at-file-level-granularity-through-command-line/81292.

Users now can suppress warnings for certain headers by providing a
mapping with globs, a sample file looks like:
```
[unused]
src:*
src:*clang/*=emit
```

This will suppress warnings from `-Wunused` group in all files that
aren't under `clang/` directory. This mapping file can be passed to
clang via `--warning-suppression-mappings=foo.txt`.

At a high level, mapping file is stored in DiagnosticOptions and then
processed with rest of the warning flags when creating a
DiagnosticsEngine. This is a functor that uses SpecialCaseLists
underneath to match against globs coming from the mappings file.

This implies processing warning options now performs IO, relevant
interfaces are updated to take in a VFS, falling back to RealFileSystem
when one is not available.



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