[clang] Don't modify OptRemark if the argument is not relevant
authorArthur Eubanks <aeubanks@google.com>
Wed, 29 Sep 2021 01:33:26 +0000 (18:33 -0700)
committerArthur Eubanks <aeubanks@google.com>
Thu, 30 Sep 2021 18:36:30 +0000 (11:36 -0700)
commit76902079e42958118f01b4550d68a9b54c9e8e7e
tree8a50dac0a3aa59d00654804c8ce2a3e8e859eb85
parent691814f9cc79ff3b63cb53946a88c4db9c1f048d
[clang] Don't modify OptRemark if the argument is not relevant

A followup to D110201.

 For example, we'd set OptimizationRemarkMissed's Regex to '.*' when
encountering -Rpass. Normally this doesn't actually affect remarks we
emit because in clang::ProcessWarningOptions() we'll separately look at
all -R arguments and turn on/off corresponding diagnostic groups.
However, this is reproducible with -round-trip-args.

Reviewed By: JamesNagurne

Differential Revision: https://reviews.llvm.org/D110673
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Frontend/optimization-remark.c