LTO: Ignore disabled diagnostic remarks
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 1 Oct 2014 18:36:03 +0000 (18:36 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 1 Oct 2014 18:36:03 +0000 (18:36 +0000)
commit04d21865464a342d07d000492d2678ed6f7b45ff
tree9928a4a83028c0b42a22f05ce5e6970cb39f2b96
parent7538babc12e961f405878f0c53c301f259ef5ef2
LTO: Ignore disabled diagnostic remarks

r206400 and r209442 added remarks that are disabled by default.
However, if a diagnostic handler is registered, the remarks are sent
unfiltered to the handler.  This is the right behaviour for clang, since
it has its own filters.

However, the diagnostic handler exposed in the LTO API receives only the
severity and message.  It doesn't have the information to filter by pass
name.  For LTO, disabled remarks should be filtered by the producer.

I've changed `LLVMContext::setDiagnosticHandler()` to take a `bool`
argument indicating whether to respect the built-in filters.  This
defaults to `false`, so other consumers don't have a behaviour change,
but `LTOCodeGenerator::setDiagnosticHandler()` sets it to `true`.

To make this behaviour testable, I added a `-use-diagnostic-handler`
command-line option to `llvm-lto`.

This fixes PR21108.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218784 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/LLVMContext.h
lib/IR/LLVMContext.cpp
lib/IR/LLVMContextImpl.cpp
lib/IR/LLVMContextImpl.h
lib/LTO/LTOCodeGenerator.cpp
test/LTO/diagnostic-handler-remarks.ll [new file with mode: 0644]
tools/llvm-lto/llvm-lto.cpp